From eb9eddfb7d680dca671221dba9e47626dd5fb464 Mon Sep 17 00:00:00 2001 From: Martin Strobel Date: Fri, 31 Mar 2017 09:37:59 -0700 Subject: [PATCH] V9 Generated (#569) * Running latest Go Generator on all released packages. * Gen.go update (#547) * Updated Gen.go to use new autorest builld system * Comments from review * It works as expected again * Moving Storage to an Independent Repository (#556) * Updating CI to use Go 1.8. Go 1.8 was released on Thursday, February 16th. Many of our partners have adopted and we need to ensure that we support the most recent version. * Replacing storage folder with submodule. In order to allow for more independent growth of the storage package, we've given it its own repository. This change updates the main repository to use a submodule in order to prevent breaking changes for folks using storage today who do not want to migrate to the new repository. * Updating submodule target URL. There is an existing naming convention for Azure Storage repositories. the repo has been updated to match that convention, this updates the submodule to point to the new URL. * Responding to review feedback. * Updating submodule to ref v8.1.0 storage version. * Fixing issues found while reviewing PR. * Regenerating using latest swaggers. Using Azure/azure-rest-api-specs commit: 7d9b6c018d9de2b7de189ea8658963ef8d3bc41b * Regenerating with new API Version strategy & web composite. The new API Version strategy associated the API Version to send across the wire with each method instead of at the client level. Doing so allows us to support a broader range of composite swaggers (the immediate example is the web composite swagger.) It also means that making a call with an alternate API version is somewhat more difficult in this version. To do so, one would have to create their own Preparer for the request. In the future, we'll support multiple API Versions and allow for more stability by generating independent packages for each Operation Group in each API Version. We expect to have that done in the summer. * Regenerating against most recent swaggers. * Regenerating using latest preview version of compute. --- .gitmodules | 4 + .travis.yml | 8 +- Gododir/gen.go | 207 +- arm/analysisservices/client.go | 5 - arm/analysisservices/models.go | 19 +- arm/analysisservices/servers.go | 24 +- arm/analysisservices/version.go | 35 +- arm/apimanagement/apioperations.go | 15 +- arm/apimanagement/apiproducts.go | 3 +- arm/apimanagement/apis.go | 18 +- arm/apimanagement/authorizationservers.go | 15 +- arm/apimanagement/backends.go | 15 +- arm/apimanagement/certificates.go | 12 +- arm/apimanagement/client.go | 5 - arm/apimanagement/groups.go | 15 +- arm/apimanagement/groupusers.go | 9 +- arm/apimanagement/identityproviders.go | 15 +- arm/apimanagement/loggers.go | 15 +- arm/apimanagement/models.go | 0 arm/apimanagement/openidconnectproviders.go | 15 +- arm/apimanagement/policysnippets.go | 3 +- arm/apimanagement/productapis.go | 9 +- arm/apimanagement/productgroups.go | 9 +- arm/apimanagement/products.go | 15 +- arm/apimanagement/productsubscriptions.go | 3 +- arm/apimanagement/property.go | 15 +- arm/apimanagement/quotabycounterkeys.go | 6 +- arm/apimanagement/quotabyperiodkeys.go | 6 +- arm/apimanagement/regions.go | 3 +- arm/apimanagement/reports.go | 3 +- arm/apimanagement/subscriptions.go | 21 +- arm/apimanagement/tenantaccess.go | 12 +- arm/apimanagement/tenantaccessgit.go | 9 +- arm/apimanagement/tenantconfiguration.go | 9 +- .../tenantconfigurationsyncstate.go | 3 +- arm/apimanagement/usergroups.go | 3 +- arm/apimanagement/useridentities.go | 3 +- arm/apimanagement/users.go | 18 +- arm/apimanagement/usersubscriptions.go | 3 +- arm/apimanagement/version.go | 35 +- arm/authorization/classicadministrators.go | 9 +- arm/authorization/client.go | 7 +- arm/authorization/models.go | 2 +- arm/authorization/permissions.go | 30 +- ...tions.go => provideroperationsmetadata.go} | 74 +- arm/authorization/roleassignments.go | 81 +- arm/authorization/roledefinitions.go | 45 +- arm/authorization/version.go | 35 +- .../{accountoperations.go => account.go} | 233 +- ...pplicationoperations.go => application.go} | 142 +- ...ageoperations.go => applicationpackage.go} | 117 +- arm/batch/client.go | 10 +- arm/batch/location.go | 5 +- arm/batch/models.go | 54 +- arm/batch/version.go | 35 +- arm/cdn/client.go | 122 +- arm/cdn/customdomains.go | 168 +- arm/cdn/edgenodes.go | 29 +- arm/cdn/endpoints.go | 35 +- arm/cdn/models.go | 44 +- arm/cdn/origins.go | 11 +- arm/cdn/profiles.go | 26 +- arm/cdn/version.go | 35 +- arm/cognitiveservices/accounts.go | 27 +- arm/cognitiveservices/client.go | 5 - arm/cognitiveservices/models.go | 0 arm/cognitiveservices/version.go | 35 +- arm/compute/availabilitysets.go | 15 +- arm/compute/client.go | 5 - arm/compute/images.go | 15 +- arm/compute/models.go | 26 + arm/compute/usage.go | 3 +- arm/compute/version.go | 35 +- arm/compute/virtualmachineextensionimages.go | 9 +- arm/compute/virtualmachineextensions.go | 9 +- arm/compute/virtualmachineimages.go | 15 +- arm/compute/virtualmachines.go | 42 +- arm/compute/virtualmachinescalesets.go | 45 +- arm/compute/virtualmachinescalesetvms.go | 30 +- arm/compute/virtualmachinesizes.go | 3 +- arm/containerregistry/client.go | 5 - arm/containerregistry/models.go | 0 arm/containerregistry/registries.go | 27 +- arm/containerregistry/version.go | 35 +- arm/containerservice/client.go | 7 +- arm/containerservice/containerservices.go | 15 +- arm/containerservice/models.go | 0 arm/containerservice/version.go | 35 +- .../account/accountgroup.go | 20 +- arm/datalake-analytics/account/client.go | 7 +- .../account/datalakestoreaccounts.go | 14 +- .../account/firewallrules.go | 422 + arm/datalake-analytics/account/models.go | 100 +- .../account/storageaccounts.go | 26 +- arm/datalake-analytics/account/version.go | 35 +- arm/datalake-store/account/accountgroup.go | 21 +- arm/datalake-store/account/client.go | 5 - arm/datalake-store/account/firewallrules.go | 15 +- arm/datalake-store/account/models.go | 0 .../account/trustedidproviders.go | 15 +- arm/datalake-store/account/version.go | 35 +- arm/disk/client.go | 5 - arm/disk/disks.go | 24 +- arm/disk/models.go | 0 arm/disk/snapshots.go | 24 +- arm/disk/version.go | 35 +- arm/dns/client.go | 7 +- arm/dns/models.go | 30 +- arm/dns/recordsets.go | 98 +- arm/dns/version.go | 35 +- arm/dns/zones.go | 55 +- arm/documentdb/client.go | 5 - arm/documentdb/databaseaccounts.go | 36 +- arm/documentdb/models.go | 0 arm/documentdb/version.go | 35 +- arm/eventhub/client.go | 7 +- arm/eventhub/consumergroups.go | 152 +- arm/eventhub/eventhubs.go | 348 +- arm/eventhub/models.go | 267 +- arm/eventhub/namespaces.go | 525 +- arm/eventhub/operations.go | 120 + arm/eventhub/version.go | 35 +- arm/iothub/client.go | 5 - arm/iothub/models.go | 0 arm/iothub/resource.go | 57 +- arm/iothub/version.go | 35 +- arm/keyvault/client.go | 5 - arm/keyvault/models.go | 0 arm/keyvault/vaults.go | 15 +- arm/keyvault/version.go | 35 +- arm/logic/agreements.go | 771 + arm/logic/certificates.go | 344 + arm/logic/client.go | 88 +- arm/logic/integrationaccounts.go | 545 + arm/logic/maps.go | 339 + arm/logic/models.go | 1287 +- arm/logic/partners.go | 343 + arm/logic/schemas.go | 339 + arm/logic/sessions.go | 342 + arm/logic/version.go | 35 +- arm/logic/workflowrunactions.go | 8 +- arm/logic/workflowruns.go | 11 +- arm/logic/workflows.go | 32 +- arm/logic/workflowtriggerhistories.go | 8 +- arm/logic/workflowtriggers.go | 14 +- arm/logic/workflowversions.go | 8 +- arm/machinelearning/webservices/client.go | 5 - arm/machinelearning/webservices/models.go | 0 arm/machinelearning/webservices/version.go | 35 +- .../webservices/webservicesgroup.go | 21 +- arm/mediaservices/client.go | 5 - arm/mediaservices/mediaservice.go | 27 +- arm/mediaservices/models.go | 0 arm/mediaservices/version.go | 35 +- arm/mobileengagement/appcollections.go | 6 +- arm/mobileengagement/apps.go | 3 +- arm/mobileengagement/campaigns.go | 39 +- arm/mobileengagement/client.go | 5 - arm/mobileengagement/devices.go | 15 +- arm/mobileengagement/exporttasks.go | 36 +- arm/mobileengagement/importtasks.go | 9 +- arm/mobileengagement/models.go | 0 arm/mobileengagement/supportedplatforms.go | 3 +- arm/mobileengagement/version.go | 35 +- arm/notificationhubs/client.go | 7 +- arm/notificationhubs/models.go | 119 +- arm/notificationhubs/namespaces.go | 47 +- ...cationhubs.go => notificationhubsgroup.go} | 257 +- arm/notificationhubs/version.go | 35 +- arm/powerbiembedded/client.go | 8 +- arm/powerbiembedded/models.go | 0 arm/powerbiembedded/version.go | 35 +- arm/powerbiembedded/workspacecollections.go | 30 +- arm/powerbiembedded/workspaces.go | 3 +- arm/recoveryservices/client.go | 5 - arm/recoveryservices/models.go | 0 arm/recoveryservices/vaults.go | 12 +- arm/recoveryservices/version.go | 35 +- arm/redis/client.go | 7 +- arm/redis/firewallrule.go | 248 + arm/redis/firewallrules.go | 130 + arm/redis/models.go | 81 +- arm/redis/operations.go | 121 + arm/redis/patchschedules.go | 19 +- arm/redis/redisgroup.go | 50 +- arm/redis/version.go | 35 +- arm/resources/locks/client.go | 5 - arm/resources/locks/managementlocks.go | 45 +- arm/resources/locks/models.go | 0 arm/resources/locks/version.go | 35 +- arm/resources/policy/assignments.go | 27 +- arm/resources/policy/client.go | 5 - arm/resources/policy/definitions.go | 12 +- arm/resources/policy/models.go | 0 arm/resources/policy/version.go | 35 +- arm/resources/resources/client.go | 5 - .../resources/deploymentoperations.go | 6 +- arm/resources/resources/deployments.go | 28 +- arm/resources/resources/groups.go | 24 +- arm/resources/resources/models.go | 0 arm/resources/resources/providers.go | 12 +- arm/resources/resources/resourcesgroup.go | 30 +- arm/resources/resources/tags.go | 15 +- arm/resources/resources/version.go | 35 +- arm/scheduler/client.go | 5 - arm/scheduler/jobcollections.go | 24 +- arm/scheduler/jobs.go | 21 +- arm/scheduler/models.go | 0 arm/scheduler/version.go | 35 +- arm/search/adminkeys.go | 6 +- arm/search/client.go | 5 - arm/search/models.go | 0 arm/search/querykeys.go | 9 +- arm/search/services.go | 15 +- arm/search/version.go | 35 +- arm/servermanagement/client.go | 5 - arm/servermanagement/gateway.go | 27 +- arm/servermanagement/models.go | 0 arm/servermanagement/node.go | 18 +- arm/servermanagement/powershell.go | 21 +- arm/servermanagement/session.go | 9 +- arm/servermanagement/version.go | 35 +- arm/servicebus/client.go | 7 +- arm/servicebus/models.go | 150 +- arm/servicebus/namespaces.go | 335 +- arm/servicebus/operations.go | 120 + arm/servicebus/queues.go | 225 +- arm/servicebus/subscriptions.go | 98 +- arm/servicebus/topics.go | 224 +- arm/servicebus/version.go | 35 +- arm/sql/client.go | 68 +- arm/sql/databases.go | 228 +- arm/sql/elasticpools.go | 96 +- arm/sql/models.go | 759 +- arm/sql/recommendedelasticpools.go | 83 +- arm/sql/servers.go | 88 +- arm/sql/version.go | 35 +- arm/trafficmanager/client.go | 5 - arm/trafficmanager/endpoints.go | 12 +- arm/trafficmanager/models.go | 0 arm/trafficmanager/profiles.go | 21 +- arm/trafficmanager/version.go | 35 +- arm/web/apps.go | 16489 ++++++++++++++++ arm/web/appservicecertificateorders.go | 1433 ++ arm/web/appserviceenvironments.go | 3328 ++++ arm/web/appserviceplans.go | 2170 ++ arm/web/certificateorders.go | 1122 -- arm/web/certificates.go | 589 +- arm/web/classicmobileservices.go | 257 - arm/web/client.go | 818 +- arm/web/deletedwebapps.go | 221 + arm/web/domains.go | 907 +- arm/web/global.go | 1004 - arm/web/globalcertificateorder.go | 193 - arm/web/globaldomainregistration.go | 400 - arm/web/globalresourcegroups.go | 109 - arm/web/hostingenvironments.go | 2981 --- arm/web/managedhostingenvironments.go | 736 - arm/web/models.go | 2347 ++- arm/web/provider.go | 360 - arm/web/recommendations.go | 433 +- arm/web/serverfarms.go | 1403 -- arm/web/sites.go | 11239 ----------- arm/web/topleveldomains.go | 179 +- arm/web/usage.go | 111 - arm/web/version.go | 35 +- datalake-store/filesystem/client.go | 21 +- datalake-store/filesystem/filesystemgroup.go | 676 +- datalake-store/filesystem/models.go | 5 +- datalake-store/filesystem/version.go | 35 +- storage/README.md | 5 - storage/authorization.go | 223 - storage/authorization_test.go | 226 - storage/blob.go | 1539 -- storage/blob_test.go | 1599 -- storage/client.go | 469 - storage/client_test.go | 244 - storage/directory.go | 217 - storage/directory_test.go | 112 - storage/file.go | 360 - storage/file_test.go | 274 - storage/fileserviceclient.go | 360 - storage/queue.go | 346 - storage/queue_test.go | 142 - storage/share.go | 186 - storage/share_test.go | 188 - storage/storagepolicy.go | 47 - storage/table.go | 258 - storage/table_entities.go | 354 - storage/table_test.go | 338 - storage/util.go | 85 - storage/util_test.go | 86 - storage/version.go | 5 - 293 files changed, 38527 insertions(+), 33171 deletions(-) create mode 100644 .gitmodules mode change 100644 => 100755 arm/analysisservices/client.go mode change 100644 => 100755 arm/analysisservices/models.go mode change 100644 => 100755 arm/analysisservices/servers.go mode change 100644 => 100755 arm/analysisservices/version.go mode change 100644 => 100755 arm/apimanagement/apioperations.go mode change 100644 => 100755 arm/apimanagement/apiproducts.go mode change 100644 => 100755 arm/apimanagement/apis.go mode change 100644 => 100755 arm/apimanagement/authorizationservers.go mode change 100644 => 100755 arm/apimanagement/backends.go mode change 100644 => 100755 arm/apimanagement/certificates.go mode change 100644 => 100755 arm/apimanagement/client.go mode change 100644 => 100755 arm/apimanagement/groups.go mode change 100644 => 100755 arm/apimanagement/groupusers.go mode change 100644 => 100755 arm/apimanagement/identityproviders.go mode change 100644 => 100755 arm/apimanagement/loggers.go mode change 100644 => 100755 arm/apimanagement/models.go mode change 100644 => 100755 arm/apimanagement/openidconnectproviders.go mode change 100644 => 100755 arm/apimanagement/policysnippets.go mode change 100644 => 100755 arm/apimanagement/productapis.go mode change 100644 => 100755 arm/apimanagement/productgroups.go mode change 100644 => 100755 arm/apimanagement/products.go mode change 100644 => 100755 arm/apimanagement/productsubscriptions.go mode change 100644 => 100755 arm/apimanagement/property.go mode change 100644 => 100755 arm/apimanagement/quotabycounterkeys.go mode change 100644 => 100755 arm/apimanagement/quotabyperiodkeys.go mode change 100644 => 100755 arm/apimanagement/regions.go mode change 100644 => 100755 arm/apimanagement/reports.go mode change 100644 => 100755 arm/apimanagement/subscriptions.go mode change 100644 => 100755 arm/apimanagement/tenantaccess.go mode change 100644 => 100755 arm/apimanagement/tenantaccessgit.go mode change 100644 => 100755 arm/apimanagement/tenantconfiguration.go mode change 100644 => 100755 arm/apimanagement/tenantconfigurationsyncstate.go mode change 100644 => 100755 arm/apimanagement/usergroups.go mode change 100644 => 100755 arm/apimanagement/useridentities.go mode change 100644 => 100755 arm/apimanagement/users.go mode change 100644 => 100755 arm/apimanagement/usersubscriptions.go mode change 100644 => 100755 arm/apimanagement/version.go mode change 100644 => 100755 arm/authorization/classicadministrators.go mode change 100644 => 100755 arm/authorization/client.go mode change 100644 => 100755 arm/authorization/models.go mode change 100644 => 100755 arm/authorization/permissions.go rename arm/authorization/{provideroperationsmetadataoperations.go => provideroperationsmetadata.go} (58%) mode change 100644 => 100755 mode change 100644 => 100755 arm/authorization/roleassignments.go mode change 100644 => 100755 arm/authorization/roledefinitions.go mode change 100644 => 100755 arm/authorization/version.go rename arm/batch/{accountoperations.go => account.go} (67%) mode change 100644 => 100755 rename arm/batch/{applicationoperations.go => application.go} (70%) mode change 100644 => 100755 rename arm/batch/{applicationpackageoperations.go => applicationpackage.go} (71%) mode change 100644 => 100755 mode change 100644 => 100755 arm/batch/client.go mode change 100644 => 100755 arm/batch/location.go mode change 100644 => 100755 arm/batch/models.go mode change 100644 => 100755 arm/batch/version.go mode change 100644 => 100755 arm/cdn/client.go mode change 100644 => 100755 arm/cdn/customdomains.go mode change 100644 => 100755 arm/cdn/edgenodes.go mode change 100644 => 100755 arm/cdn/endpoints.go mode change 100644 => 100755 arm/cdn/models.go mode change 100644 => 100755 arm/cdn/origins.go mode change 100644 => 100755 arm/cdn/profiles.go mode change 100644 => 100755 arm/cdn/version.go mode change 100644 => 100755 arm/cognitiveservices/accounts.go mode change 100644 => 100755 arm/cognitiveservices/client.go mode change 100644 => 100755 arm/cognitiveservices/models.go mode change 100644 => 100755 arm/cognitiveservices/version.go mode change 100644 => 100755 arm/compute/availabilitysets.go mode change 100644 => 100755 arm/compute/client.go mode change 100644 => 100755 arm/compute/images.go mode change 100644 => 100755 arm/compute/models.go mode change 100644 => 100755 arm/compute/usage.go mode change 100644 => 100755 arm/compute/version.go mode change 100644 => 100755 arm/compute/virtualmachineextensionimages.go mode change 100644 => 100755 arm/compute/virtualmachineextensions.go mode change 100644 => 100755 arm/compute/virtualmachineimages.go mode change 100644 => 100755 arm/compute/virtualmachines.go mode change 100644 => 100755 arm/compute/virtualmachinescalesets.go mode change 100644 => 100755 arm/compute/virtualmachinescalesetvms.go mode change 100644 => 100755 arm/compute/virtualmachinesizes.go mode change 100644 => 100755 arm/containerregistry/client.go mode change 100644 => 100755 arm/containerregistry/models.go mode change 100644 => 100755 arm/containerregistry/registries.go mode change 100644 => 100755 arm/containerregistry/version.go mode change 100644 => 100755 arm/containerservice/client.go mode change 100644 => 100755 arm/containerservice/containerservices.go mode change 100644 => 100755 arm/containerservice/models.go mode change 100644 => 100755 arm/containerservice/version.go mode change 100644 => 100755 arm/datalake-analytics/account/accountgroup.go mode change 100644 => 100755 arm/datalake-analytics/account/client.go mode change 100644 => 100755 arm/datalake-analytics/account/datalakestoreaccounts.go create mode 100755 arm/datalake-analytics/account/firewallrules.go mode change 100644 => 100755 arm/datalake-analytics/account/models.go mode change 100644 => 100755 arm/datalake-analytics/account/storageaccounts.go mode change 100644 => 100755 arm/datalake-analytics/account/version.go mode change 100644 => 100755 arm/datalake-store/account/accountgroup.go mode change 100644 => 100755 arm/datalake-store/account/client.go mode change 100644 => 100755 arm/datalake-store/account/firewallrules.go mode change 100644 => 100755 arm/datalake-store/account/models.go mode change 100644 => 100755 arm/datalake-store/account/trustedidproviders.go mode change 100644 => 100755 arm/datalake-store/account/version.go mode change 100644 => 100755 arm/disk/client.go mode change 100644 => 100755 arm/disk/disks.go mode change 100644 => 100755 arm/disk/models.go mode change 100644 => 100755 arm/disk/snapshots.go mode change 100644 => 100755 arm/disk/version.go mode change 100644 => 100755 arm/dns/client.go mode change 100644 => 100755 arm/dns/models.go mode change 100644 => 100755 arm/dns/recordsets.go mode change 100644 => 100755 arm/dns/version.go mode change 100644 => 100755 arm/dns/zones.go mode change 100644 => 100755 arm/documentdb/client.go mode change 100644 => 100755 arm/documentdb/databaseaccounts.go mode change 100644 => 100755 arm/documentdb/models.go mode change 100644 => 100755 arm/documentdb/version.go mode change 100644 => 100755 arm/eventhub/client.go mode change 100644 => 100755 arm/eventhub/consumergroups.go mode change 100644 => 100755 arm/eventhub/eventhubs.go mode change 100644 => 100755 arm/eventhub/models.go mode change 100644 => 100755 arm/eventhub/namespaces.go create mode 100755 arm/eventhub/operations.go mode change 100644 => 100755 arm/eventhub/version.go mode change 100644 => 100755 arm/iothub/client.go mode change 100644 => 100755 arm/iothub/models.go mode change 100644 => 100755 arm/iothub/resource.go mode change 100644 => 100755 arm/iothub/version.go mode change 100644 => 100755 arm/keyvault/client.go mode change 100644 => 100755 arm/keyvault/models.go mode change 100644 => 100755 arm/keyvault/vaults.go mode change 100644 => 100755 arm/keyvault/version.go create mode 100755 arm/logic/agreements.go create mode 100755 arm/logic/certificates.go mode change 100644 => 100755 arm/logic/client.go create mode 100755 arm/logic/integrationaccounts.go create mode 100755 arm/logic/maps.go mode change 100644 => 100755 arm/logic/models.go create mode 100755 arm/logic/partners.go create mode 100755 arm/logic/schemas.go create mode 100755 arm/logic/sessions.go mode change 100644 => 100755 arm/logic/version.go mode change 100644 => 100755 arm/logic/workflowrunactions.go mode change 100644 => 100755 arm/logic/workflowruns.go mode change 100644 => 100755 arm/logic/workflows.go mode change 100644 => 100755 arm/logic/workflowtriggerhistories.go mode change 100644 => 100755 arm/logic/workflowtriggers.go mode change 100644 => 100755 arm/logic/workflowversions.go mode change 100644 => 100755 arm/machinelearning/webservices/client.go mode change 100644 => 100755 arm/machinelearning/webservices/models.go mode change 100644 => 100755 arm/machinelearning/webservices/version.go mode change 100644 => 100755 arm/machinelearning/webservices/webservicesgroup.go mode change 100644 => 100755 arm/mediaservices/client.go mode change 100644 => 100755 arm/mediaservices/mediaservice.go mode change 100644 => 100755 arm/mediaservices/models.go mode change 100644 => 100755 arm/mediaservices/version.go mode change 100644 => 100755 arm/mobileengagement/appcollections.go mode change 100644 => 100755 arm/mobileengagement/apps.go mode change 100644 => 100755 arm/mobileengagement/campaigns.go mode change 100644 => 100755 arm/mobileengagement/client.go mode change 100644 => 100755 arm/mobileengagement/devices.go mode change 100644 => 100755 arm/mobileengagement/exporttasks.go mode change 100644 => 100755 arm/mobileengagement/importtasks.go mode change 100644 => 100755 arm/mobileengagement/models.go mode change 100644 => 100755 arm/mobileengagement/supportedplatforms.go mode change 100644 => 100755 arm/mobileengagement/version.go mode change 100644 => 100755 arm/notificationhubs/client.go mode change 100644 => 100755 arm/notificationhubs/models.go mode change 100644 => 100755 arm/notificationhubs/namespaces.go rename arm/notificationhubs/{notificationhubs.go => notificationhubsgroup.go} (70%) mode change 100644 => 100755 mode change 100644 => 100755 arm/notificationhubs/version.go mode change 100644 => 100755 arm/powerbiembedded/client.go mode change 100644 => 100755 arm/powerbiembedded/models.go mode change 100644 => 100755 arm/powerbiembedded/version.go mode change 100644 => 100755 arm/powerbiembedded/workspacecollections.go mode change 100644 => 100755 arm/powerbiembedded/workspaces.go mode change 100644 => 100755 arm/recoveryservices/client.go mode change 100644 => 100755 arm/recoveryservices/models.go mode change 100644 => 100755 arm/recoveryservices/vaults.go mode change 100644 => 100755 arm/recoveryservices/version.go mode change 100644 => 100755 arm/redis/client.go create mode 100755 arm/redis/firewallrule.go create mode 100755 arm/redis/firewallrules.go mode change 100644 => 100755 arm/redis/models.go create mode 100755 arm/redis/operations.go mode change 100644 => 100755 arm/redis/patchschedules.go mode change 100644 => 100755 arm/redis/redisgroup.go mode change 100644 => 100755 arm/redis/version.go mode change 100644 => 100755 arm/resources/locks/client.go mode change 100644 => 100755 arm/resources/locks/managementlocks.go mode change 100644 => 100755 arm/resources/locks/models.go mode change 100644 => 100755 arm/resources/locks/version.go mode change 100644 => 100755 arm/resources/policy/assignments.go mode change 100644 => 100755 arm/resources/policy/client.go mode change 100644 => 100755 arm/resources/policy/definitions.go mode change 100644 => 100755 arm/resources/policy/models.go mode change 100644 => 100755 arm/resources/policy/version.go mode change 100644 => 100755 arm/resources/resources/client.go mode change 100644 => 100755 arm/resources/resources/deploymentoperations.go mode change 100644 => 100755 arm/resources/resources/deployments.go mode change 100644 => 100755 arm/resources/resources/groups.go mode change 100644 => 100755 arm/resources/resources/models.go mode change 100644 => 100755 arm/resources/resources/providers.go mode change 100644 => 100755 arm/resources/resources/resourcesgroup.go mode change 100644 => 100755 arm/resources/resources/tags.go mode change 100644 => 100755 arm/resources/resources/version.go mode change 100644 => 100755 arm/scheduler/client.go mode change 100644 => 100755 arm/scheduler/jobcollections.go mode change 100644 => 100755 arm/scheduler/jobs.go mode change 100644 => 100755 arm/scheduler/models.go mode change 100644 => 100755 arm/scheduler/version.go mode change 100644 => 100755 arm/search/adminkeys.go mode change 100644 => 100755 arm/search/client.go mode change 100644 => 100755 arm/search/models.go mode change 100644 => 100755 arm/search/querykeys.go mode change 100644 => 100755 arm/search/services.go mode change 100644 => 100755 arm/search/version.go mode change 100644 => 100755 arm/servermanagement/client.go mode change 100644 => 100755 arm/servermanagement/gateway.go mode change 100644 => 100755 arm/servermanagement/models.go mode change 100644 => 100755 arm/servermanagement/node.go mode change 100644 => 100755 arm/servermanagement/powershell.go mode change 100644 => 100755 arm/servermanagement/session.go mode change 100644 => 100755 arm/servermanagement/version.go mode change 100644 => 100755 arm/servicebus/client.go mode change 100644 => 100755 arm/servicebus/models.go mode change 100644 => 100755 arm/servicebus/namespaces.go create mode 100755 arm/servicebus/operations.go mode change 100644 => 100755 arm/servicebus/queues.go mode change 100644 => 100755 arm/servicebus/subscriptions.go mode change 100644 => 100755 arm/servicebus/topics.go mode change 100644 => 100755 arm/servicebus/version.go mode change 100644 => 100755 arm/sql/client.go mode change 100644 => 100755 arm/sql/databases.go mode change 100644 => 100755 arm/sql/elasticpools.go mode change 100644 => 100755 arm/sql/models.go mode change 100644 => 100755 arm/sql/recommendedelasticpools.go mode change 100644 => 100755 arm/sql/servers.go mode change 100644 => 100755 arm/sql/version.go mode change 100644 => 100755 arm/trafficmanager/client.go mode change 100644 => 100755 arm/trafficmanager/endpoints.go mode change 100644 => 100755 arm/trafficmanager/models.go mode change 100644 => 100755 arm/trafficmanager/profiles.go mode change 100644 => 100755 arm/trafficmanager/version.go create mode 100755 arm/web/apps.go create mode 100755 arm/web/appservicecertificateorders.go create mode 100755 arm/web/appserviceenvironments.go create mode 100755 arm/web/appserviceplans.go delete mode 100644 arm/web/certificateorders.go mode change 100644 => 100755 arm/web/certificates.go delete mode 100644 arm/web/classicmobileservices.go mode change 100644 => 100755 arm/web/client.go create mode 100755 arm/web/deletedwebapps.go mode change 100644 => 100755 arm/web/domains.go delete mode 100644 arm/web/global.go delete mode 100644 arm/web/globalcertificateorder.go delete mode 100644 arm/web/globaldomainregistration.go delete mode 100644 arm/web/globalresourcegroups.go delete mode 100644 arm/web/hostingenvironments.go delete mode 100644 arm/web/managedhostingenvironments.go mode change 100644 => 100755 arm/web/models.go delete mode 100644 arm/web/provider.go mode change 100644 => 100755 arm/web/recommendations.go delete mode 100644 arm/web/serverfarms.go delete mode 100644 arm/web/sites.go mode change 100644 => 100755 arm/web/topleveldomains.go delete mode 100644 arm/web/usage.go mode change 100644 => 100755 arm/web/version.go mode change 100644 => 100755 datalake-store/filesystem/client.go mode change 100644 => 100755 datalake-store/filesystem/filesystemgroup.go mode change 100644 => 100755 datalake-store/filesystem/models.go mode change 100644 => 100755 datalake-store/filesystem/version.go delete mode 100644 storage/README.md delete mode 100644 storage/authorization.go delete mode 100644 storage/authorization_test.go delete mode 100644 storage/blob.go delete mode 100644 storage/blob_test.go delete mode 100644 storage/client.go delete mode 100644 storage/client_test.go delete mode 100644 storage/directory.go delete mode 100644 storage/directory_test.go delete mode 100644 storage/file.go delete mode 100644 storage/file_test.go delete mode 100644 storage/fileserviceclient.go delete mode 100644 storage/queue.go delete mode 100644 storage/queue_test.go delete mode 100644 storage/share.go delete mode 100644 storage/share_test.go delete mode 100644 storage/storagepolicy.go delete mode 100644 storage/table.go delete mode 100644 storage/table_entities.go delete mode 100644 storage/table_test.go delete mode 100644 storage/util.go delete mode 100644 storage/util_test.go delete mode 100644 storage/version.go diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 000000000000..2bfaa0ebb403 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,4 @@ +[submodule "storage"] + path = storage + url = https://github.com/Azure/azure-storage-go + branch = v0.1.0 diff --git a/.travis.yml b/.travis.yml index 231bfb3462b1..3cbdbc977350 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,7 +2,9 @@ sudo: false language: go -go: 1.7 +go: + - 1.7 + - 1.8 install: - go get -u github.com/golang/lint/golint @@ -16,14 +18,10 @@ script: - bash rungas.sh - test -z "$(gofmt -s -l $(find ./arm/* -type d -print) | tee /dev/stderr)" - test -z "$(gofmt -s -l -w management | tee /dev/stderr)" - - test -z "$(gofmt -s -l -w storage | tee /dev/stderr)" - test -z "$(gofmt -s -l -w Gododir | tee /dev/stderr)" - test -z "$(go build $(find ./* -type d -print | grep -v '^./vendor$') | tee /dev/stderr)" - test -z "$(go vet $(find ./arm/* -type d -print) | tee /dev/stderr)" - test -z "$(golint ./arm/... | tee /dev/stderr)" - - go test -v ./storage/... -check.v - - test -z "$(golint ./storage/... | tee /dev/stderr)" - - go vet ./storage/... - go test -v ./management/... - test -z "$(golint ./management/... | grep -v 'should have comment' | grep -v 'stutters' | tee /dev/stderr)" - go vet ./management/... diff --git a/Gododir/gen.go b/Gododir/gen.go index f92e77f2466f..6990afebf5e2 100644 --- a/Gododir/gen.go +++ b/Gododir/gen.go @@ -59,31 +59,31 @@ var ( Version: "2016-07-07", Input: "apimanagement", }, - // { - // Name: "authorization", - // Version: "2015-07-01", - // }, - // { - // Name: "batch", - // Version: "2017-01-01", - // Swagger: "BatchManagement", - // }, + { + Name: "authorization", + Version: "2015-07-01", + }, + { + Name: "batch", + Version: "2017-01-01", + Swagger: "BatchManagement", + }, { Name: "billing", Version: "2017-02-27-preview", }, - // { - // Name: "cdn", - // Version: "2016-10-02", - // }, + { + Name: "cdn", + Version: "2016-10-02", + }, { Name: "cognitiveservices", Version: "2016-02-01-preview", }, - // { - // Name: "commerce", - // Version: "2015-06-01-preview", - // }, + { + Name: "commerce", + Version: "2015-06-01-preview", + }, { Name: "compute", Version: "2016-04-30-preview", @@ -120,30 +120,30 @@ var ( }, }, }, - // { - // Name: "devtestlabs", - // Version: "2016-05-15", - // Swagger: "DTL", - // }, + { + Name: "devtestlabs", + Version: "2016-05-15", + Swagger: "DTL", + }, { Name: "disk", Version: "2016-04-30-preview", Swagger: "disk", Input: "compute", }, - // { - // Name: "dns", - // Version: "2016-04-01", - // }, + { + Name: "dns", + Version: "2016-04-01", + }, { Name: "documentdb", Version: "2015-04-08", }, - // { - // Name: "eventhub", - // Version: "2015-08-01", - // Swagger: "EventHub", - // }, + { + Name: "eventhub", + Version: "2015-08-01", + Swagger: "EventHub", + }, { Name: "graphrbac", Version: "1.6", @@ -165,11 +165,11 @@ var ( Name: "keyvault", Version: "2015-06-01", }, - // { - // Name: "logic", - // Version: "2016-06-01", - // // composite swagger - // }, + { + Name: "logic", + Version: "2016-06-01", + // composite swagger + }, { Name: "machinelearning", SubServices: []service{ @@ -206,10 +206,10 @@ var ( Swagger: "networkWatcher", Input: "network", }, - // { - // Name: "notificationhubs", - // Version: "2016-03-01", - // }, + { + Name: "notificationhubs", + Version: "2016-03-01", + }, { Name: "operationalinsights", Version: "2015-11-01-preview", @@ -228,17 +228,17 @@ var ( // Version: "2016-06-01", // // composite swagger // }, - // { - // Name: "redis", - // Version: "2016-04-01", - // }, + { + Name: "redis", + Version: "2016-04-01", + }, { Name: "resources", SubServices: []service{ - // { - // Name: "features", - // Version: "2015-12-01", - // }, + { + Name: "features", + Version: "2015-12-01", + }, { Name: "links", Version: "2016-09-01", @@ -255,10 +255,10 @@ var ( Name: "resources", Version: "2016-09-01", }, - // { - // Name: "subscriptions", - // Version: "2016-06-01", - // }, + { + Name: "subscriptions", + Version: "2016-06-01", + }, }, }, { @@ -273,10 +273,10 @@ var ( Name: "servermanagement", Version: "2016-07-01-preview", }, - // { - // Name: "servicebus", - // Version: "2015-08-01", - // }, + { + Name: "servicebus", + Version: "2015-08-01", + }, { Name: "service-map", Version: "2015-11-01-preview", @@ -287,14 +287,14 @@ var ( // Version: "2014-04-01", // Swagger: "sql.core", // }, - // { - // Name: "storage", - // Version: "2016-12-01", - // }, - // { - // Name: "storageimportexport", - // Version: "2016-11-01", - // }, + { + Name: "storage", + Version: "2016-12-01", + }, + { + Name: "storageimportexport", + Version: "2016-11-01", + }, { Name: "trafficmanager", Version: "2015-11-01", @@ -307,9 +307,47 @@ var ( }, }, }, + //{ + // Plane: "dataplane", + // InputPrefix: "", + // Services: []service{ + // { + // Name: "batch", + // Version: "2016-07-01.3.1", + // Swagger: "BatchService", + // }, + // { + // Name: "insights", + // // composite swagger + // }, + // { + // Name: "keyvault", + // Version: "2015-06-01", + // }, + // { + // Name: "search", + // SubServices: []service{ + // { + // Name: "searchindex", + // Version: "2015-02-28", + // Input: "search", + // }, + // { + // Name: "searchservice", + // Version: "2015-02-28", + // Input: "search", + // }, + // }, + // }, + // { + // Name: "servicefabric", + // Version: "2016-01-28", + // }, + // }, + //}, { - Plane: "dataplane", - InputPrefix: "", + Plane: "", + InputPrefix: "arm-", Services: []service{ // { // Name: "batch", @@ -337,6 +375,16 @@ var ( // Version: "2015-02-28", // Input: "search", // }, + // { + // Name: "datalake-analytics", + // SubServices: []service{ + // { + // Name: "catalog", + // Version: "2016-11-01", + // }, + // { + // Name: "job", + // Version: "2016-11-01", // }, // }, // { @@ -393,14 +441,14 @@ func initAndAddService(service *service, inputPrefix, plane string) { } packages := append(service.Packages, service.Name) service.TaskName = fmt.Sprintf("%s>%s", plane, strings.Join(packages, ">")) - service.Fullname = fmt.Sprintf("%s/%s", plane, strings.Join(packages, "/")) + service.Fullname = filepath.Join(plane, strings.Join(packages, "/")) if service.Input == "" { - service.Input = fmt.Sprintf("%s%s/%s/swagger/%s", inputPrefix, strings.Join(packages, "/"), service.Version, service.Swagger) + service.Input = filepath.Join(inputPrefix+strings.Join(packages, "/"), service.Version, "swagger", service.Swagger) } else { - service.Input = fmt.Sprintf("%s%s/%s/swagger/%s", inputPrefix, service.Input, service.Version, service.Swagger) + service.Input = filepath.Join(inputPrefix+service.Input, service.Version, "swagger", service.Swagger) } - service.Namespace = fmt.Sprintf("github.com/Azure/azure-sdk-for-go/%s", service.Fullname) - service.Output = fmt.Sprintf("%s/src/%s", gopath, service.Namespace) + service.Namespace = filepath.Join("github.com", "Azure", "azure-sdk-for-go", service.Fullname) + service.Output = filepath.Join(gopath, "src", service.Namespace) if service.SubServices != nil { for _, subs := range service.SubServices { @@ -415,7 +463,7 @@ func initAndAddService(service *service, inputPrefix, plane string) { } func tasks(p *do.Project) { - p.Task("default", do.S{"setvars", "generate:all", "storage"}, nil) + p.Task("default", do.S{"setvars", "generate:all", "management"}, nil) p.Task("setvars", nil, setVars) p.Use("generate", generateTasks) p.Use("gofmt", formatTasks) @@ -423,7 +471,7 @@ func tasks(p *do.Project) { p.Use("golint", lintTasks) p.Use("govet", vetTasks) p.Use("delete", deleteTasks) - p.Task("storage", do.S{"setvars"}, storageVersion) + p.Task("management", do.S{"setvars"}, managementVersion) } func setVars(c *do.Context) { @@ -459,8 +507,7 @@ func generate(service *service) { "-OutputDirectory", service.Output, "-Modeler", "Swagger", "-pv", sdkVersion, - "-SkipValidation", - ) + "-SkipValidation") autorest.Dir = filepath.Join(autorestDir, "autorest") err = runner(autorest) if err != nil { @@ -517,7 +564,7 @@ func lintTasks(p *do.Project) { func lint(service *service) { fmt.Printf("Linting %s...\n\n", service.Fullname) - golint := exec.Command(fmt.Sprintf("%s/bin/golint", gopath), service.Namespace) + golint := exec.Command(filepath.Join(gopath, "bin", "golint"), service.Namespace) err := runner(golint) if err != nil { panic(fmt.Errorf("golint error: %s", err)) @@ -537,8 +584,12 @@ func vet(service *service) { } } -func storageVersion(c *do.Context) { - versionFile := "storage/version.go" +func managementVersion(c *do.Context) { + version("management") +} + +func version(packageName string) { + versionFile := filepath.Join(packageName, "version.go") os.Remove(versionFile) template := `package storage diff --git a/arm/analysisservices/client.go b/arm/analysisservices/client.go old mode 100644 new mode 100755 index d15876d0bcb5..22fc2bd29a55 --- a/arm/analysisservices/client.go +++ b/arm/analysisservices/client.go @@ -29,9 +29,6 @@ import ( ) const ( - // APIVersion is the version of the Analysisservices - APIVersion = "2016-05-16" - // DefaultBaseURI is the default URI used for the service Analysisservices DefaultBaseURI = "https://management.azure.com" ) @@ -40,7 +37,6 @@ const ( type ManagementClient struct { autorest.Client BaseURI string - APIVersion string SubscriptionID string } @@ -54,7 +50,6 @@ func NewWithBaseURI(baseURI string, subscriptionID string) ManagementClient { return ManagementClient{ Client: autorest.NewClientWithUserAgent(UserAgent()), BaseURI: baseURI, - APIVersion: APIVersion, SubscriptionID: subscriptionID, } } diff --git a/arm/analysisservices/models.go b/arm/analysisservices/models.go old mode 100644 new mode 100755 index 34694b53647e..1ca5d54a5073 --- a/arm/analysisservices/models.go +++ b/arm/analysisservices/models.go @@ -106,6 +106,13 @@ const ( StateUpdating State = "Updating" ) +// BackupConfiguration is an object that represents backup configurations +type BackupConfiguration struct { + StorageAccount *string `json:"storageAccount,omitempty"` + BlobContainer *string `json:"blobContainer,omitempty"` + AccessKey *string `json:"accessKey,omitempty"` +} + // Resource is represents an instance of an Analysis Services resource. type Resource struct { ID *string `json:"id,omitempty"` @@ -143,15 +150,17 @@ type ServerAdministrators struct { // ServerMutableProperties is an object that represents a set of mutable // Analysis Services resource properties. type ServerMutableProperties struct { - AsAdministrators *ServerAdministrators `json:"asAdministrators,omitempty"` + AsAdministrators *ServerAdministrators `json:"asAdministrators,omitempty"` + BackupConfiguration *BackupConfiguration `json:"backupConfiguration,omitempty"` } // ServerProperties is properties of Analysis Services resource. type ServerProperties struct { - AsAdministrators *ServerAdministrators `json:"asAdministrators,omitempty"` - State State `json:"state,omitempty"` - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` - ServerFullName *string `json:"serverFullName,omitempty"` + AsAdministrators *ServerAdministrators `json:"asAdministrators,omitempty"` + BackupConfiguration *BackupConfiguration `json:"backupConfiguration,omitempty"` + State State `json:"state,omitempty"` + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + ServerFullName *string `json:"serverFullName,omitempty"` } // Servers is an array of Analysis Services resources. diff --git a/arm/analysisservices/servers.go b/arm/analysisservices/servers.go old mode 100644 new mode 100755 index e425b9857df0..bbf334407f54 --- a/arm/analysisservices/servers.go +++ b/arm/analysisservices/servers.go @@ -93,8 +93,9 @@ func (client ServersClient) CreatePreparer(resourceGroupName string, serverName "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-05-16" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -176,8 +177,9 @@ func (client ServersClient) DeletePreparer(resourceGroupName string, serverName "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-05-16" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -254,8 +256,9 @@ func (client ServersClient) GetDetailsPreparer(resourceGroupName string, serverN "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-05-16" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -312,8 +315,9 @@ func (client ServersClient) ListPreparer() (*http.Request, error) { "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-05-16" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -384,8 +388,9 @@ func (client ServersClient) ListByResourceGroupPreparer(resourceGroupName string "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-05-16" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -464,8 +469,9 @@ func (client ServersClient) ResumePreparer(resourceGroupName string, serverName "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-05-16" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -545,8 +551,9 @@ func (client ServersClient) SuspendPreparer(resourceGroupName string, serverName "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-05-16" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -625,8 +632,9 @@ func (client ServersClient) UpdatePreparer(resourceGroupName string, serverName "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-05-16" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( diff --git a/arm/analysisservices/version.go b/arm/analysisservices/version.go old mode 100644 new mode 100755 index d5feba932888..35700bbec833 --- a/arm/analysisservices/version.go +++ b/arm/analysisservices/version.go @@ -18,43 +18,12 @@ package analysisservices // Changes may cause incorrect behavior and will be lost if the code is // regenerated. -import ( - "bytes" - "fmt" - "strings" -) - -const ( - major = "8" - minor = "1" - patch = "0" - tag = "beta" - userAgentFormat = "Azure-SDK-For-Go/%s arm-%s/%s" -) - -// cached results of UserAgent and Version to prevent repeated operations. -var ( - userAgent string - version string -) - // UserAgent returns the UserAgent string to use when sending http.Requests. func UserAgent() string { - if userAgent == "" { - userAgent = fmt.Sprintf(userAgentFormat, Version(), "analysisservices", "2016-05-16") - } - return userAgent + return "Azure-SDK-For-Go/v9.0.0-beta arm-analysisservices/2016-05-16" } // Version returns the semantic version (see http://semver.org) of the client. func Version() string { - if version == "" { - versionBuilder := bytes.NewBufferString(fmt.Sprintf("%s.%s.%s", major, minor, patch)) - if tag != "" { - versionBuilder.WriteRune('-') - versionBuilder.WriteString(strings.TrimPrefix(tag, "-")) - } - version = string(versionBuilder.Bytes()) - } - return version + return "v9.0.0-beta" } diff --git a/arm/apimanagement/apioperations.go b/arm/apimanagement/apioperations.go old mode 100644 new mode 100755 index b8b1ef15170b..7f3a331ac32e --- a/arm/apimanagement/apioperations.go +++ b/arm/apimanagement/apioperations.go @@ -109,8 +109,9 @@ func (client APIOperationsClient) CreateOrUpdatePreparer(resourceGroupName strin "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-07-07" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -196,8 +197,9 @@ func (client APIOperationsClient) DeletePreparer(resourceGroupName string, servi "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-07-07" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -280,8 +282,9 @@ func (client APIOperationsClient) GetPreparer(resourceGroupName string, serviceN "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-07-07" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -370,8 +373,9 @@ func (client APIOperationsClient) ListByAPIPreparer(resourceGroupName string, se "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-07-07" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } if len(filter) > 0 { queryParameters["$filter"] = autorest.Encode("query", filter) @@ -490,8 +494,9 @@ func (client APIOperationsClient) UpdatePreparer(resourceGroupName string, servi "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-07-07" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( diff --git a/arm/apimanagement/apiproducts.go b/arm/apimanagement/apiproducts.go old mode 100644 new mode 100755 index 22d51b2b4be8..c6318aa041bd --- a/arm/apimanagement/apiproducts.go +++ b/arm/apimanagement/apiproducts.go @@ -100,8 +100,9 @@ func (client APIProductsClient) ListByAPIPreparer(resourceGroupName string, serv "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-07-07" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } if len(filter) > 0 { queryParameters["$filter"] = autorest.Encode("query", filter) diff --git a/arm/apimanagement/apis.go b/arm/apimanagement/apis.go old mode 100644 new mode 100755 index 0878ec68fb19..9b6e8e66d425 --- a/arm/apimanagement/apis.go +++ b/arm/apimanagement/apis.go @@ -106,8 +106,9 @@ func (client ApisClient) CreateOrUpdatePreparer(resourceGroupName string, servic "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-07-07" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -190,8 +191,9 @@ func (client ApisClient) DeletePreparer(resourceGroupName string, serviceName st "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-07-07" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -267,8 +269,9 @@ func (client ApisClient) ExportPreparer(resourceGroupName string, serviceName st "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-07-07" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -344,8 +347,9 @@ func (client ApisClient) GetPreparer(resourceGroupName string, serviceName strin "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-07-07" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -429,8 +433,9 @@ func (client ApisClient) ListByServicePreparer(resourceGroupName string, service "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-07-07" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } if len(filter) > 0 { queryParameters["$filter"] = autorest.Encode("query", filter) @@ -542,8 +547,9 @@ func (client ApisClient) UpdatePreparer(resourceGroupName string, serviceName st "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-07-07" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( diff --git a/arm/apimanagement/authorizationservers.go b/arm/apimanagement/authorizationservers.go old mode 100644 new mode 100755 index 527b3425a0fc..32051c488f15 --- a/arm/apimanagement/authorizationservers.go +++ b/arm/apimanagement/authorizationservers.go @@ -99,8 +99,9 @@ func (client AuthorizationServersClient) CreateOrUpdatePreparer(resourceGroupNam "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-07-07" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -175,8 +176,9 @@ func (client AuthorizationServersClient) DeletePreparer(resourceGroupName string "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-07-07" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -252,8 +254,9 @@ func (client AuthorizationServersClient) GetPreparer(resourceGroupName string, s "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-07-07" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -337,8 +340,9 @@ func (client AuthorizationServersClient) ListByServicePreparer(resourceGroupName "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-07-07" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } if len(filter) > 0 { queryParameters["$filter"] = autorest.Encode("query", filter) @@ -447,8 +451,9 @@ func (client AuthorizationServersClient) UpdatePreparer(resourceGroupName string "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-07-07" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( diff --git a/arm/apimanagement/backends.go b/arm/apimanagement/backends.go old mode 100644 new mode 100755 index 6cca9b417b87..e66fa3a9d4e2 --- a/arm/apimanagement/backends.go +++ b/arm/apimanagement/backends.go @@ -95,8 +95,9 @@ func (client BackendsClient) CreateOrUpdatePreparer(resourceGroupName string, se "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-07-07" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -175,8 +176,9 @@ func (client BackendsClient) DeletePreparer(resourceGroupName string, serviceNam "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-07-07" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -252,8 +254,9 @@ func (client BackendsClient) GetPreparer(resourceGroupName string, serviceName s "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-07-07" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -337,8 +340,9 @@ func (client BackendsClient) ListByServicePreparer(resourceGroupName string, ser "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-07-07" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } if len(filter) > 0 { queryParameters["$filter"] = autorest.Encode("query", filter) @@ -450,8 +454,9 @@ func (client BackendsClient) UpdatePreparer(resourceGroupName string, serviceNam "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-07-07" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( diff --git a/arm/apimanagement/certificates.go b/arm/apimanagement/certificates.go old mode 100644 new mode 100755 index f0cdcdfcd85a..a83453fd0b28 --- a/arm/apimanagement/certificates.go +++ b/arm/apimanagement/certificates.go @@ -96,8 +96,9 @@ func (client CertificatesClient) CreateOrUpdatePreparer(resourceGroupName string "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-07-07" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -176,8 +177,9 @@ func (client CertificatesClient) DeletePreparer(resourceGroupName string, servic "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-07-07" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -249,8 +251,9 @@ func (client CertificatesClient) GetPreparer(resourceGroupName string, serviceNa "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-07-07" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -337,8 +340,9 @@ func (client CertificatesClient) ListByServicePreparer(resourceGroupName string, "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-07-07" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } if len(filter) > 0 { queryParameters["$filter"] = autorest.Encode("query", filter) diff --git a/arm/apimanagement/client.go b/arm/apimanagement/client.go old mode 100644 new mode 100755 index a6ea7657a22a..728f48377a20 --- a/arm/apimanagement/client.go +++ b/arm/apimanagement/client.go @@ -28,9 +28,6 @@ import ( ) const ( - // APIVersion is the version of the Apimanagement - APIVersion = "2016-07-07" - // DefaultBaseURI is the default URI used for the service Apimanagement DefaultBaseURI = "https://management.azure.com" ) @@ -39,7 +36,6 @@ const ( type ManagementClient struct { autorest.Client BaseURI string - APIVersion string SubscriptionID string } @@ -53,7 +49,6 @@ func NewWithBaseURI(baseURI string, subscriptionID string) ManagementClient { return ManagementClient{ Client: autorest.NewClientWithUserAgent(UserAgent()), BaseURI: baseURI, - APIVersion: APIVersion, SubscriptionID: subscriptionID, } } diff --git a/arm/apimanagement/groups.go b/arm/apimanagement/groups.go old mode 100644 new mode 100755 index fcc9d7a23c59..c9da154422d3 --- a/arm/apimanagement/groups.go +++ b/arm/apimanagement/groups.go @@ -94,8 +94,9 @@ func (client GroupsClient) CreateOrUpdatePreparer(resourceGroupName string, serv "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-07-07" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -174,8 +175,9 @@ func (client GroupsClient) DeletePreparer(resourceGroupName string, serviceName "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-07-07" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -252,8 +254,9 @@ func (client GroupsClient) GetPreparer(resourceGroupName string, serviceName str "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-07-07" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -340,8 +343,9 @@ func (client GroupsClient) ListByServicePreparer(resourceGroupName string, servi "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-07-07" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } if len(filter) > 0 { queryParameters["$filter"] = autorest.Encode("query", filter) @@ -453,8 +457,9 @@ func (client GroupsClient) UpdatePreparer(resourceGroupName string, serviceName "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-07-07" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( diff --git a/arm/apimanagement/groupusers.go b/arm/apimanagement/groupusers.go old mode 100644 new mode 100755 index 0c3f518d3283..76b70c371356 --- a/arm/apimanagement/groupusers.go +++ b/arm/apimanagement/groupusers.go @@ -95,8 +95,9 @@ func (client GroupUsersClient) AddPreparer(resourceGroupName string, serviceName "uid": autorest.Encode("path", uid), } + const APIVersion = "2016-07-07" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -196,8 +197,9 @@ func (client GroupUsersClient) ListByGroupPreparer(resourceGroupName string, ser "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-07-07" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } if len(filter) > 0 { queryParameters["$filter"] = autorest.Encode("query", filter) @@ -312,8 +314,9 @@ func (client GroupUsersClient) RemovePreparer(resourceGroupName string, serviceN "uid": autorest.Encode("path", uid), } + const APIVersion = "2016-07-07" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( diff --git a/arm/apimanagement/identityproviders.go b/arm/apimanagement/identityproviders.go old mode 100644 new mode 100755 index 7b9c633a41b2..b5e2baf2d581 --- a/arm/apimanagement/identityproviders.go +++ b/arm/apimanagement/identityproviders.go @@ -93,8 +93,9 @@ func (client IdentityProvidersClient) CreateOrUpdatePreparer(resourceGroupName s "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-07-07" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -169,8 +170,9 @@ func (client IdentityProvidersClient) DeletePreparer(resourceGroupName string, s "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-07-07" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -243,8 +245,9 @@ func (client IdentityProvidersClient) GetPreparer(resourceGroupName string, serv "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-07-07" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -315,8 +318,9 @@ func (client IdentityProvidersClient) ListByServicePreparer(resourceGroupName st "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-07-07" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -391,8 +395,9 @@ func (client IdentityProvidersClient) UpdatePreparer(resourceGroupName string, s "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-07-07" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( diff --git a/arm/apimanagement/loggers.go b/arm/apimanagement/loggers.go old mode 100644 new mode 100755 index 94ba99da0726..4292f235dfde --- a/arm/apimanagement/loggers.go +++ b/arm/apimanagement/loggers.go @@ -90,8 +90,9 @@ func (client LoggersClient) CreateOrUpdatePreparer(resourceGroupName string, ser "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-07-07" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -165,8 +166,9 @@ func (client LoggersClient) DeletePreparer(resourceGroupName string, serviceName "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-07-07" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -237,8 +239,9 @@ func (client LoggersClient) GetPreparer(resourceGroupName string, serviceName st "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-07-07" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -321,8 +324,9 @@ func (client LoggersClient) ListByServicePreparer(resourceGroupName string, serv "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-07-07" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } if len(filter) > 0 { queryParameters["$filter"] = autorest.Encode("query", filter) @@ -429,8 +433,9 @@ func (client LoggersClient) UpdatePreparer(resourceGroupName string, serviceName "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-07-07" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( diff --git a/arm/apimanagement/models.go b/arm/apimanagement/models.go old mode 100644 new mode 100755 diff --git a/arm/apimanagement/openidconnectproviders.go b/arm/apimanagement/openidconnectproviders.go old mode 100644 new mode 100755 index e3ae441656c7..43c2e97e7d4d --- a/arm/apimanagement/openidconnectproviders.go +++ b/arm/apimanagement/openidconnectproviders.go @@ -94,8 +94,9 @@ func (client OpenIDConnectProvidersClient) CreateOrUpdatePreparer(resourceGroupN "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-07-07" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -171,8 +172,9 @@ func (client OpenIDConnectProvidersClient) DeletePreparer(resourceGroupName stri "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-07-07" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -245,8 +247,9 @@ func (client OpenIDConnectProvidersClient) GetPreparer(resourceGroupName string, "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-07-07" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -329,8 +332,9 @@ func (client OpenIDConnectProvidersClient) ListByServicePreparer(resourceGroupNa "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-07-07" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } if len(filter) > 0 { queryParameters["$filter"] = autorest.Encode("query", filter) @@ -437,8 +441,9 @@ func (client OpenIDConnectProvidersClient) UpdatePreparer(resourceGroupName stri "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-07-07" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( diff --git a/arm/apimanagement/policysnippets.go b/arm/apimanagement/policysnippets.go old mode 100644 new mode 100755 index 9c98e7ca9f62..d08eefea26fb --- a/arm/apimanagement/policysnippets.go +++ b/arm/apimanagement/policysnippets.go @@ -84,8 +84,9 @@ func (client PolicySnippetsClient) ListByServicePreparer(resourceGroupName strin "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-07-07" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } if len(string(scope)) > 0 { queryParameters["scope"] = autorest.Encode("query", scope) diff --git a/arm/apimanagement/productapis.go b/arm/apimanagement/productapis.go old mode 100644 new mode 100755 index 7a33fe93962d..32b4742a6382 --- a/arm/apimanagement/productapis.go +++ b/arm/apimanagement/productapis.go @@ -95,8 +95,9 @@ func (client ProductApisClient) AddPreparer(resourceGroupName string, serviceNam "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-07-07" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -190,8 +191,9 @@ func (client ProductApisClient) ListByProductPreparer(resourceGroupName string, "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-07-07" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } if len(filter) > 0 { queryParameters["$filter"] = autorest.Encode("query", filter) @@ -306,8 +308,9 @@ func (client ProductApisClient) RemovePreparer(resourceGroupName string, service "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-07-07" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( diff --git a/arm/apimanagement/productgroups.go b/arm/apimanagement/productgroups.go old mode 100644 new mode 100755 index 38a4c662f646..7e4032b50624 --- a/arm/apimanagement/productgroups.go +++ b/arm/apimanagement/productgroups.go @@ -97,8 +97,9 @@ func (client ProductGroupsClient) AddPreparer(resourceGroupName string, serviceN "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-07-07" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -190,8 +191,9 @@ func (client ProductGroupsClient) ListByProductPreparer(resourceGroupName string "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-07-07" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } if len(filter) > 0 { queryParameters["$filter"] = autorest.Encode("query", filter) @@ -306,8 +308,9 @@ func (client ProductGroupsClient) RemovePreparer(resourceGroupName string, servi "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-07-07" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( diff --git a/arm/apimanagement/products.go b/arm/apimanagement/products.go old mode 100644 new mode 100755 index 11189683b9a4..c77d2a7acc09 --- a/arm/apimanagement/products.go +++ b/arm/apimanagement/products.go @@ -99,8 +99,9 @@ func (client ProductsClient) CreateOrUpdatePreparer(resourceGroupName string, se "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-07-07" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -181,8 +182,9 @@ func (client ProductsClient) DeletePreparer(resourceGroupName string, serviceNam "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-07-07" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } if deleteSubscriptions != nil { queryParameters["deleteSubscriptions"] = autorest.Encode("query", *deleteSubscriptions) @@ -261,8 +263,9 @@ func (client ProductsClient) GetPreparer(resourceGroupName string, serviceName s "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-07-07" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -353,8 +356,9 @@ func (client ProductsClient) ListByServicePreparer(resourceGroupName string, ser "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-07-07" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } if len(filter) > 0 { queryParameters["$filter"] = autorest.Encode("query", filter) @@ -469,8 +473,9 @@ func (client ProductsClient) UpdatePreparer(resourceGroupName string, serviceNam "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-07-07" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( diff --git a/arm/apimanagement/productsubscriptions.go b/arm/apimanagement/productsubscriptions.go old mode 100644 new mode 100755 index c1d8889ba891..c55d05478729 --- a/arm/apimanagement/productsubscriptions.go +++ b/arm/apimanagement/productsubscriptions.go @@ -111,8 +111,9 @@ func (client ProductSubscriptionsClient) ListByProductPreparer(resourceGroupName "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-07-07" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } if len(filter) > 0 { queryParameters["$filter"] = autorest.Encode("query", filter) diff --git a/arm/apimanagement/property.go b/arm/apimanagement/property.go old mode 100644 new mode 100755 index 82e4aa7e2f3f..75a068be41eb --- a/arm/apimanagement/property.go +++ b/arm/apimanagement/property.go @@ -100,8 +100,9 @@ func (client PropertyClient) CreateOrUpdatePreparer(resourceGroupName string, se "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-07-07" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -176,8 +177,9 @@ func (client PropertyClient) DeletePreparer(resourceGroupName string, serviceNam "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-07-07" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -249,8 +251,9 @@ func (client PropertyClient) GetPreparer(resourceGroupName string, serviceName s "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-07-07" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -334,8 +337,9 @@ func (client PropertyClient) ListByServicePreparer(resourceGroupName string, ser "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-07-07" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } if len(filter) > 0 { queryParameters["$filter"] = autorest.Encode("query", filter) @@ -442,8 +446,9 @@ func (client PropertyClient) UpdatePreparer(resourceGroupName string, serviceNam "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-07-07" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( diff --git a/arm/apimanagement/quotabycounterkeys.go b/arm/apimanagement/quotabycounterkeys.go old mode 100644 new mode 100755 index a38990ae2c7c..c77bdbabd060 --- a/arm/apimanagement/quotabycounterkeys.go +++ b/arm/apimanagement/quotabycounterkeys.go @@ -88,8 +88,9 @@ func (client QuotaByCounterKeysClient) ListByServicePreparer(resourceGroupName s "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-07-07" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -164,8 +165,9 @@ func (client QuotaByCounterKeysClient) UpdatePreparer(resourceGroupName string, "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-07-07" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( diff --git a/arm/apimanagement/quotabyperiodkeys.go b/arm/apimanagement/quotabyperiodkeys.go old mode 100644 new mode 100755 index a11ea8c18038..e054f391c831 --- a/arm/apimanagement/quotabyperiodkeys.go +++ b/arm/apimanagement/quotabyperiodkeys.go @@ -88,8 +88,9 @@ func (client QuotaByPeriodKeysClient) GetPreparer(resourceGroupName string, serv "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-07-07" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -164,8 +165,9 @@ func (client QuotaByPeriodKeysClient) UpdatePreparer(resourceGroupName string, s "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-07-07" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( diff --git a/arm/apimanagement/regions.go b/arm/apimanagement/regions.go old mode 100644 new mode 100755 index 4ec15ea6341b..bad1f43d8d25 --- a/arm/apimanagement/regions.go +++ b/arm/apimanagement/regions.go @@ -82,8 +82,9 @@ func (client RegionsClient) ListByServicePreparer(resourceGroupName string, serv "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-07-07" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( diff --git a/arm/apimanagement/reports.go b/arm/apimanagement/reports.go old mode 100644 new mode 100755 index 7ebc62074803..29986fe3189f --- a/arm/apimanagement/reports.go +++ b/arm/apimanagement/reports.go @@ -96,8 +96,9 @@ func (client ReportsClient) ListByServicePreparer(resourceGroupName string, serv "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-07-07" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } if len(filter) > 0 { queryParameters["$filter"] = autorest.Encode("query", filter) diff --git a/arm/apimanagement/subscriptions.go b/arm/apimanagement/subscriptions.go old mode 100644 new mode 100755 index a2bc584a760a..678f8ff97299 --- a/arm/apimanagement/subscriptions.go +++ b/arm/apimanagement/subscriptions.go @@ -106,8 +106,9 @@ func (client SubscriptionsClient) CreateOrUpdatePreparer(resourceGroupName strin "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-07-07" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -182,8 +183,9 @@ func (client SubscriptionsClient) DeletePreparer(resourceGroupName string, servi "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-07-07" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -254,8 +256,9 @@ func (client SubscriptionsClient) GetPreparer(resourceGroupName string, serviceN "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-07-07" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -346,8 +349,9 @@ func (client SubscriptionsClient) ListByServicePreparer(resourceGroupName string "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-07-07" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } if len(filter) > 0 { queryParameters["$filter"] = autorest.Encode("query", filter) @@ -452,8 +456,9 @@ func (client SubscriptionsClient) RegeneratePrimaryKeyPreparer(resourceGroupName "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-07-07" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -524,8 +529,9 @@ func (client SubscriptionsClient) RegenerateSecondaryKeyPreparer(resourceGroupNa "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-07-07" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -598,8 +604,9 @@ func (client SubscriptionsClient) UpdatePreparer(resourceGroupName string, servi "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-07-07" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( diff --git a/arm/apimanagement/tenantaccess.go b/arm/apimanagement/tenantaccess.go old mode 100644 new mode 100755 index bfee22a30e54..728a144ee305 --- a/arm/apimanagement/tenantaccess.go +++ b/arm/apimanagement/tenantaccess.go @@ -83,8 +83,9 @@ func (client TenantAccessClient) GetPreparer(resourceGroupName string, serviceNa "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-07-07" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -154,8 +155,9 @@ func (client TenantAccessClient) RegeneratePrimaryKeyPreparer(resourceGroupName "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-07-07" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -224,8 +226,9 @@ func (client TenantAccessClient) RegenerateSecondaryKeyPreparer(resourceGroupNam "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-07-07" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -296,8 +299,9 @@ func (client TenantAccessClient) UpdatePreparer(resourceGroupName string, servic "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-07-07" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( diff --git a/arm/apimanagement/tenantaccessgit.go b/arm/apimanagement/tenantaccessgit.go old mode 100644 new mode 100755 index 8427745c030e..6ff6ee2d1d86 --- a/arm/apimanagement/tenantaccessgit.go +++ b/arm/apimanagement/tenantaccessgit.go @@ -84,8 +84,9 @@ func (client TenantAccessGitClient) GetPreparer(resourceGroupName string, servic "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-07-07" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -155,8 +156,9 @@ func (client TenantAccessGitClient) RegeneratePrimaryKeyPreparer(resourceGroupNa "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-07-07" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -225,8 +227,9 @@ func (client TenantAccessGitClient) RegenerateSecondaryKeyPreparer(resourceGroup "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-07-07" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( diff --git a/arm/apimanagement/tenantconfiguration.go b/arm/apimanagement/tenantconfiguration.go old mode 100644 new mode 100755 index 7702b72f5cbc..f3fc52c9fca7 --- a/arm/apimanagement/tenantconfiguration.go +++ b/arm/apimanagement/tenantconfiguration.go @@ -91,8 +91,9 @@ func (client TenantConfigurationClient) DeployPreparer(resourceGroupName string, "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-07-07" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -172,8 +173,9 @@ func (client TenantConfigurationClient) SavePreparer(resourceGroupName string, s "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-07-07" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -253,8 +255,9 @@ func (client TenantConfigurationClient) ValidatePreparer(resourceGroupName strin "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-07-07" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( diff --git a/arm/apimanagement/tenantconfigurationsyncstate.go b/arm/apimanagement/tenantconfigurationsyncstate.go old mode 100644 new mode 100755 index e80963f90260..e5967483bc0d --- a/arm/apimanagement/tenantconfigurationsyncstate.go +++ b/arm/apimanagement/tenantconfigurationsyncstate.go @@ -85,8 +85,9 @@ func (client TenantConfigurationSyncStateClient) GetPreparer(resourceGroupName s "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-07-07" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( diff --git a/arm/apimanagement/usergroups.go b/arm/apimanagement/usergroups.go old mode 100644 new mode 100755 index da1eabaafaba..56c195492510 --- a/arm/apimanagement/usergroups.go +++ b/arm/apimanagement/usergroups.go @@ -104,8 +104,9 @@ func (client UserGroupsClient) ListByUserPreparer(resourceGroupName string, serv "uid": autorest.Encode("path", uid), } + const APIVersion = "2016-07-07" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } if len(filter) > 0 { queryParameters["$filter"] = autorest.Encode("query", filter) diff --git a/arm/apimanagement/useridentities.go b/arm/apimanagement/useridentities.go old mode 100644 new mode 100755 index 51ab3772d3a2..48e8a0894d13 --- a/arm/apimanagement/useridentities.go +++ b/arm/apimanagement/useridentities.go @@ -90,8 +90,9 @@ func (client UserIdentitiesClient) ListByUserPreparer(resourceGroupName string, "uid": autorest.Encode("path", uid), } + const APIVersion = "2016-07-07" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( diff --git a/arm/apimanagement/users.go b/arm/apimanagement/users.go old mode 100644 new mode 100755 index 1687b6d8d907..4982d1499188 --- a/arm/apimanagement/users.go +++ b/arm/apimanagement/users.go @@ -103,8 +103,9 @@ func (client UsersClient) CreateOrUpdatePreparer(resourceGroupName string, servi "uid": autorest.Encode("path", uid), } + const APIVersion = "2016-07-07" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -184,8 +185,9 @@ func (client UsersClient) DeletePreparer(resourceGroupName string, serviceName s "uid": autorest.Encode("path", uid), } + const APIVersion = "2016-07-07" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } if deleteSubscriptions != nil { queryParameters["deleteSubscriptions"] = autorest.Encode("query", *deleteSubscriptions) @@ -266,8 +268,9 @@ func (client UsersClient) GenerateSsoURLPreparer(resourceGroupName string, servi "uid": autorest.Encode("path", uid), } + const APIVersion = "2016-07-07" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -343,8 +346,9 @@ func (client UsersClient) GetPreparer(resourceGroupName string, serviceName stri "uid": autorest.Encode("path", uid), } + const APIVersion = "2016-07-07" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -438,8 +442,9 @@ func (client UsersClient) ListByServicePreparer(resourceGroupName string, servic "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-07-07" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } if len(filter) > 0 { queryParameters["$filter"] = autorest.Encode("query", filter) @@ -550,8 +555,9 @@ func (client UsersClient) UpdatePreparer(resourceGroupName string, serviceName s "uid": autorest.Encode("path", uid), } + const APIVersion = "2016-07-07" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( diff --git a/arm/apimanagement/usersubscriptions.go b/arm/apimanagement/usersubscriptions.go old mode 100644 new mode 100755 index 2e963449318d..32dd2e351ed7 --- a/arm/apimanagement/usersubscriptions.go +++ b/arm/apimanagement/usersubscriptions.go @@ -110,8 +110,9 @@ func (client UserSubscriptionsClient) ListByUserPreparer(resourceGroupName strin "uid": autorest.Encode("path", uid), } + const APIVersion = "2016-07-07" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } if len(filter) > 0 { queryParameters["$filter"] = autorest.Encode("query", filter) diff --git a/arm/apimanagement/version.go b/arm/apimanagement/version.go old mode 100644 new mode 100755 index 7970ba9820f5..033384a24290 --- a/arm/apimanagement/version.go +++ b/arm/apimanagement/version.go @@ -18,43 +18,12 @@ package apimanagement // Changes may cause incorrect behavior and will be lost if the code is // regenerated. -import ( - "bytes" - "fmt" - "strings" -) - -const ( - major = "8" - minor = "1" - patch = "0" - tag = "beta" - userAgentFormat = "Azure-SDK-For-Go/%s arm-%s/%s" -) - -// cached results of UserAgent and Version to prevent repeated operations. -var ( - userAgent string - version string -) - // UserAgent returns the UserAgent string to use when sending http.Requests. func UserAgent() string { - if userAgent == "" { - userAgent = fmt.Sprintf(userAgentFormat, Version(), "apimanagement", "2016-07-07") - } - return userAgent + return "Azure-SDK-For-Go/v9.0.0-beta arm-apimanagement/2016-07-07" } // Version returns the semantic version (see http://semver.org) of the client. func Version() string { - if version == "" { - versionBuilder := bytes.NewBufferString(fmt.Sprintf("%s.%s.%s", major, minor, patch)) - if tag != "" { - versionBuilder.WriteRune('-') - versionBuilder.WriteString(strings.TrimPrefix(tag, "-")) - } - version = string(versionBuilder.Bytes()) - } - return version + return "v9.0.0-beta" } diff --git a/arm/authorization/classicadministrators.go b/arm/authorization/classicadministrators.go old mode 100644 new mode 100755 index 947f9ec212a8..1258a9d4b18e --- a/arm/authorization/classicadministrators.go +++ b/arm/authorization/classicadministrators.go @@ -14,7 +14,7 @@ package authorization // See the License for the specific language governing permissions and // limitations under the License. // -// Code generated by Microsoft (R) AutoRest Code Generator 0.17.0.0 +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 // Changes may cause incorrect behavior and will be lost if the code is // regenerated. @@ -28,8 +28,8 @@ import ( // way to apply granular level policy administration down to individual // resources or resource groups. These operations enable you to manage role // definitions and role assignments. A role definition describes the set of -// actions that can be performed on resources. A role assignment grants -// access to Azure Active Directory users. +// actions that can be performed on resources. A role assignment grants access +// to Azure Active Directory users. type ClassicAdministratorsClient struct { ManagementClient } @@ -74,8 +74,9 @@ func (client ClassicAdministratorsClient) ListPreparer() (*http.Request, error) "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2015-07-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( diff --git a/arm/authorization/client.go b/arm/authorization/client.go old mode 100644 new mode 100755 index 039c96f35736..5330315d287c --- a/arm/authorization/client.go +++ b/arm/authorization/client.go @@ -22,7 +22,7 @@ package authorization // See the License for the specific language governing permissions and // limitations under the License. // -// Code generated by Microsoft (R) AutoRest Code Generator 0.17.0.0 +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 // Changes may cause incorrect behavior and will be lost if the code is // regenerated. @@ -31,9 +31,6 @@ import ( ) const ( - // APIVersion is the version of the Authorization - APIVersion = "2015-07-01" - // DefaultBaseURI is the default URI used for the service Authorization DefaultBaseURI = "https://management.azure.com" ) @@ -42,7 +39,6 @@ const ( type ManagementClient struct { autorest.Client BaseURI string - APIVersion string SubscriptionID string } @@ -56,7 +52,6 @@ func NewWithBaseURI(baseURI string, subscriptionID string) ManagementClient { return ManagementClient{ Client: autorest.NewClientWithUserAgent(UserAgent()), BaseURI: baseURI, - APIVersion: APIVersion, SubscriptionID: subscriptionID, } } diff --git a/arm/authorization/models.go b/arm/authorization/models.go old mode 100644 new mode 100755 index eaf0966dc905..b615a2c3ec2b --- a/arm/authorization/models.go +++ b/arm/authorization/models.go @@ -14,7 +14,7 @@ package authorization // See the License for the specific language governing permissions and // limitations under the License. // -// Code generated by Microsoft (R) AutoRest Code Generator 0.17.0.0 +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 // Changes may cause incorrect behavior and will be lost if the code is // regenerated. diff --git a/arm/authorization/permissions.go b/arm/authorization/permissions.go old mode 100644 new mode 100755 index c21d331e8e1e..e63715acb574 --- a/arm/authorization/permissions.go +++ b/arm/authorization/permissions.go @@ -14,7 +14,7 @@ package authorization // See the License for the specific language governing permissions and // limitations under the License. // -// Code generated by Microsoft (R) AutoRest Code Generator 0.17.0.0 +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 // Changes may cause incorrect behavior and will be lost if the code is // regenerated. @@ -26,10 +26,10 @@ import ( // PermissionsClient is the role based access control provides you a way to // apply granular level policy administration down to individual resources or -// resource groups. These operations enable you to manage role definitions -// and role assignments. A role definition describes the set of actions that -// can be performed on resources. A role assignment grants access to Azure -// Active Directory users. +// resource groups. These operations enable you to manage role definitions and +// role assignments. A role definition describes the set of actions that can be +// performed on resources. A role assignment grants access to Azure Active +// Directory users. type PermissionsClient struct { ManagementClient } @@ -39,19 +39,19 @@ func NewPermissionsClient(subscriptionID string) PermissionsClient { return NewPermissionsClientWithBaseURI(DefaultBaseURI, subscriptionID) } -// NewPermissionsClientWithBaseURI creates an instance of the -// PermissionsClient client. +// NewPermissionsClientWithBaseURI creates an instance of the PermissionsClient +// client. func NewPermissionsClientWithBaseURI(baseURI string, subscriptionID string) PermissionsClient { return PermissionsClient{NewWithBaseURI(baseURI, subscriptionID)} } // ListForResource gets all permissions the caller has for a resource. // -// resourceGroupName is the name of the resource group containing the -// resource. The name is case insensitive. resourceProviderNamespace is the -// namespace of the resource provider. parentResourcePath is the parent -// resource identity. resourceType is the resource type of the resource. -// resourceName is the name of the resource to get the permissions for. +// resourceGroupName is the name of the resource group containing the resource. +// The name is case insensitive. resourceProviderNamespace is the namespace of +// the resource provider. parentResourcePath is the parent resource identity. +// resourceType is the resource type of the resource. resourceName is the name +// of the resource to get the permissions for. func (client PermissionsClient) ListForResource(resourceGroupName string, resourceProviderNamespace string, parentResourcePath string, resourceType string, resourceName string) (result PermissionGetResult, err error) { req, err := client.ListForResourcePreparer(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName) if err != nil { @@ -83,8 +83,9 @@ func (client PermissionsClient) ListForResourcePreparer(resourceGroupName string "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2015-07-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -170,8 +171,9 @@ func (client PermissionsClient) ListForResourceGroupPreparer(resourceGroupName s "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2015-07-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( diff --git a/arm/authorization/provideroperationsmetadataoperations.go b/arm/authorization/provideroperationsmetadata.go old mode 100644 new mode 100755 similarity index 58% rename from arm/authorization/provideroperationsmetadataoperations.go rename to arm/authorization/provideroperationsmetadata.go index bbeba039caf8..798a573896b2 --- a/arm/authorization/provideroperationsmetadataoperations.go +++ b/arm/authorization/provideroperationsmetadata.go @@ -14,7 +14,7 @@ package authorization // See the License for the specific language governing permissions and // limitations under the License. // -// Code generated by Microsoft (R) AutoRest Code Generator 0.17.0.0 +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 // Changes may cause incorrect behavior and will be lost if the code is // regenerated. @@ -24,60 +24,61 @@ import ( "net/http" ) -// ProviderOperationsMetadataOperationsClient is the role based access control -// provides you a way to apply granular level policy administration down to -// individual resources or resource groups. These operations enable you to -// manage role definitions and role assignments. A role definition describes -// the set of actions that can be performed on resources. A role assignment -// grants access to Azure Active Directory users. -type ProviderOperationsMetadataOperationsClient struct { +// ProviderOperationsMetadataClient is the role based access control provides +// you a way to apply granular level policy administration down to individual +// resources or resource groups. These operations enable you to manage role +// definitions and role assignments. A role definition describes the set of +// actions that can be performed on resources. A role assignment grants access +// to Azure Active Directory users. +type ProviderOperationsMetadataClient struct { ManagementClient } -// NewProviderOperationsMetadataOperationsClient creates an instance of the -// ProviderOperationsMetadataOperationsClient client. -func NewProviderOperationsMetadataOperationsClient(subscriptionID string) ProviderOperationsMetadataOperationsClient { - return NewProviderOperationsMetadataOperationsClientWithBaseURI(DefaultBaseURI, subscriptionID) +// NewProviderOperationsMetadataClient creates an instance of the +// ProviderOperationsMetadataClient client. +func NewProviderOperationsMetadataClient(subscriptionID string) ProviderOperationsMetadataClient { + return NewProviderOperationsMetadataClientWithBaseURI(DefaultBaseURI, subscriptionID) } -// NewProviderOperationsMetadataOperationsClientWithBaseURI creates an -// instance of the ProviderOperationsMetadataOperationsClient client. -func NewProviderOperationsMetadataOperationsClientWithBaseURI(baseURI string, subscriptionID string) ProviderOperationsMetadataOperationsClient { - return ProviderOperationsMetadataOperationsClient{NewWithBaseURI(baseURI, subscriptionID)} +// NewProviderOperationsMetadataClientWithBaseURI creates an instance of the +// ProviderOperationsMetadataClient client. +func NewProviderOperationsMetadataClientWithBaseURI(baseURI string, subscriptionID string) ProviderOperationsMetadataClient { + return ProviderOperationsMetadataClient{NewWithBaseURI(baseURI, subscriptionID)} } // Get gets provider operations metadata for the specified resource provider. // // resourceProviderNamespace is the namespace of the resource provider. expand // is specifies whether to expand the values. -func (client ProviderOperationsMetadataOperationsClient) Get(resourceProviderNamespace string, expand string) (result ProviderOperationsMetadata, err error) { +func (client ProviderOperationsMetadataClient) Get(resourceProviderNamespace string, expand string) (result ProviderOperationsMetadata, err error) { req, err := client.GetPreparer(resourceProviderNamespace, expand) if err != nil { - return result, autorest.NewErrorWithError(err, "authorization.ProviderOperationsMetadataOperationsClient", "Get", nil, "Failure preparing request") + return result, autorest.NewErrorWithError(err, "authorization.ProviderOperationsMetadataClient", "Get", nil, "Failure preparing request") } resp, err := client.GetSender(req) if err != nil { result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "authorization.ProviderOperationsMetadataOperationsClient", "Get", resp, "Failure sending request") + return result, autorest.NewErrorWithError(err, "authorization.ProviderOperationsMetadataClient", "Get", resp, "Failure sending request") } result, err = client.GetResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "authorization.ProviderOperationsMetadataOperationsClient", "Get", resp, "Failure responding to request") + err = autorest.NewErrorWithError(err, "authorization.ProviderOperationsMetadataClient", "Get", resp, "Failure responding to request") } return } // GetPreparer prepares the Get request. -func (client ProviderOperationsMetadataOperationsClient) GetPreparer(resourceProviderNamespace string, expand string) (*http.Request, error) { +func (client ProviderOperationsMetadataClient) GetPreparer(resourceProviderNamespace string, expand string) (*http.Request, error) { pathParameters := map[string]interface{}{ "resourceProviderNamespace": autorest.Encode("path", resourceProviderNamespace), } + const APIVersion = "2015-07-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } if len(expand) > 0 { queryParameters["$expand"] = autorest.Encode("query", expand) @@ -93,13 +94,13 @@ func (client ProviderOperationsMetadataOperationsClient) GetPreparer(resourcePro // GetSender sends the Get request. The method will close the // http.Response Body if it receives an error. -func (client ProviderOperationsMetadataOperationsClient) GetSender(req *http.Request) (*http.Response, error) { +func (client ProviderOperationsMetadataClient) GetSender(req *http.Request) (*http.Response, error) { return autorest.SendWithSender(client, req) } // GetResponder handles the response to the Get request. The method always // closes the http.Response Body. -func (client ProviderOperationsMetadataOperationsClient) GetResponder(resp *http.Response) (result ProviderOperationsMetadata, err error) { +func (client ProviderOperationsMetadataClient) GetResponder(resp *http.Response) (result ProviderOperationsMetadata, err error) { err = autorest.Respond( resp, client.ByInspecting(), @@ -113,30 +114,31 @@ func (client ProviderOperationsMetadataOperationsClient) GetResponder(resp *http // List gets provider operations metadata for all resource providers. // // expand is specifies whether to expand the values. -func (client ProviderOperationsMetadataOperationsClient) List(expand string) (result ProviderOperationsMetadataListResult, err error) { +func (client ProviderOperationsMetadataClient) List(expand string) (result ProviderOperationsMetadataListResult, err error) { req, err := client.ListPreparer(expand) if err != nil { - return result, autorest.NewErrorWithError(err, "authorization.ProviderOperationsMetadataOperationsClient", "List", nil, "Failure preparing request") + return result, autorest.NewErrorWithError(err, "authorization.ProviderOperationsMetadataClient", "List", nil, "Failure preparing request") } resp, err := client.ListSender(req) if err != nil { result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "authorization.ProviderOperationsMetadataOperationsClient", "List", resp, "Failure sending request") + return result, autorest.NewErrorWithError(err, "authorization.ProviderOperationsMetadataClient", "List", resp, "Failure sending request") } result, err = client.ListResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "authorization.ProviderOperationsMetadataOperationsClient", "List", resp, "Failure responding to request") + err = autorest.NewErrorWithError(err, "authorization.ProviderOperationsMetadataClient", "List", resp, "Failure responding to request") } return } // ListPreparer prepares the List request. -func (client ProviderOperationsMetadataOperationsClient) ListPreparer(expand string) (*http.Request, error) { +func (client ProviderOperationsMetadataClient) ListPreparer(expand string) (*http.Request, error) { + const APIVersion = "2015-07-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } if len(expand) > 0 { queryParameters["$expand"] = autorest.Encode("query", expand) @@ -152,13 +154,13 @@ func (client ProviderOperationsMetadataOperationsClient) ListPreparer(expand str // ListSender sends the List request. The method will close the // http.Response Body if it receives an error. -func (client ProviderOperationsMetadataOperationsClient) ListSender(req *http.Request) (*http.Response, error) { +func (client ProviderOperationsMetadataClient) ListSender(req *http.Request) (*http.Response, error) { return autorest.SendWithSender(client, req) } // ListResponder handles the response to the List request. The method always // closes the http.Response Body. -func (client ProviderOperationsMetadataOperationsClient) ListResponder(resp *http.Response) (result ProviderOperationsMetadataListResult, err error) { +func (client ProviderOperationsMetadataClient) ListResponder(resp *http.Response) (result ProviderOperationsMetadataListResult, err error) { err = autorest.Respond( resp, client.ByInspecting(), @@ -170,10 +172,10 @@ func (client ProviderOperationsMetadataOperationsClient) ListResponder(resp *htt } // ListNextResults retrieves the next set of results, if any. -func (client ProviderOperationsMetadataOperationsClient) ListNextResults(lastResults ProviderOperationsMetadataListResult) (result ProviderOperationsMetadataListResult, err error) { +func (client ProviderOperationsMetadataClient) ListNextResults(lastResults ProviderOperationsMetadataListResult) (result ProviderOperationsMetadataListResult, err error) { req, err := lastResults.ProviderOperationsMetadataListResultPreparer() if err != nil { - return result, autorest.NewErrorWithError(err, "authorization.ProviderOperationsMetadataOperationsClient", "List", nil, "Failure preparing next results request") + return result, autorest.NewErrorWithError(err, "authorization.ProviderOperationsMetadataClient", "List", nil, "Failure preparing next results request") } if req == nil { return @@ -182,12 +184,12 @@ func (client ProviderOperationsMetadataOperationsClient) ListNextResults(lastRes resp, err := client.ListSender(req) if err != nil { result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "authorization.ProviderOperationsMetadataOperationsClient", "List", resp, "Failure sending next results request") + return result, autorest.NewErrorWithError(err, "authorization.ProviderOperationsMetadataClient", "List", resp, "Failure sending next results request") } result, err = client.ListResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "authorization.ProviderOperationsMetadataOperationsClient", "List", resp, "Failure responding to next results request") + err = autorest.NewErrorWithError(err, "authorization.ProviderOperationsMetadataClient", "List", resp, "Failure responding to next results request") } return diff --git a/arm/authorization/roleassignments.go b/arm/authorization/roleassignments.go old mode 100644 new mode 100755 index e3d64b2d262b..728b71cffd27 --- a/arm/authorization/roleassignments.go +++ b/arm/authorization/roleassignments.go @@ -14,7 +14,7 @@ package authorization // See the License for the specific language governing permissions and // limitations under the License. // -// Code generated by Microsoft (R) AutoRest Code Generator 0.17.0.0 +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 // Changes may cause incorrect behavior and will be lost if the code is // regenerated. @@ -24,12 +24,12 @@ import ( "net/http" ) -// RoleAssignmentsClient is the role based access control provides you a way -// to apply granular level policy administration down to individual resources -// or resource groups. These operations enable you to manage role definitions -// and role assignments. A role definition describes the set of actions that -// can be performed on resources. A role assignment grants access to Azure -// Active Directory users. +// RoleAssignmentsClient is the role based access control provides you a way to +// apply granular level policy administration down to individual resources or +// resource groups. These operations enable you to manage role definitions and +// role assignments. A role definition describes the set of actions that can be +// performed on resources. A role assignment grants access to Azure Active +// Directory users. type RoleAssignmentsClient struct { ManagementClient } @@ -49,10 +49,10 @@ func NewRoleAssignmentsClientWithBaseURI(baseURI string, subscriptionID string) // Create creates a role assignment. // // scope is the scope of the role assignment to create. The scope can be any -// REST resource instance. For example, use -// '/subscriptions/{subscription-id}/' for a subscription, -// '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}' -// for a resource group, and +// REST resource instance. For example, use '/subscriptions/{subscription-id}/' +// for a subscription, +// '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}' for +// a resource group, and // '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/{resource-provider}/{resource-type}/{resource-name}' // for a resource. roleAssignmentName is the name of the role assignment to // create. It can be any valid GUID. parameters is parameters for the role @@ -84,8 +84,9 @@ func (client RoleAssignmentsClient) CreatePreparer(scope string, roleAssignmentN "scope": scope, } + const APIVersion = "2015-07-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -147,8 +148,9 @@ func (client RoleAssignmentsClient) CreateByIDPreparer(roleAssignmentID string, "roleAssignmentId": roleAssignmentID, } + const APIVersion = "2015-07-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -211,8 +213,9 @@ func (client RoleAssignmentsClient) DeletePreparer(scope string, roleAssignmentN "scope": scope, } + const APIVersion = "2015-07-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -271,8 +274,9 @@ func (client RoleAssignmentsClient) DeleteByIDPreparer(roleAssignmentID string) "roleAssignmentId": roleAssignmentID, } + const APIVersion = "2015-07-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -304,8 +308,8 @@ func (client RoleAssignmentsClient) DeleteByIDResponder(resp *http.Response) (re // Get get the specified role assignment. // -// scope is the scope of the role assignment. roleAssignmentName is the name -// of the role assignment to get. +// scope is the scope of the role assignment. roleAssignmentName is the name of +// the role assignment to get. func (client RoleAssignmentsClient) Get(scope string, roleAssignmentName string) (result RoleAssignment, err error) { req, err := client.GetPreparer(scope, roleAssignmentName) if err != nil { @@ -333,8 +337,9 @@ func (client RoleAssignmentsClient) GetPreparer(scope string, roleAssignmentName "scope": scope, } + const APIVersion = "2015-07-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -393,8 +398,9 @@ func (client RoleAssignmentsClient) GetByIDPreparer(roleAssignmentID string) (*h "roleAssignmentId": roleAssignmentID, } + const APIVersion = "2015-07-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -428,8 +434,8 @@ func (client RoleAssignmentsClient) GetByIDResponder(resp *http.Response) (resul // // filter is the filter to apply on the operation. Use $filter=atScope() to // return all role assignments at or above the scope. Use $filter=principalId -// eq {id} to return all role assignments at, above or below the scope for -// the specified principal. +// eq {id} to return all role assignments at, above or below the scope for the +// specified principal. func (client RoleAssignmentsClient) List(filter string) (result RoleAssignmentListResult, err error) { req, err := client.ListPreparer(filter) if err != nil { @@ -456,8 +462,9 @@ func (client RoleAssignmentsClient) ListPreparer(filter string) (*http.Request, "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2015-07-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } if len(filter) > 0 { queryParameters["$filter"] = autorest.Encode("query", filter) @@ -521,9 +528,9 @@ func (client RoleAssignmentsClient) ListNextResults(lastResults RoleAssignmentLi // parentResourcePath is the parent resource identity. resourceType is the // resource type of the resource. resourceName is the name of the resource to // get role assignments for. filter is the filter to apply on the operation. -// Use $filter=atScope() to return all role assignments at or above the -// scope. Use $filter=principalId eq {id} to return all role assignments at, -// above or below the scope for the specified principal. +// Use $filter=atScope() to return all role assignments at or above the scope. +// Use $filter=principalId eq {id} to return all role assignments at, above or +// below the scope for the specified principal. func (client RoleAssignmentsClient) ListForResource(resourceGroupName string, resourceProviderNamespace string, parentResourcePath string, resourceType string, resourceName string, filter string) (result RoleAssignmentListResult, err error) { req, err := client.ListForResourcePreparer(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, filter) if err != nil { @@ -555,8 +562,9 @@ func (client RoleAssignmentsClient) ListForResourcePreparer(resourceGroupName st "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2015-07-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } if len(filter) > 0 { queryParameters["$filter"] = autorest.Encode("query", filter) @@ -615,11 +623,10 @@ func (client RoleAssignmentsClient) ListForResourceNextResults(lastResults RoleA // ListForResourceGroup gets role assignments for a resource group. // -// resourceGroupName is the name of the resource group. filter is the filter -// to apply on the operation. Use $filter=atScope() to return all role -// assignments at or above the scope. Use $filter=principalId eq {id} to -// return all role assignments at, above or below the scope for the specified -// principal. +// resourceGroupName is the name of the resource group. filter is the filter to +// apply on the operation. Use $filter=atScope() to return all role assignments +// at or above the scope. Use $filter=principalId eq {id} to return all role +// assignments at, above or below the scope for the specified principal. func (client RoleAssignmentsClient) ListForResourceGroup(resourceGroupName string, filter string) (result RoleAssignmentListResult, err error) { req, err := client.ListForResourceGroupPreparer(resourceGroupName, filter) if err != nil { @@ -647,8 +654,9 @@ func (client RoleAssignmentsClient) ListForResourceGroupPreparer(resourceGroupNa "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2015-07-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } if len(filter) > 0 { queryParameters["$filter"] = autorest.Encode("query", filter) @@ -707,9 +715,9 @@ func (client RoleAssignmentsClient) ListForResourceGroupNextResults(lastResults // ListForScope gets role assignments for a scope. // -// scope is the scope of the role assignments. filter is the filter to apply -// on the operation. Use $filter=atScope() to return all role assignments at -// or above the scope. Use $filter=principalId eq {id} to return all role +// scope is the scope of the role assignments. filter is the filter to apply on +// the operation. Use $filter=atScope() to return all role assignments at or +// above the scope. Use $filter=principalId eq {id} to return all role // assignments at, above or below the scope for the specified principal. func (client RoleAssignmentsClient) ListForScope(scope string, filter string) (result RoleAssignmentListResult, err error) { req, err := client.ListForScopePreparer(scope, filter) @@ -737,8 +745,9 @@ func (client RoleAssignmentsClient) ListForScopePreparer(scope string, filter st "scope": scope, } + const APIVersion = "2015-07-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } if len(filter) > 0 { queryParameters["$filter"] = autorest.Encode("query", filter) diff --git a/arm/authorization/roledefinitions.go b/arm/authorization/roledefinitions.go old mode 100644 new mode 100755 index ccab797c34e1..28dcdd04d04c --- a/arm/authorization/roledefinitions.go +++ b/arm/authorization/roledefinitions.go @@ -14,7 +14,7 @@ package authorization // See the License for the specific language governing permissions and // limitations under the License. // -// Code generated by Microsoft (R) AutoRest Code Generator 0.17.0.0 +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 // Changes may cause incorrect behavior and will be lost if the code is // regenerated. @@ -24,12 +24,12 @@ import ( "net/http" ) -// RoleDefinitionsClient is the role based access control provides you a way -// to apply granular level policy administration down to individual resources -// or resource groups. These operations enable you to manage role definitions -// and role assignments. A role definition describes the set of actions that -// can be performed on resources. A role assignment grants access to Azure -// Active Directory users. +// RoleDefinitionsClient is the role based access control provides you a way to +// apply granular level policy administration down to individual resources or +// resource groups. These operations enable you to manage role definitions and +// role assignments. A role definition describes the set of actions that can be +// performed on resources. A role assignment grants access to Azure Active +// Directory users. type RoleDefinitionsClient struct { ManagementClient } @@ -48,8 +48,8 @@ func NewRoleDefinitionsClientWithBaseURI(baseURI string, subscriptionID string) // CreateOrUpdate creates or updates a role definition. // -// scope is the scope of the role definition. roleDefinitionID is the ID of -// the role definition. roleDefinition is the values for the role definition. +// scope is the scope of the role definition. roleDefinitionID is the ID of the +// role definition. roleDefinition is the values for the role definition. func (client RoleDefinitionsClient) CreateOrUpdate(scope string, roleDefinitionID string, roleDefinition RoleDefinition) (result RoleDefinition, err error) { req, err := client.CreateOrUpdatePreparer(scope, roleDefinitionID, roleDefinition) if err != nil { @@ -77,8 +77,9 @@ func (client RoleDefinitionsClient) CreateOrUpdatePreparer(scope string, roleDef "scope": scope, } + const APIVersion = "2015-07-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -112,8 +113,8 @@ func (client RoleDefinitionsClient) CreateOrUpdateResponder(resp *http.Response) // Delete deletes a role definition. // -// scope is the scope of the role definition. roleDefinitionID is the ID of -// the role definition to delete. +// scope is the scope of the role definition. roleDefinitionID is the ID of the +// role definition to delete. func (client RoleDefinitionsClient) Delete(scope string, roleDefinitionID string) (result RoleDefinition, err error) { req, err := client.DeletePreparer(scope, roleDefinitionID) if err != nil { @@ -141,8 +142,9 @@ func (client RoleDefinitionsClient) DeletePreparer(scope string, roleDefinitionI "scope": scope, } + const APIVersion = "2015-07-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -174,8 +176,8 @@ func (client RoleDefinitionsClient) DeleteResponder(resp *http.Response) (result // Get get role definition by name (GUID). // -// scope is the scope of the role definition. roleDefinitionID is the ID of -// the role definition. +// scope is the scope of the role definition. roleDefinitionID is the ID of the +// role definition. func (client RoleDefinitionsClient) Get(scope string, roleDefinitionID string) (result RoleDefinition, err error) { req, err := client.GetPreparer(scope, roleDefinitionID) if err != nil { @@ -203,8 +205,9 @@ func (client RoleDefinitionsClient) GetPreparer(scope string, roleDefinitionID s "scope": scope, } + const APIVersion = "2015-07-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -263,8 +266,9 @@ func (client RoleDefinitionsClient) GetByIDPreparer(roleDefinitionID string) (*h "roleDefinitionId": roleDefinitionID, } + const APIVersion = "2015-07-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -297,8 +301,8 @@ func (client RoleDefinitionsClient) GetByIDResponder(resp *http.Response) (resul // List get all role definitions that are applicable at scope and above. // // scope is the scope of the role definition. filter is the filter to apply on -// the operation. Use atScopeAndBelow filter to search below the given scope -// as well. +// the operation. Use atScopeAndBelow filter to search below the given scope as +// well. func (client RoleDefinitionsClient) List(scope string, filter string) (result RoleDefinitionListResult, err error) { req, err := client.ListPreparer(scope, filter) if err != nil { @@ -325,8 +329,9 @@ func (client RoleDefinitionsClient) ListPreparer(scope string, filter string) (* "scope": scope, } + const APIVersion = "2015-07-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } if len(filter) > 0 { queryParameters["$filter"] = autorest.Encode("query", filter) diff --git a/arm/authorization/version.go b/arm/authorization/version.go old mode 100644 new mode 100755 index f6cacd20247a..3e16099cdc2f --- a/arm/authorization/version.go +++ b/arm/authorization/version.go @@ -18,43 +18,12 @@ package authorization // Changes may cause incorrect behavior and will be lost if the code is // regenerated. -import ( - "bytes" - "fmt" - "strings" -) - -const ( - major = "8" - minor = "1" - patch = "0" - tag = "beta" - userAgentFormat = "Azure-SDK-For-Go/%s arm-%s/%s" -) - -// cached results of UserAgent and Version to prevent repeated operations. -var ( - userAgent string - version string -) - // UserAgent returns the UserAgent string to use when sending http.Requests. func UserAgent() string { - if userAgent == "" { - userAgent = fmt.Sprintf(userAgentFormat, Version(), "authorization", "2015-07-01") - } - return userAgent + return "Azure-SDK-For-Go/v9.0.0-beta arm-authorization/2015-07-01" } // Version returns the semantic version (see http://semver.org) of the client. func Version() string { - if version == "" { - versionBuilder := bytes.NewBufferString(fmt.Sprintf("%s.%s.%s", major, minor, patch)) - if tag != "" { - versionBuilder.WriteRune('-') - versionBuilder.WriteString(strings.TrimPrefix(tag, "-")) - } - version = string(versionBuilder.Bytes()) - } - return version + return "v9.0.0-beta" } diff --git a/arm/batch/accountoperations.go b/arm/batch/account.go old mode 100644 new mode 100755 similarity index 67% rename from arm/batch/accountoperations.go rename to arm/batch/account.go index 05d818692024..1a2bc8db4ce3 --- a/arm/batch/accountoperations.go +++ b/arm/batch/account.go @@ -14,7 +14,7 @@ package batch // See the License for the specific language governing permissions and // limitations under the License. // -// Code generated by Microsoft (R) AutoRest Code Generator 0.17.0.0 +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 // Changes may cause incorrect behavior and will be lost if the code is // regenerated. @@ -25,29 +25,26 @@ import ( "net/http" ) -// AccountOperationsClient is the client for the AccountOperations methods of -// the Batch service. -type AccountOperationsClient struct { +// AccountClient is the client for the Account methods of the Batch service. +type AccountClient struct { ManagementClient } -// NewAccountOperationsClient creates an instance of the -// AccountOperationsClient client. -func NewAccountOperationsClient(subscriptionID string) AccountOperationsClient { - return NewAccountOperationsClientWithBaseURI(DefaultBaseURI, subscriptionID) +// NewAccountClient creates an instance of the AccountClient client. +func NewAccountClient(subscriptionID string) AccountClient { + return NewAccountClientWithBaseURI(DefaultBaseURI, subscriptionID) } -// NewAccountOperationsClientWithBaseURI creates an instance of the -// AccountOperationsClient client. -func NewAccountOperationsClientWithBaseURI(baseURI string, subscriptionID string) AccountOperationsClient { - return AccountOperationsClient{NewWithBaseURI(baseURI, subscriptionID)} +// NewAccountClientWithBaseURI creates an instance of the AccountClient client. +func NewAccountClientWithBaseURI(baseURI string, subscriptionID string) AccountClient { + return AccountClient{NewWithBaseURI(baseURI, subscriptionID)} } // Create creates a new Batch account with the specified parameters. Existing -// accounts cannot be updated with this API and should instead be updated -// with the Update Batch Account API. This method may poll for completion. -// Polling can be canceled by passing the cancel channel argument. The -// channel will be used to cancel polling and any outstanding HTTP requests. +// accounts cannot be updated with this API and should instead be updated with +// the Update Batch Account API. This method may poll for completion. Polling +// can be canceled by passing the cancel channel argument. The channel will be +// used to cancel polling and any outstanding HTTP requests. // // resourceGroupName is the name of the resource group that contains the new // Batch account. accountName is a name for the Batch account which must be @@ -57,7 +54,7 @@ func NewAccountOperationsClientWithBaseURI(baseURI string, subscriptionID string // service in the region in which the account is created. For example: // http://accountname.region.batch.azure.com/. parameters is additional // parameters for account creation. -func (client AccountOperationsClient) Create(resourceGroupName string, accountName string, parameters AccountCreateParameters, cancel <-chan struct{}) (result autorest.Response, err error) { +func (client AccountClient) Create(resourceGroupName string, accountName string, parameters AccountCreateParameters, cancel <-chan struct{}) (result autorest.Response, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: resourceGroupName, Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}, @@ -70,39 +67,44 @@ func (client AccountOperationsClient) Create(resourceGroupName string, accountNa {Target: "parameters.AccountBaseProperties", Name: validation.Null, Rule: false, Chain: []validation.Constraint{{Target: "parameters.AccountBaseProperties.AutoStorage", Name: validation.Null, Rule: false, Chain: []validation.Constraint{{Target: "parameters.AccountBaseProperties.AutoStorage.StorageAccountID", Name: validation.Null, Rule: true, Chain: nil}}}, + {Target: "parameters.AccountBaseProperties.KeyVaultReference", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.AccountBaseProperties.KeyVaultReference.ID", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.AccountBaseProperties.KeyVaultReference.URL", Name: validation.Null, Rule: true, Chain: nil}, + }}, }}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "batch.AccountOperationsClient", "Create") + return result, validation.NewErrorWithValidationError(err, "batch.AccountClient", "Create") } req, err := client.CreatePreparer(resourceGroupName, accountName, parameters, cancel) if err != nil { - return result, autorest.NewErrorWithError(err, "batch.AccountOperationsClient", "Create", nil, "Failure preparing request") + return result, autorest.NewErrorWithError(err, "batch.AccountClient", "Create", nil, "Failure preparing request") } resp, err := client.CreateSender(req) if err != nil { result.Response = resp - return result, autorest.NewErrorWithError(err, "batch.AccountOperationsClient", "Create", resp, "Failure sending request") + return result, autorest.NewErrorWithError(err, "batch.AccountClient", "Create", resp, "Failure sending request") } result, err = client.CreateResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "batch.AccountOperationsClient", "Create", resp, "Failure responding to request") + err = autorest.NewErrorWithError(err, "batch.AccountClient", "Create", resp, "Failure responding to request") } return } // CreatePreparer prepares the Create request. -func (client AccountOperationsClient) CreatePreparer(resourceGroupName string, accountName string, parameters AccountCreateParameters, cancel <-chan struct{}) (*http.Request, error) { +func (client AccountClient) CreatePreparer(resourceGroupName string, accountName string, parameters AccountCreateParameters, cancel <-chan struct{}) (*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 = "2017-01-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -117,7 +119,7 @@ func (client AccountOperationsClient) CreatePreparer(resourceGroupName string, a // CreateSender sends the Create request. The method will close the // http.Response Body if it receives an error. -func (client AccountOperationsClient) CreateSender(req *http.Request) (*http.Response, error) { +func (client AccountClient) CreateSender(req *http.Request) (*http.Response, error) { return autorest.SendWithSender(client, req, azure.DoPollForAsynchronous(client.PollingDelay)) @@ -125,7 +127,7 @@ func (client AccountOperationsClient) CreateSender(req *http.Request) (*http.Res // CreateResponder handles the response to the Create request. The method always // closes the http.Response Body. -func (client AccountOperationsClient) CreateResponder(resp *http.Response) (result autorest.Response, err error) { +func (client AccountClient) CreateResponder(resp *http.Response) (result autorest.Response, err error) { err = autorest.Respond( resp, client.ByInspecting(), @@ -136,14 +138,13 @@ func (client AccountOperationsClient) CreateResponder(resp *http.Response) (resu } // Delete deletes the specified Batch account. This method may poll for -// completion. Polling can be canceled by passing the cancel channel -// argument. The channel will be used to cancel polling and any outstanding -// HTTP requests. +// completion. Polling can be canceled by passing the cancel channel argument. +// The channel will be used to cancel polling and any outstanding HTTP +// requests. // // resourceGroupName is the name of the resource group that contains the Batch -// account to be deleted. accountName is the name of the account to be -// deleted. -func (client AccountOperationsClient) Delete(resourceGroupName string, accountName string, cancel <-chan struct{}) (result autorest.Response, err error) { +// account to be deleted. accountName is the name of the account to be deleted. +func (client AccountClient) Delete(resourceGroupName string, accountName string, cancel <-chan struct{}) (result autorest.Response, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: resourceGroupName, Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}, @@ -151,38 +152,39 @@ func (client AccountOperationsClient) Delete(resourceGroupName string, accountNa Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, {Target: "accountName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "batch.AccountOperationsClient", "Delete") + return result, validation.NewErrorWithValidationError(err, "batch.AccountClient", "Delete") } req, err := client.DeletePreparer(resourceGroupName, accountName, cancel) if err != nil { - return result, autorest.NewErrorWithError(err, "batch.AccountOperationsClient", "Delete", nil, "Failure preparing request") + return result, autorest.NewErrorWithError(err, "batch.AccountClient", "Delete", nil, "Failure preparing request") } resp, err := client.DeleteSender(req) if err != nil { result.Response = resp - return result, autorest.NewErrorWithError(err, "batch.AccountOperationsClient", "Delete", resp, "Failure sending request") + return result, autorest.NewErrorWithError(err, "batch.AccountClient", "Delete", resp, "Failure sending request") } result, err = client.DeleteResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "batch.AccountOperationsClient", "Delete", resp, "Failure responding to request") + err = autorest.NewErrorWithError(err, "batch.AccountClient", "Delete", resp, "Failure responding to request") } return } // DeletePreparer prepares the Delete request. -func (client AccountOperationsClient) DeletePreparer(resourceGroupName string, accountName string, cancel <-chan struct{}) (*http.Request, error) { +func (client AccountClient) DeletePreparer(resourceGroupName string, accountName string, cancel <-chan struct{}) (*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 = "2017-01-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -195,7 +197,7 @@ func (client AccountOperationsClient) DeletePreparer(resourceGroupName string, a // DeleteSender sends the Delete request. The method will close the // http.Response Body if it receives an error. -func (client AccountOperationsClient) DeleteSender(req *http.Request) (*http.Response, error) { +func (client AccountClient) DeleteSender(req *http.Request) (*http.Response, error) { return autorest.SendWithSender(client, req, azure.DoPollForAsynchronous(client.PollingDelay)) @@ -203,7 +205,7 @@ func (client AccountOperationsClient) DeleteSender(req *http.Request) (*http.Res // DeleteResponder handles the response to the Delete request. The method always // closes the http.Response Body. -func (client AccountOperationsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { +func (client AccountClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { err = autorest.Respond( resp, client.ByInspecting(), @@ -217,7 +219,7 @@ func (client AccountOperationsClient) DeleteResponder(resp *http.Response) (resu // // resourceGroupName is the name of the resource group that contains the Batch // account. accountName is the name of the account. -func (client AccountOperationsClient) Get(resourceGroupName string, accountName string) (result Account, err error) { +func (client AccountClient) Get(resourceGroupName string, accountName string) (result Account, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: resourceGroupName, Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}, @@ -225,38 +227,39 @@ func (client AccountOperationsClient) Get(resourceGroupName string, accountName Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, {Target: "accountName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "batch.AccountOperationsClient", "Get") + return result, validation.NewErrorWithValidationError(err, "batch.AccountClient", "Get") } req, err := client.GetPreparer(resourceGroupName, accountName) if err != nil { - return result, autorest.NewErrorWithError(err, "batch.AccountOperationsClient", "Get", nil, "Failure preparing request") + return result, autorest.NewErrorWithError(err, "batch.AccountClient", "Get", nil, "Failure preparing request") } resp, err := client.GetSender(req) if err != nil { result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "batch.AccountOperationsClient", "Get", resp, "Failure sending request") + return result, autorest.NewErrorWithError(err, "batch.AccountClient", "Get", resp, "Failure sending request") } result, err = client.GetResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "batch.AccountOperationsClient", "Get", resp, "Failure responding to request") + err = autorest.NewErrorWithError(err, "batch.AccountClient", "Get", resp, "Failure responding to request") } return } // GetPreparer prepares the Get request. -func (client AccountOperationsClient) GetPreparer(resourceGroupName string, accountName string) (*http.Request, error) { +func (client AccountClient) GetPreparer(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 = "2017-01-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -269,13 +272,13 @@ func (client AccountOperationsClient) GetPreparer(resourceGroupName string, acco // GetSender sends the Get request. The method will close the // http.Response Body if it receives an error. -func (client AccountOperationsClient) GetSender(req *http.Request) (*http.Response, error) { +func (client AccountClient) GetSender(req *http.Request) (*http.Response, error) { return autorest.SendWithSender(client, req) } // GetResponder handles the response to the Get request. The method always // closes the http.Response Body. -func (client AccountOperationsClient) GetResponder(resp *http.Response) (result Account, err error) { +func (client AccountClient) GetResponder(resp *http.Response) (result Account, err error) { err = autorest.Respond( resp, client.ByInspecting(), @@ -286,11 +289,15 @@ func (client AccountOperationsClient) GetResponder(resp *http.Response) (result return } -// GetKeys gets the account keys for the specified Batch account. +// GetKeys this operation applies only to Batch accounts created with a +// poolAllocationMode of 'BatchService'. If the Batch account was created with +// a poolAllocationMode of 'UserSubscription', clients cannot use access to +// keys to authenticate, and must use Azure Active Directory instead. In this +// case, getting the keys will fail. // // resourceGroupName is the name of the resource group that contains the Batch // account. accountName is the name of the account. -func (client AccountOperationsClient) GetKeys(resourceGroupName string, accountName string) (result AccountKeys, err error) { +func (client AccountClient) GetKeys(resourceGroupName string, accountName string) (result AccountKeys, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: resourceGroupName, Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}, @@ -298,38 +305,39 @@ func (client AccountOperationsClient) GetKeys(resourceGroupName string, accountN Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, {Target: "accountName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "batch.AccountOperationsClient", "GetKeys") + return result, validation.NewErrorWithValidationError(err, "batch.AccountClient", "GetKeys") } req, err := client.GetKeysPreparer(resourceGroupName, accountName) if err != nil { - return result, autorest.NewErrorWithError(err, "batch.AccountOperationsClient", "GetKeys", nil, "Failure preparing request") + return result, autorest.NewErrorWithError(err, "batch.AccountClient", "GetKeys", nil, "Failure preparing request") } resp, err := client.GetKeysSender(req) if err != nil { result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "batch.AccountOperationsClient", "GetKeys", resp, "Failure sending request") + return result, autorest.NewErrorWithError(err, "batch.AccountClient", "GetKeys", resp, "Failure sending request") } result, err = client.GetKeysResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "batch.AccountOperationsClient", "GetKeys", resp, "Failure responding to request") + err = autorest.NewErrorWithError(err, "batch.AccountClient", "GetKeys", resp, "Failure responding to request") } return } // GetKeysPreparer prepares the GetKeys request. -func (client AccountOperationsClient) GetKeysPreparer(resourceGroupName string, accountName string) (*http.Request, error) { +func (client AccountClient) GetKeysPreparer(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 = "2017-01-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -342,13 +350,13 @@ func (client AccountOperationsClient) GetKeysPreparer(resourceGroupName string, // GetKeysSender sends the GetKeys request. The method will close the // http.Response Body if it receives an error. -func (client AccountOperationsClient) GetKeysSender(req *http.Request) (*http.Response, error) { +func (client AccountClient) GetKeysSender(req *http.Request) (*http.Response, error) { return autorest.SendWithSender(client, req) } // GetKeysResponder handles the response to the GetKeys request. The method always // closes the http.Response Body. -func (client AccountOperationsClient) GetKeysResponder(resp *http.Response) (result AccountKeys, err error) { +func (client AccountClient) GetKeysResponder(resp *http.Response) (result AccountKeys, err error) { err = autorest.Respond( resp, client.ByInspecting(), @@ -361,34 +369,35 @@ func (client AccountOperationsClient) GetKeysResponder(resp *http.Response) (res // List gets information about the Batch accounts associated with the // subscription. -func (client AccountOperationsClient) List() (result AccountListResult, err error) { +func (client AccountClient) List() (result AccountListResult, err error) { req, err := client.ListPreparer() if err != nil { - return result, autorest.NewErrorWithError(err, "batch.AccountOperationsClient", "List", nil, "Failure preparing request") + return result, autorest.NewErrorWithError(err, "batch.AccountClient", "List", nil, "Failure preparing request") } resp, err := client.ListSender(req) if err != nil { result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "batch.AccountOperationsClient", "List", resp, "Failure sending request") + return result, autorest.NewErrorWithError(err, "batch.AccountClient", "List", resp, "Failure sending request") } result, err = client.ListResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "batch.AccountOperationsClient", "List", resp, "Failure responding to request") + err = autorest.NewErrorWithError(err, "batch.AccountClient", "List", resp, "Failure responding to request") } return } // ListPreparer prepares the List request. -func (client AccountOperationsClient) ListPreparer() (*http.Request, error) { +func (client AccountClient) ListPreparer() (*http.Request, error) { pathParameters := map[string]interface{}{ "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2017-01-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -401,13 +410,13 @@ func (client AccountOperationsClient) ListPreparer() (*http.Request, error) { // ListSender sends the List request. The method will close the // http.Response Body if it receives an error. -func (client AccountOperationsClient) ListSender(req *http.Request) (*http.Response, error) { +func (client AccountClient) ListSender(req *http.Request) (*http.Response, error) { return autorest.SendWithSender(client, req) } // ListResponder handles the response to the List request. The method always // closes the http.Response Body. -func (client AccountOperationsClient) ListResponder(resp *http.Response) (result AccountListResult, err error) { +func (client AccountClient) ListResponder(resp *http.Response) (result AccountListResult, err error) { err = autorest.Respond( resp, client.ByInspecting(), @@ -419,10 +428,10 @@ func (client AccountOperationsClient) ListResponder(resp *http.Response) (result } // ListNextResults retrieves the next set of results, if any. -func (client AccountOperationsClient) ListNextResults(lastResults AccountListResult) (result AccountListResult, err error) { +func (client AccountClient) ListNextResults(lastResults AccountListResult) (result AccountListResult, err error) { req, err := lastResults.AccountListResultPreparer() if err != nil { - return result, autorest.NewErrorWithError(err, "batch.AccountOperationsClient", "List", nil, "Failure preparing next results request") + return result, autorest.NewErrorWithError(err, "batch.AccountClient", "List", nil, "Failure preparing next results request") } if req == nil { return @@ -431,12 +440,12 @@ func (client AccountOperationsClient) ListNextResults(lastResults AccountListRes resp, err := client.ListSender(req) if err != nil { result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "batch.AccountOperationsClient", "List", resp, "Failure sending next results request") + return result, autorest.NewErrorWithError(err, "batch.AccountClient", "List", resp, "Failure sending next results request") } result, err = client.ListResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "batch.AccountOperationsClient", "List", resp, "Failure responding to next results request") + err = autorest.NewErrorWithError(err, "batch.AccountClient", "List", resp, "Failure responding to next results request") } return @@ -447,41 +456,42 @@ func (client AccountOperationsClient) ListNextResults(lastResults AccountListRes // // resourceGroupName is the name of the resource group whose Batch accounts to // list. -func (client AccountOperationsClient) ListByResourceGroup(resourceGroupName string) (result AccountListResult, err error) { +func (client AccountClient) ListByResourceGroup(resourceGroupName string) (result AccountListResult, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: resourceGroupName, Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "batch.AccountOperationsClient", "ListByResourceGroup") + return result, validation.NewErrorWithValidationError(err, "batch.AccountClient", "ListByResourceGroup") } req, err := client.ListByResourceGroupPreparer(resourceGroupName) if err != nil { - return result, autorest.NewErrorWithError(err, "batch.AccountOperationsClient", "ListByResourceGroup", nil, "Failure preparing request") + return result, autorest.NewErrorWithError(err, "batch.AccountClient", "ListByResourceGroup", nil, "Failure preparing request") } resp, err := client.ListByResourceGroupSender(req) if err != nil { result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "batch.AccountOperationsClient", "ListByResourceGroup", resp, "Failure sending request") + return result, autorest.NewErrorWithError(err, "batch.AccountClient", "ListByResourceGroup", resp, "Failure sending request") } result, err = client.ListByResourceGroupResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "batch.AccountOperationsClient", "ListByResourceGroup", resp, "Failure responding to request") + err = autorest.NewErrorWithError(err, "batch.AccountClient", "ListByResourceGroup", resp, "Failure responding to request") } return } // ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client AccountOperationsClient) ListByResourceGroupPreparer(resourceGroupName string) (*http.Request, error) { +func (client AccountClient) ListByResourceGroupPreparer(resourceGroupName string) (*http.Request, error) { pathParameters := map[string]interface{}{ "resourceGroupName": autorest.Encode("path", resourceGroupName), "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2017-01-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -494,13 +504,13 @@ func (client AccountOperationsClient) ListByResourceGroupPreparer(resourceGroupN // ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the // http.Response Body if it receives an error. -func (client AccountOperationsClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { +func (client AccountClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { return autorest.SendWithSender(client, req) } // ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always // closes the http.Response Body. -func (client AccountOperationsClient) ListByResourceGroupResponder(resp *http.Response) (result AccountListResult, err error) { +func (client AccountClient) ListByResourceGroupResponder(resp *http.Response) (result AccountListResult, err error) { err = autorest.Respond( resp, client.ByInspecting(), @@ -512,10 +522,10 @@ func (client AccountOperationsClient) ListByResourceGroupResponder(resp *http.Re } // ListByResourceGroupNextResults retrieves the next set of results, if any. -func (client AccountOperationsClient) ListByResourceGroupNextResults(lastResults AccountListResult) (result AccountListResult, err error) { +func (client AccountClient) ListByResourceGroupNextResults(lastResults AccountListResult) (result AccountListResult, err error) { req, err := lastResults.AccountListResultPreparer() if err != nil { - return result, autorest.NewErrorWithError(err, "batch.AccountOperationsClient", "ListByResourceGroup", nil, "Failure preparing next results request") + return result, autorest.NewErrorWithError(err, "batch.AccountClient", "ListByResourceGroup", nil, "Failure preparing next results request") } if req == nil { return @@ -524,12 +534,12 @@ func (client AccountOperationsClient) ListByResourceGroupNextResults(lastResults resp, err := client.ListByResourceGroupSender(req) if err != nil { result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "batch.AccountOperationsClient", "ListByResourceGroup", resp, "Failure sending next results request") + return result, autorest.NewErrorWithError(err, "batch.AccountClient", "ListByResourceGroup", resp, "Failure sending next results request") } result, err = client.ListByResourceGroupResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "batch.AccountOperationsClient", "ListByResourceGroup", resp, "Failure responding to next results request") + err = autorest.NewErrorWithError(err, "batch.AccountClient", "ListByResourceGroup", resp, "Failure responding to next results request") } return @@ -540,7 +550,7 @@ func (client AccountOperationsClient) ListByResourceGroupNextResults(lastResults // resourceGroupName is the name of the resource group that contains the Batch // account. accountName is the name of the account. parameters is the type of // key to regenerate. -func (client AccountOperationsClient) RegenerateKey(resourceGroupName string, accountName string, parameters AccountRegenerateKeyParameters) (result AccountKeys, err error) { +func (client AccountClient) RegenerateKey(resourceGroupName string, accountName string, parameters AccountRegenerateKeyParameters) (result AccountKeys, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: resourceGroupName, Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}, @@ -548,38 +558,39 @@ func (client AccountOperationsClient) RegenerateKey(resourceGroupName string, ac Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, {Target: "accountName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "batch.AccountOperationsClient", "RegenerateKey") + return result, validation.NewErrorWithValidationError(err, "batch.AccountClient", "RegenerateKey") } req, err := client.RegenerateKeyPreparer(resourceGroupName, accountName, parameters) if err != nil { - return result, autorest.NewErrorWithError(err, "batch.AccountOperationsClient", "RegenerateKey", nil, "Failure preparing request") + return result, autorest.NewErrorWithError(err, "batch.AccountClient", "RegenerateKey", nil, "Failure preparing request") } resp, err := client.RegenerateKeySender(req) if err != nil { result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "batch.AccountOperationsClient", "RegenerateKey", resp, "Failure sending request") + return result, autorest.NewErrorWithError(err, "batch.AccountClient", "RegenerateKey", resp, "Failure sending request") } result, err = client.RegenerateKeyResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "batch.AccountOperationsClient", "RegenerateKey", resp, "Failure responding to request") + err = autorest.NewErrorWithError(err, "batch.AccountClient", "RegenerateKey", resp, "Failure responding to request") } return } // RegenerateKeyPreparer prepares the RegenerateKey request. -func (client AccountOperationsClient) RegenerateKeyPreparer(resourceGroupName string, accountName string, parameters AccountRegenerateKeyParameters) (*http.Request, error) { +func (client AccountClient) RegenerateKeyPreparer(resourceGroupName string, accountName string, parameters AccountRegenerateKeyParameters) (*http.Request, error) { pathParameters := map[string]interface{}{ "accountName": autorest.Encode("path", accountName), "resourceGroupName": autorest.Encode("path", resourceGroupName), "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2017-01-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -594,13 +605,13 @@ func (client AccountOperationsClient) RegenerateKeyPreparer(resourceGroupName st // RegenerateKeySender sends the RegenerateKey request. The method will close the // http.Response Body if it receives an error. -func (client AccountOperationsClient) RegenerateKeySender(req *http.Request) (*http.Response, error) { +func (client AccountClient) RegenerateKeySender(req *http.Request) (*http.Response, error) { return autorest.SendWithSender(client, req) } // RegenerateKeyResponder handles the response to the RegenerateKey request. The method always // closes the http.Response Body. -func (client AccountOperationsClient) RegenerateKeyResponder(resp *http.Response) (result AccountKeys, err error) { +func (client AccountClient) RegenerateKeyResponder(resp *http.Response) (result AccountKeys, err error) { err = autorest.Respond( resp, client.ByInspecting(), @@ -616,7 +627,7 @@ func (client AccountOperationsClient) RegenerateKeyResponder(resp *http.Response // // resourceGroupName is the name of the resource group that contains the Batch // account. accountName is the name of the Batch account. -func (client AccountOperationsClient) SynchronizeAutoStorageKeys(resourceGroupName string, accountName string) (result autorest.Response, err error) { +func (client AccountClient) SynchronizeAutoStorageKeys(resourceGroupName string, accountName string) (result autorest.Response, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: resourceGroupName, Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}, @@ -624,38 +635,39 @@ func (client AccountOperationsClient) SynchronizeAutoStorageKeys(resourceGroupNa Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, {Target: "accountName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "batch.AccountOperationsClient", "SynchronizeAutoStorageKeys") + return result, validation.NewErrorWithValidationError(err, "batch.AccountClient", "SynchronizeAutoStorageKeys") } req, err := client.SynchronizeAutoStorageKeysPreparer(resourceGroupName, accountName) if err != nil { - return result, autorest.NewErrorWithError(err, "batch.AccountOperationsClient", "SynchronizeAutoStorageKeys", nil, "Failure preparing request") + return result, autorest.NewErrorWithError(err, "batch.AccountClient", "SynchronizeAutoStorageKeys", nil, "Failure preparing request") } resp, err := client.SynchronizeAutoStorageKeysSender(req) if err != nil { result.Response = resp - return result, autorest.NewErrorWithError(err, "batch.AccountOperationsClient", "SynchronizeAutoStorageKeys", resp, "Failure sending request") + return result, autorest.NewErrorWithError(err, "batch.AccountClient", "SynchronizeAutoStorageKeys", resp, "Failure sending request") } result, err = client.SynchronizeAutoStorageKeysResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "batch.AccountOperationsClient", "SynchronizeAutoStorageKeys", resp, "Failure responding to request") + err = autorest.NewErrorWithError(err, "batch.AccountClient", "SynchronizeAutoStorageKeys", resp, "Failure responding to request") } return } // SynchronizeAutoStorageKeysPreparer prepares the SynchronizeAutoStorageKeys request. -func (client AccountOperationsClient) SynchronizeAutoStorageKeysPreparer(resourceGroupName string, accountName string) (*http.Request, error) { +func (client AccountClient) SynchronizeAutoStorageKeysPreparer(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 = "2017-01-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -668,13 +680,13 @@ func (client AccountOperationsClient) SynchronizeAutoStorageKeysPreparer(resourc // SynchronizeAutoStorageKeysSender sends the SynchronizeAutoStorageKeys request. The method will close the // http.Response Body if it receives an error. -func (client AccountOperationsClient) SynchronizeAutoStorageKeysSender(req *http.Request) (*http.Response, error) { +func (client AccountClient) SynchronizeAutoStorageKeysSender(req *http.Request) (*http.Response, error) { return autorest.SendWithSender(client, req) } // SynchronizeAutoStorageKeysResponder handles the response to the SynchronizeAutoStorageKeys request. The method always // closes the http.Response Body. -func (client AccountOperationsClient) SynchronizeAutoStorageKeysResponder(resp *http.Response) (result autorest.Response, err error) { +func (client AccountClient) SynchronizeAutoStorageKeysResponder(resp *http.Response) (result autorest.Response, err error) { err = autorest.Respond( resp, client.ByInspecting(), @@ -689,7 +701,7 @@ func (client AccountOperationsClient) SynchronizeAutoStorageKeysResponder(resp * // resourceGroupName is the name of the resource group that contains the Batch // account. accountName is the name of the account. parameters is additional // parameters for account update. -func (client AccountOperationsClient) Update(resourceGroupName string, accountName string, parameters AccountUpdateParameters) (result Account, err error) { +func (client AccountClient) Update(resourceGroupName string, accountName string, parameters AccountUpdateParameters) (result Account, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: resourceGroupName, Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}, @@ -697,38 +709,39 @@ func (client AccountOperationsClient) Update(resourceGroupName string, accountNa Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, {Target: "accountName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "batch.AccountOperationsClient", "Update") + return result, validation.NewErrorWithValidationError(err, "batch.AccountClient", "Update") } req, err := client.UpdatePreparer(resourceGroupName, accountName, parameters) if err != nil { - return result, autorest.NewErrorWithError(err, "batch.AccountOperationsClient", "Update", nil, "Failure preparing request") + return result, autorest.NewErrorWithError(err, "batch.AccountClient", "Update", nil, "Failure preparing request") } resp, err := client.UpdateSender(req) if err != nil { result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "batch.AccountOperationsClient", "Update", resp, "Failure sending request") + return result, autorest.NewErrorWithError(err, "batch.AccountClient", "Update", resp, "Failure sending request") } result, err = client.UpdateResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "batch.AccountOperationsClient", "Update", resp, "Failure responding to request") + err = autorest.NewErrorWithError(err, "batch.AccountClient", "Update", resp, "Failure responding to request") } return } // UpdatePreparer prepares the Update request. -func (client AccountOperationsClient) UpdatePreparer(resourceGroupName string, accountName string, parameters AccountUpdateParameters) (*http.Request, error) { +func (client AccountClient) UpdatePreparer(resourceGroupName string, accountName string, parameters AccountUpdateParameters) (*http.Request, error) { pathParameters := map[string]interface{}{ "accountName": autorest.Encode("path", accountName), "resourceGroupName": autorest.Encode("path", resourceGroupName), "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2017-01-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -743,13 +756,13 @@ func (client AccountOperationsClient) UpdatePreparer(resourceGroupName string, a // UpdateSender sends the Update request. The method will close the // http.Response Body if it receives an error. -func (client AccountOperationsClient) UpdateSender(req *http.Request) (*http.Response, error) { +func (client AccountClient) UpdateSender(req *http.Request) (*http.Response, error) { return autorest.SendWithSender(client, req) } // UpdateResponder handles the response to the Update request. The method always // closes the http.Response Body. -func (client AccountOperationsClient) UpdateResponder(resp *http.Response) (result Account, err error) { +func (client AccountClient) UpdateResponder(resp *http.Response) (result Account, err error) { err = autorest.Respond( resp, client.ByInspecting(), diff --git a/arm/batch/applicationoperations.go b/arm/batch/application.go old mode 100644 new mode 100755 similarity index 70% rename from arm/batch/applicationoperations.go rename to arm/batch/application.go index b887cdf2f31e..32f8cc72a7ea --- a/arm/batch/applicationoperations.go +++ b/arm/batch/application.go @@ -14,7 +14,7 @@ package batch // See the License for the specific language governing permissions and // limitations under the License. // -// Code generated by Microsoft (R) AutoRest Code Generator 0.17.0.0 +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 // Changes may cause incorrect behavior and will be lost if the code is // regenerated. @@ -25,30 +25,29 @@ import ( "net/http" ) -// ApplicationOperationsClient is the client for the ApplicationOperations -// methods of the Batch service. -type ApplicationOperationsClient struct { +// ApplicationClient is the client for the Application methods of the Batch +// service. +type ApplicationClient struct { ManagementClient } -// NewApplicationOperationsClient creates an instance of the -// ApplicationOperationsClient client. -func NewApplicationOperationsClient(subscriptionID string) ApplicationOperationsClient { - return NewApplicationOperationsClientWithBaseURI(DefaultBaseURI, subscriptionID) +// NewApplicationClient creates an instance of the ApplicationClient client. +func NewApplicationClient(subscriptionID string) ApplicationClient { + return NewApplicationClientWithBaseURI(DefaultBaseURI, subscriptionID) } -// NewApplicationOperationsClientWithBaseURI creates an instance of the -// ApplicationOperationsClient client. -func NewApplicationOperationsClientWithBaseURI(baseURI string, subscriptionID string) ApplicationOperationsClient { - return ApplicationOperationsClient{NewWithBaseURI(baseURI, subscriptionID)} +// NewApplicationClientWithBaseURI creates an instance of the ApplicationClient +// client. +func NewApplicationClientWithBaseURI(baseURI string, subscriptionID string) ApplicationClient { + return ApplicationClient{NewWithBaseURI(baseURI, subscriptionID)} } // Create adds an application to the specified Batch account. // // resourceGroupName is the name of the resource group that contains the Batch -// account. accountName is the name of the Batch account. applicationID is -// the ID of the application. parameters is the parameters for the request. -func (client ApplicationOperationsClient) Create(resourceGroupName string, accountName string, applicationID string, parameters *AddApplicationParameters) (result Application, err error) { +// account. accountName is the name of the Batch account. applicationID is the +// ID of the application. parameters is the parameters for the request. +func (client ApplicationClient) Create(resourceGroupName string, accountName string, applicationID string, parameters *AddApplicationParameters) (result Application, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: resourceGroupName, Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}, @@ -56,30 +55,30 @@ func (client ApplicationOperationsClient) Create(resourceGroupName string, accou Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, {Target: "accountName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "batch.ApplicationOperationsClient", "Create") + return result, validation.NewErrorWithValidationError(err, "batch.ApplicationClient", "Create") } req, err := client.CreatePreparer(resourceGroupName, accountName, applicationID, parameters) if err != nil { - return result, autorest.NewErrorWithError(err, "batch.ApplicationOperationsClient", "Create", nil, "Failure preparing request") + return result, autorest.NewErrorWithError(err, "batch.ApplicationClient", "Create", nil, "Failure preparing request") } resp, err := client.CreateSender(req) if err != nil { result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "batch.ApplicationOperationsClient", "Create", resp, "Failure sending request") + return result, autorest.NewErrorWithError(err, "batch.ApplicationClient", "Create", resp, "Failure sending request") } result, err = client.CreateResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "batch.ApplicationOperationsClient", "Create", resp, "Failure responding to request") + err = autorest.NewErrorWithError(err, "batch.ApplicationClient", "Create", resp, "Failure responding to request") } return } // CreatePreparer prepares the Create request. -func (client ApplicationOperationsClient) CreatePreparer(resourceGroupName string, accountName string, applicationID string, parameters *AddApplicationParameters) (*http.Request, error) { +func (client ApplicationClient) CreatePreparer(resourceGroupName string, accountName string, applicationID string, parameters *AddApplicationParameters) (*http.Request, error) { pathParameters := map[string]interface{}{ "accountName": autorest.Encode("path", accountName), "applicationId": autorest.Encode("path", applicationID), @@ -87,8 +86,9 @@ func (client ApplicationOperationsClient) CreatePreparer(resourceGroupName strin "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2017-01-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -106,13 +106,13 @@ func (client ApplicationOperationsClient) CreatePreparer(resourceGroupName strin // CreateSender sends the Create request. The method will close the // http.Response Body if it receives an error. -func (client ApplicationOperationsClient) CreateSender(req *http.Request) (*http.Response, error) { +func (client ApplicationClient) CreateSender(req *http.Request) (*http.Response, error) { return autorest.SendWithSender(client, req) } // CreateResponder handles the response to the Create request. The method always // closes the http.Response Body. -func (client ApplicationOperationsClient) CreateResponder(resp *http.Response) (result Application, err error) { +func (client ApplicationClient) CreateResponder(resp *http.Response) (result Application, err error) { err = autorest.Respond( resp, client.ByInspecting(), @@ -126,9 +126,9 @@ func (client ApplicationOperationsClient) CreateResponder(resp *http.Response) ( // Delete deletes an application. // // resourceGroupName is the name of the resource group that contains the Batch -// account. accountName is the name of the Batch account. applicationID is -// the ID of the application. -func (client ApplicationOperationsClient) Delete(resourceGroupName string, accountName string, applicationID string) (result autorest.Response, err error) { +// account. accountName is the name of the Batch account. applicationID is the +// ID of the application. +func (client ApplicationClient) Delete(resourceGroupName string, accountName string, applicationID string) (result autorest.Response, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: resourceGroupName, Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}, @@ -136,30 +136,30 @@ func (client ApplicationOperationsClient) Delete(resourceGroupName string, accou Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, {Target: "accountName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "batch.ApplicationOperationsClient", "Delete") + return result, validation.NewErrorWithValidationError(err, "batch.ApplicationClient", "Delete") } req, err := client.DeletePreparer(resourceGroupName, accountName, applicationID) if err != nil { - return result, autorest.NewErrorWithError(err, "batch.ApplicationOperationsClient", "Delete", nil, "Failure preparing request") + return result, autorest.NewErrorWithError(err, "batch.ApplicationClient", "Delete", nil, "Failure preparing request") } resp, err := client.DeleteSender(req) if err != nil { result.Response = resp - return result, autorest.NewErrorWithError(err, "batch.ApplicationOperationsClient", "Delete", resp, "Failure sending request") + return result, autorest.NewErrorWithError(err, "batch.ApplicationClient", "Delete", resp, "Failure sending request") } result, err = client.DeleteResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "batch.ApplicationOperationsClient", "Delete", resp, "Failure responding to request") + err = autorest.NewErrorWithError(err, "batch.ApplicationClient", "Delete", resp, "Failure responding to request") } return } // DeletePreparer prepares the Delete request. -func (client ApplicationOperationsClient) DeletePreparer(resourceGroupName string, accountName string, applicationID string) (*http.Request, error) { +func (client ApplicationClient) DeletePreparer(resourceGroupName string, accountName string, applicationID string) (*http.Request, error) { pathParameters := map[string]interface{}{ "accountName": autorest.Encode("path", accountName), "applicationId": autorest.Encode("path", applicationID), @@ -167,8 +167,9 @@ func (client ApplicationOperationsClient) DeletePreparer(resourceGroupName strin "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2017-01-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -181,13 +182,13 @@ func (client ApplicationOperationsClient) DeletePreparer(resourceGroupName strin // DeleteSender sends the Delete request. The method will close the // http.Response Body if it receives an error. -func (client ApplicationOperationsClient) DeleteSender(req *http.Request) (*http.Response, error) { +func (client ApplicationClient) DeleteSender(req *http.Request) (*http.Response, error) { return autorest.SendWithSender(client, req) } // DeleteResponder handles the response to the Delete request. The method always // closes the http.Response Body. -func (client ApplicationOperationsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { +func (client ApplicationClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { err = autorest.Respond( resp, client.ByInspecting(), @@ -200,9 +201,9 @@ func (client ApplicationOperationsClient) DeleteResponder(resp *http.Response) ( // Get gets information about the specified application. // // resourceGroupName is the name of the resource group that contains the Batch -// account. accountName is the name of the Batch account. applicationID is -// the ID of the application. -func (client ApplicationOperationsClient) Get(resourceGroupName string, accountName string, applicationID string) (result Application, err error) { +// account. accountName is the name of the Batch account. applicationID is the +// ID of the application. +func (client ApplicationClient) Get(resourceGroupName string, accountName string, applicationID string) (result Application, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: resourceGroupName, Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}, @@ -210,30 +211,30 @@ func (client ApplicationOperationsClient) Get(resourceGroupName string, accountN Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, {Target: "accountName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "batch.ApplicationOperationsClient", "Get") + return result, validation.NewErrorWithValidationError(err, "batch.ApplicationClient", "Get") } req, err := client.GetPreparer(resourceGroupName, accountName, applicationID) if err != nil { - return result, autorest.NewErrorWithError(err, "batch.ApplicationOperationsClient", "Get", nil, "Failure preparing request") + return result, autorest.NewErrorWithError(err, "batch.ApplicationClient", "Get", nil, "Failure preparing request") } resp, err := client.GetSender(req) if err != nil { result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "batch.ApplicationOperationsClient", "Get", resp, "Failure sending request") + return result, autorest.NewErrorWithError(err, "batch.ApplicationClient", "Get", resp, "Failure sending request") } result, err = client.GetResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "batch.ApplicationOperationsClient", "Get", resp, "Failure responding to request") + err = autorest.NewErrorWithError(err, "batch.ApplicationClient", "Get", resp, "Failure responding to request") } return } // GetPreparer prepares the Get request. -func (client ApplicationOperationsClient) GetPreparer(resourceGroupName string, accountName string, applicationID string) (*http.Request, error) { +func (client ApplicationClient) GetPreparer(resourceGroupName string, accountName string, applicationID string) (*http.Request, error) { pathParameters := map[string]interface{}{ "accountName": autorest.Encode("path", accountName), "applicationId": autorest.Encode("path", applicationID), @@ -241,8 +242,9 @@ func (client ApplicationOperationsClient) GetPreparer(resourceGroupName string, "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2017-01-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -255,13 +257,13 @@ func (client ApplicationOperationsClient) GetPreparer(resourceGroupName string, // GetSender sends the Get request. The method will close the // http.Response Body if it receives an error. -func (client ApplicationOperationsClient) GetSender(req *http.Request) (*http.Response, error) { +func (client ApplicationClient) GetSender(req *http.Request) (*http.Response, error) { return autorest.SendWithSender(client, req) } // GetResponder handles the response to the Get request. The method always // closes the http.Response Body. -func (client ApplicationOperationsClient) GetResponder(resp *http.Response) (result Application, err error) { +func (client ApplicationClient) GetResponder(resp *http.Response) (result Application, err error) { err = autorest.Respond( resp, client.ByInspecting(), @@ -277,7 +279,7 @@ func (client ApplicationOperationsClient) GetResponder(resp *http.Response) (res // resourceGroupName is the name of the resource group that contains the Batch // account. accountName is the name of the Batch account. maxresults is the // maximum number of items to return in the response. -func (client ApplicationOperationsClient) List(resourceGroupName string, accountName string, maxresults *int32) (result ListApplicationsResult, err error) { +func (client ApplicationClient) List(resourceGroupName string, accountName string, maxresults *int32) (result ListApplicationsResult, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: resourceGroupName, Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}, @@ -285,38 +287,39 @@ func (client ApplicationOperationsClient) List(resourceGroupName string, account Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, {Target: "accountName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "batch.ApplicationOperationsClient", "List") + return result, validation.NewErrorWithValidationError(err, "batch.ApplicationClient", "List") } req, err := client.ListPreparer(resourceGroupName, accountName, maxresults) if err != nil { - return result, autorest.NewErrorWithError(err, "batch.ApplicationOperationsClient", "List", nil, "Failure preparing request") + return result, autorest.NewErrorWithError(err, "batch.ApplicationClient", "List", nil, "Failure preparing request") } resp, err := client.ListSender(req) if err != nil { result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "batch.ApplicationOperationsClient", "List", resp, "Failure sending request") + return result, autorest.NewErrorWithError(err, "batch.ApplicationClient", "List", resp, "Failure sending request") } result, err = client.ListResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "batch.ApplicationOperationsClient", "List", resp, "Failure responding to request") + err = autorest.NewErrorWithError(err, "batch.ApplicationClient", "List", resp, "Failure responding to request") } return } // ListPreparer prepares the List request. -func (client ApplicationOperationsClient) ListPreparer(resourceGroupName string, accountName string, maxresults *int32) (*http.Request, error) { +func (client ApplicationClient) ListPreparer(resourceGroupName string, accountName string, maxresults *int32) (*http.Request, error) { pathParameters := map[string]interface{}{ "accountName": autorest.Encode("path", accountName), "resourceGroupName": autorest.Encode("path", resourceGroupName), "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2017-01-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } if maxresults != nil { queryParameters["maxresults"] = autorest.Encode("query", *maxresults) @@ -332,13 +335,13 @@ func (client ApplicationOperationsClient) ListPreparer(resourceGroupName string, // ListSender sends the List request. The method will close the // http.Response Body if it receives an error. -func (client ApplicationOperationsClient) ListSender(req *http.Request) (*http.Response, error) { +func (client ApplicationClient) ListSender(req *http.Request) (*http.Response, error) { return autorest.SendWithSender(client, req) } // ListResponder handles the response to the List request. The method always // closes the http.Response Body. -func (client ApplicationOperationsClient) ListResponder(resp *http.Response) (result ListApplicationsResult, err error) { +func (client ApplicationClient) ListResponder(resp *http.Response) (result ListApplicationsResult, err error) { err = autorest.Respond( resp, client.ByInspecting(), @@ -350,10 +353,10 @@ func (client ApplicationOperationsClient) ListResponder(resp *http.Response) (re } // ListNextResults retrieves the next set of results, if any. -func (client ApplicationOperationsClient) ListNextResults(lastResults ListApplicationsResult) (result ListApplicationsResult, err error) { +func (client ApplicationClient) ListNextResults(lastResults ListApplicationsResult) (result ListApplicationsResult, err error) { req, err := lastResults.ListApplicationsResultPreparer() if err != nil { - return result, autorest.NewErrorWithError(err, "batch.ApplicationOperationsClient", "List", nil, "Failure preparing next results request") + return result, autorest.NewErrorWithError(err, "batch.ApplicationClient", "List", nil, "Failure preparing next results request") } if req == nil { return @@ -362,12 +365,12 @@ func (client ApplicationOperationsClient) ListNextResults(lastResults ListApplic resp, err := client.ListSender(req) if err != nil { result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "batch.ApplicationOperationsClient", "List", resp, "Failure sending next results request") + return result, autorest.NewErrorWithError(err, "batch.ApplicationClient", "List", resp, "Failure sending next results request") } result, err = client.ListResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "batch.ApplicationOperationsClient", "List", resp, "Failure responding to next results request") + err = autorest.NewErrorWithError(err, "batch.ApplicationClient", "List", resp, "Failure responding to next results request") } return @@ -376,9 +379,9 @@ func (client ApplicationOperationsClient) ListNextResults(lastResults ListApplic // Update updates settings for the specified application. // // resourceGroupName is the name of the resource group that contains the Batch -// account. accountName is the name of the Batch account. applicationID is -// the ID of the application. parameters is the parameters for the request. -func (client ApplicationOperationsClient) Update(resourceGroupName string, accountName string, applicationID string, parameters UpdateApplicationParameters) (result autorest.Response, err error) { +// account. accountName is the name of the Batch account. applicationID is the +// ID of the application. parameters is the parameters for the request. +func (client ApplicationClient) Update(resourceGroupName string, accountName string, applicationID string, parameters UpdateApplicationParameters) (result autorest.Response, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: resourceGroupName, Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}, @@ -386,30 +389,30 @@ func (client ApplicationOperationsClient) Update(resourceGroupName string, accou Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, {Target: "accountName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "batch.ApplicationOperationsClient", "Update") + return result, validation.NewErrorWithValidationError(err, "batch.ApplicationClient", "Update") } req, err := client.UpdatePreparer(resourceGroupName, accountName, applicationID, parameters) if err != nil { - return result, autorest.NewErrorWithError(err, "batch.ApplicationOperationsClient", "Update", nil, "Failure preparing request") + return result, autorest.NewErrorWithError(err, "batch.ApplicationClient", "Update", nil, "Failure preparing request") } resp, err := client.UpdateSender(req) if err != nil { result.Response = resp - return result, autorest.NewErrorWithError(err, "batch.ApplicationOperationsClient", "Update", resp, "Failure sending request") + return result, autorest.NewErrorWithError(err, "batch.ApplicationClient", "Update", resp, "Failure sending request") } result, err = client.UpdateResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "batch.ApplicationOperationsClient", "Update", resp, "Failure responding to request") + err = autorest.NewErrorWithError(err, "batch.ApplicationClient", "Update", resp, "Failure responding to request") } return } // UpdatePreparer prepares the Update request. -func (client ApplicationOperationsClient) UpdatePreparer(resourceGroupName string, accountName string, applicationID string, parameters UpdateApplicationParameters) (*http.Request, error) { +func (client ApplicationClient) UpdatePreparer(resourceGroupName string, accountName string, applicationID string, parameters UpdateApplicationParameters) (*http.Request, error) { pathParameters := map[string]interface{}{ "accountName": autorest.Encode("path", accountName), "applicationId": autorest.Encode("path", applicationID), @@ -417,8 +420,9 @@ func (client ApplicationOperationsClient) UpdatePreparer(resourceGroupName strin "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2017-01-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -433,13 +437,13 @@ func (client ApplicationOperationsClient) UpdatePreparer(resourceGroupName strin // UpdateSender sends the Update request. The method will close the // http.Response Body if it receives an error. -func (client ApplicationOperationsClient) UpdateSender(req *http.Request) (*http.Response, error) { +func (client ApplicationClient) UpdateSender(req *http.Request) (*http.Response, error) { return autorest.SendWithSender(client, req) } // UpdateResponder handles the response to the Update request. The method always // closes the http.Response Body. -func (client ApplicationOperationsClient) UpdateResponder(resp *http.Response) (result autorest.Response, err error) { +func (client ApplicationClient) UpdateResponder(resp *http.Response) (result autorest.Response, err error) { err = autorest.Respond( resp, client.ByInspecting(), diff --git a/arm/batch/applicationpackageoperations.go b/arm/batch/applicationpackage.go old mode 100644 new mode 100755 similarity index 71% rename from arm/batch/applicationpackageoperations.go rename to arm/batch/applicationpackage.go index 84fb2830268e..3ce3f2ebdcc8 --- a/arm/batch/applicationpackageoperations.go +++ b/arm/batch/applicationpackage.go @@ -14,7 +14,7 @@ package batch // See the License for the specific language governing permissions and // limitations under the License. // -// Code generated by Microsoft (R) AutoRest Code Generator 0.17.0.0 +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 // Changes may cause incorrect behavior and will be lost if the code is // regenerated. @@ -25,31 +25,31 @@ import ( "net/http" ) -// ApplicationPackageOperationsClient is the client for the -// ApplicationPackageOperations methods of the Batch service. -type ApplicationPackageOperationsClient struct { +// ApplicationPackageClient is the client for the ApplicationPackage methods of +// the Batch service. +type ApplicationPackageClient struct { ManagementClient } -// NewApplicationPackageOperationsClient creates an instance of the -// ApplicationPackageOperationsClient client. -func NewApplicationPackageOperationsClient(subscriptionID string) ApplicationPackageOperationsClient { - return NewApplicationPackageOperationsClientWithBaseURI(DefaultBaseURI, subscriptionID) +// NewApplicationPackageClient creates an instance of the +// ApplicationPackageClient client. +func NewApplicationPackageClient(subscriptionID string) ApplicationPackageClient { + return NewApplicationPackageClientWithBaseURI(DefaultBaseURI, subscriptionID) } -// NewApplicationPackageOperationsClientWithBaseURI creates an instance of the -// ApplicationPackageOperationsClient client. -func NewApplicationPackageOperationsClientWithBaseURI(baseURI string, subscriptionID string) ApplicationPackageOperationsClient { - return ApplicationPackageOperationsClient{NewWithBaseURI(baseURI, subscriptionID)} +// NewApplicationPackageClientWithBaseURI creates an instance of the +// ApplicationPackageClient client. +func NewApplicationPackageClientWithBaseURI(baseURI string, subscriptionID string) ApplicationPackageClient { + return ApplicationPackageClient{NewWithBaseURI(baseURI, subscriptionID)} } // Activate activates the specified application package. // // resourceGroupName is the name of the resource group that contains the Batch -// account. accountName is the name of the Batch account. applicationID is -// the ID of the application. version is the version of the application to +// account. accountName is the name of the Batch account. applicationID is the +// ID of the application. version is the version of the application to // activate. parameters is the parameters for the request. -func (client ApplicationPackageOperationsClient) Activate(resourceGroupName string, accountName string, applicationID string, version string, parameters ActivateApplicationPackageParameters) (result autorest.Response, err error) { +func (client ApplicationPackageClient) Activate(resourceGroupName string, accountName string, applicationID string, version string, parameters ActivateApplicationPackageParameters) (result autorest.Response, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: resourceGroupName, Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}, @@ -59,30 +59,30 @@ func (client ApplicationPackageOperationsClient) Activate(resourceGroupName stri {Target: "accountName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}, {TargetValue: parameters, Constraints: []validation.Constraint{{Target: "parameters.Format", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "batch.ApplicationPackageOperationsClient", "Activate") + return result, validation.NewErrorWithValidationError(err, "batch.ApplicationPackageClient", "Activate") } req, err := client.ActivatePreparer(resourceGroupName, accountName, applicationID, version, parameters) if err != nil { - return result, autorest.NewErrorWithError(err, "batch.ApplicationPackageOperationsClient", "Activate", nil, "Failure preparing request") + return result, autorest.NewErrorWithError(err, "batch.ApplicationPackageClient", "Activate", nil, "Failure preparing request") } resp, err := client.ActivateSender(req) if err != nil { result.Response = resp - return result, autorest.NewErrorWithError(err, "batch.ApplicationPackageOperationsClient", "Activate", resp, "Failure sending request") + return result, autorest.NewErrorWithError(err, "batch.ApplicationPackageClient", "Activate", resp, "Failure sending request") } result, err = client.ActivateResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "batch.ApplicationPackageOperationsClient", "Activate", resp, "Failure responding to request") + err = autorest.NewErrorWithError(err, "batch.ApplicationPackageClient", "Activate", resp, "Failure responding to request") } return } // ActivatePreparer prepares the Activate request. -func (client ApplicationPackageOperationsClient) ActivatePreparer(resourceGroupName string, accountName string, applicationID string, version string, parameters ActivateApplicationPackageParameters) (*http.Request, error) { +func (client ApplicationPackageClient) ActivatePreparer(resourceGroupName string, accountName string, applicationID string, version string, parameters ActivateApplicationPackageParameters) (*http.Request, error) { pathParameters := map[string]interface{}{ "accountName": autorest.Encode("path", accountName), "applicationId": autorest.Encode("path", applicationID), @@ -91,8 +91,9 @@ func (client ApplicationPackageOperationsClient) ActivatePreparer(resourceGroupN "version": autorest.Encode("path", version), } + const APIVersion = "2017-01-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -107,13 +108,13 @@ func (client ApplicationPackageOperationsClient) ActivatePreparer(resourceGroupN // ActivateSender sends the Activate request. The method will close the // http.Response Body if it receives an error. -func (client ApplicationPackageOperationsClient) ActivateSender(req *http.Request) (*http.Response, error) { +func (client ApplicationPackageClient) ActivateSender(req *http.Request) (*http.Response, error) { return autorest.SendWithSender(client, req) } // ActivateResponder handles the response to the Activate request. The method always // closes the http.Response Body. -func (client ApplicationPackageOperationsClient) ActivateResponder(resp *http.Response) (result autorest.Response, err error) { +func (client ApplicationPackageClient) ActivateResponder(resp *http.Response) (result autorest.Response, err error) { err = autorest.Respond( resp, client.ByInspecting(), @@ -126,9 +127,9 @@ func (client ApplicationPackageOperationsClient) ActivateResponder(resp *http.Re // Create creates an application package record. // // resourceGroupName is the name of the resource group that contains the Batch -// account. accountName is the name of the Batch account. applicationID is -// the ID of the application. version is the version of the application. -func (client ApplicationPackageOperationsClient) Create(resourceGroupName string, accountName string, applicationID string, version string) (result ApplicationPackage, err error) { +// account. accountName is the name of the Batch account. applicationID is the +// ID of the application. version is the version of the application. +func (client ApplicationPackageClient) Create(resourceGroupName string, accountName string, applicationID string, version string) (result ApplicationPackage, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: resourceGroupName, Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}, @@ -136,30 +137,30 @@ func (client ApplicationPackageOperationsClient) Create(resourceGroupName string Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, {Target: "accountName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "batch.ApplicationPackageOperationsClient", "Create") + return result, validation.NewErrorWithValidationError(err, "batch.ApplicationPackageClient", "Create") } req, err := client.CreatePreparer(resourceGroupName, accountName, applicationID, version) if err != nil { - return result, autorest.NewErrorWithError(err, "batch.ApplicationPackageOperationsClient", "Create", nil, "Failure preparing request") + return result, autorest.NewErrorWithError(err, "batch.ApplicationPackageClient", "Create", nil, "Failure preparing request") } resp, err := client.CreateSender(req) if err != nil { result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "batch.ApplicationPackageOperationsClient", "Create", resp, "Failure sending request") + return result, autorest.NewErrorWithError(err, "batch.ApplicationPackageClient", "Create", resp, "Failure sending request") } result, err = client.CreateResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "batch.ApplicationPackageOperationsClient", "Create", resp, "Failure responding to request") + err = autorest.NewErrorWithError(err, "batch.ApplicationPackageClient", "Create", resp, "Failure responding to request") } return } // CreatePreparer prepares the Create request. -func (client ApplicationPackageOperationsClient) CreatePreparer(resourceGroupName string, accountName string, applicationID string, version string) (*http.Request, error) { +func (client ApplicationPackageClient) CreatePreparer(resourceGroupName string, accountName string, applicationID string, version string) (*http.Request, error) { pathParameters := map[string]interface{}{ "accountName": autorest.Encode("path", accountName), "applicationId": autorest.Encode("path", applicationID), @@ -168,8 +169,9 @@ func (client ApplicationPackageOperationsClient) CreatePreparer(resourceGroupNam "version": autorest.Encode("path", version), } + const APIVersion = "2017-01-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -182,13 +184,13 @@ func (client ApplicationPackageOperationsClient) CreatePreparer(resourceGroupNam // CreateSender sends the Create request. The method will close the // http.Response Body if it receives an error. -func (client ApplicationPackageOperationsClient) CreateSender(req *http.Request) (*http.Response, error) { +func (client ApplicationPackageClient) CreateSender(req *http.Request) (*http.Response, error) { return autorest.SendWithSender(client, req) } // CreateResponder handles the response to the Create request. The method always // closes the http.Response Body. -func (client ApplicationPackageOperationsClient) CreateResponder(resp *http.Response) (result ApplicationPackage, err error) { +func (client ApplicationPackageClient) CreateResponder(resp *http.Response) (result ApplicationPackage, err error) { err = autorest.Respond( resp, client.ByInspecting(), @@ -202,10 +204,9 @@ func (client ApplicationPackageOperationsClient) CreateResponder(resp *http.Resp // Delete deletes an application package record and its associated binary file. // // resourceGroupName is the name of the resource group that contains the Batch -// account. accountName is the name of the Batch account. applicationID is -// the ID of the application. version is the version of the application to -// delete. -func (client ApplicationPackageOperationsClient) Delete(resourceGroupName string, accountName string, applicationID string, version string) (result autorest.Response, err error) { +// account. accountName is the name of the Batch account. applicationID is the +// ID of the application. version is the version of the application to delete. +func (client ApplicationPackageClient) Delete(resourceGroupName string, accountName string, applicationID string, version string) (result autorest.Response, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: resourceGroupName, Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}, @@ -213,30 +214,30 @@ func (client ApplicationPackageOperationsClient) Delete(resourceGroupName string Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, {Target: "accountName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "batch.ApplicationPackageOperationsClient", "Delete") + return result, validation.NewErrorWithValidationError(err, "batch.ApplicationPackageClient", "Delete") } req, err := client.DeletePreparer(resourceGroupName, accountName, applicationID, version) if err != nil { - return result, autorest.NewErrorWithError(err, "batch.ApplicationPackageOperationsClient", "Delete", nil, "Failure preparing request") + return result, autorest.NewErrorWithError(err, "batch.ApplicationPackageClient", "Delete", nil, "Failure preparing request") } resp, err := client.DeleteSender(req) if err != nil { result.Response = resp - return result, autorest.NewErrorWithError(err, "batch.ApplicationPackageOperationsClient", "Delete", resp, "Failure sending request") + return result, autorest.NewErrorWithError(err, "batch.ApplicationPackageClient", "Delete", resp, "Failure sending request") } result, err = client.DeleteResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "batch.ApplicationPackageOperationsClient", "Delete", resp, "Failure responding to request") + err = autorest.NewErrorWithError(err, "batch.ApplicationPackageClient", "Delete", resp, "Failure responding to request") } return } // DeletePreparer prepares the Delete request. -func (client ApplicationPackageOperationsClient) DeletePreparer(resourceGroupName string, accountName string, applicationID string, version string) (*http.Request, error) { +func (client ApplicationPackageClient) DeletePreparer(resourceGroupName string, accountName string, applicationID string, version string) (*http.Request, error) { pathParameters := map[string]interface{}{ "accountName": autorest.Encode("path", accountName), "applicationId": autorest.Encode("path", applicationID), @@ -245,8 +246,9 @@ func (client ApplicationPackageOperationsClient) DeletePreparer(resourceGroupNam "version": autorest.Encode("path", version), } + const APIVersion = "2017-01-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -259,13 +261,13 @@ func (client ApplicationPackageOperationsClient) DeletePreparer(resourceGroupNam // DeleteSender sends the Delete request. The method will close the // http.Response Body if it receives an error. -func (client ApplicationPackageOperationsClient) DeleteSender(req *http.Request) (*http.Response, error) { +func (client ApplicationPackageClient) DeleteSender(req *http.Request) (*http.Response, error) { return autorest.SendWithSender(client, req) } // DeleteResponder handles the response to the Delete request. The method always // closes the http.Response Body. -func (client ApplicationPackageOperationsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { +func (client ApplicationPackageClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { err = autorest.Respond( resp, client.ByInspecting(), @@ -278,9 +280,9 @@ func (client ApplicationPackageOperationsClient) DeleteResponder(resp *http.Resp // Get gets information about the specified application package. // // resourceGroupName is the name of the resource group that contains the Batch -// account. accountName is the name of the Batch account. applicationID is -// the ID of the application. version is the version of the application. -func (client ApplicationPackageOperationsClient) Get(resourceGroupName string, accountName string, applicationID string, version string) (result ApplicationPackage, err error) { +// account. accountName is the name of the Batch account. applicationID is the +// ID of the application. version is the version of the application. +func (client ApplicationPackageClient) Get(resourceGroupName string, accountName string, applicationID string, version string) (result ApplicationPackage, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: resourceGroupName, Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}, @@ -288,30 +290,30 @@ func (client ApplicationPackageOperationsClient) Get(resourceGroupName string, a Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, {Target: "accountName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "batch.ApplicationPackageOperationsClient", "Get") + return result, validation.NewErrorWithValidationError(err, "batch.ApplicationPackageClient", "Get") } req, err := client.GetPreparer(resourceGroupName, accountName, applicationID, version) if err != nil { - return result, autorest.NewErrorWithError(err, "batch.ApplicationPackageOperationsClient", "Get", nil, "Failure preparing request") + return result, autorest.NewErrorWithError(err, "batch.ApplicationPackageClient", "Get", nil, "Failure preparing request") } resp, err := client.GetSender(req) if err != nil { result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "batch.ApplicationPackageOperationsClient", "Get", resp, "Failure sending request") + return result, autorest.NewErrorWithError(err, "batch.ApplicationPackageClient", "Get", resp, "Failure sending request") } result, err = client.GetResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "batch.ApplicationPackageOperationsClient", "Get", resp, "Failure responding to request") + err = autorest.NewErrorWithError(err, "batch.ApplicationPackageClient", "Get", resp, "Failure responding to request") } return } // GetPreparer prepares the Get request. -func (client ApplicationPackageOperationsClient) GetPreparer(resourceGroupName string, accountName string, applicationID string, version string) (*http.Request, error) { +func (client ApplicationPackageClient) GetPreparer(resourceGroupName string, accountName string, applicationID string, version string) (*http.Request, error) { pathParameters := map[string]interface{}{ "accountName": autorest.Encode("path", accountName), "applicationId": autorest.Encode("path", applicationID), @@ -320,8 +322,9 @@ func (client ApplicationPackageOperationsClient) GetPreparer(resourceGroupName s "version": autorest.Encode("path", version), } + const APIVersion = "2017-01-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -334,13 +337,13 @@ func (client ApplicationPackageOperationsClient) GetPreparer(resourceGroupName s // GetSender sends the Get request. The method will close the // http.Response Body if it receives an error. -func (client ApplicationPackageOperationsClient) GetSender(req *http.Request) (*http.Response, error) { +func (client ApplicationPackageClient) GetSender(req *http.Request) (*http.Response, error) { return autorest.SendWithSender(client, req) } // GetResponder handles the response to the Get request. The method always // closes the http.Response Body. -func (client ApplicationPackageOperationsClient) GetResponder(resp *http.Response) (result ApplicationPackage, err error) { +func (client ApplicationPackageClient) GetResponder(resp *http.Response) (result ApplicationPackage, err error) { err = autorest.Respond( resp, client.ByInspecting(), diff --git a/arm/batch/client.go b/arm/batch/client.go old mode 100644 new mode 100755 index 418b1bf09720..e5e5c9d8e0fa --- a/arm/batch/client.go +++ b/arm/batch/client.go @@ -1,4 +1,5 @@ -// Package batch implements the Azure ARM Batch service API version 2015-12-01. +// Package batch implements the Azure ARM Batch service API version 2017-01-01. +// // package batch @@ -16,7 +17,7 @@ package batch // See the License for the specific language governing permissions and // limitations under the License. // -// Code generated by Microsoft (R) AutoRest Code Generator 0.17.0.0 +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 // Changes may cause incorrect behavior and will be lost if the code is // regenerated. @@ -25,9 +26,6 @@ import ( ) const ( - // APIVersion is the version of the Batch - APIVersion = "2015-12-01" - // DefaultBaseURI is the default URI used for the service Batch DefaultBaseURI = "https://management.azure.com" ) @@ -36,7 +34,6 @@ const ( type ManagementClient struct { autorest.Client BaseURI string - APIVersion string SubscriptionID string } @@ -50,7 +47,6 @@ func NewWithBaseURI(baseURI string, subscriptionID string) ManagementClient { return ManagementClient{ Client: autorest.NewClientWithUserAgent(UserAgent()), BaseURI: baseURI, - APIVersion: APIVersion, SubscriptionID: subscriptionID, } } diff --git a/arm/batch/location.go b/arm/batch/location.go old mode 100644 new mode 100755 index a639e766e3e2..1d815902282e --- a/arm/batch/location.go +++ b/arm/batch/location.go @@ -14,7 +14,7 @@ package batch // See the License for the specific language governing permissions and // limitations under the License. // -// Code generated by Microsoft (R) AutoRest Code Generator 0.17.0.0 +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 // Changes may cause incorrect behavior and will be lost if the code is // regenerated. @@ -71,8 +71,9 @@ func (client LocationClient) GetQuotasPreparer(locationName string) (*http.Reque "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2017-01-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( diff --git a/arm/batch/models.go b/arm/batch/models.go old mode 100644 new mode 100755 index 09f050da66f4..8573f5005b7f --- a/arm/batch/models.go +++ b/arm/batch/models.go @@ -14,7 +14,7 @@ package batch // See the License for the specific language governing permissions and // limitations under the License. // -// Code generated by Microsoft (R) AutoRest Code Generator 0.17.0.0 +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 // Changes may cause incorrect behavior and will be lost if the code is // regenerated. @@ -47,6 +47,17 @@ const ( Unmapped PackageState = "unmapped" ) +// PoolAllocationMode enumerates the values for pool allocation mode. +type PoolAllocationMode string + +const ( + // BatchService specifies the batch service state for pool allocation mode. + BatchService PoolAllocationMode = "BatchService" + // UserSubscription specifies the user subscription state for pool + // allocation mode. + UserSubscription PoolAllocationMode = "UserSubscription" +) + // ProvisioningState enumerates the values for provisioning state. type ProvisioningState string @@ -78,7 +89,9 @@ type Account struct { // AccountBaseProperties is the properties of a Batch account. type AccountBaseProperties struct { - AutoStorage *AutoStorageBaseProperties `json:"autoStorage,omitempty"` + AutoStorage *AutoStorageBaseProperties `json:"autoStorage,omitempty"` + PoolAllocationMode PoolAllocationMode `json:"poolAllocationMode,omitempty"` + KeyVaultReference *KeyVaultReference `json:"keyVaultReference,omitempty"` } // AccountCreateParameters is parameters supplied to the Create operation. @@ -118,6 +131,8 @@ func (client AccountListResult) AccountListResultPreparer() (*http.Request, erro type AccountProperties struct { AccountEndpoint *string `json:"accountEndpoint,omitempty"` ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + PoolAllocationMode PoolAllocationMode `json:"poolAllocationMode,omitempty"` + KeyVaultReference *KeyVaultReference `json:"keyVaultReference,omitempty"` AutoStorage *AutoStorageProperties `json:"autoStorage,omitempty"` CoreQuota *int32 `json:"coreQuota,omitempty"` PoolQuota *int32 `json:"poolQuota,omitempty"` @@ -130,10 +145,15 @@ type AccountRegenerateKeyParameters struct { KeyName AccountKeyType `json:"keyName,omitempty"` } +// AccountUpdateBaseProperties is the properties for a Batch account update. +type AccountUpdateBaseProperties struct { + AutoStorage *AutoStorageBaseProperties `json:"autoStorage,omitempty"` +} + // AccountUpdateParameters is parameters supplied to the Update operation. type AccountUpdateParameters struct { - Tags *map[string]*string `json:"tags,omitempty"` - *AccountBaseProperties `json:"properties,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + *AccountUpdateBaseProperties `json:"properties,omitempty"` } // ActivateApplicationPackageParameters is parameters for an @@ -177,26 +197,26 @@ type AutoStorageBaseProperties struct { StorageAccountID *string `json:"storageAccountId,omitempty"` } -// AutoStorageProperties is contains information about the auto storage -// account associated with a Batch account. +// AutoStorageProperties is contains information about the auto storage account +// associated with a Batch account. type AutoStorageProperties struct { StorageAccountID *string `json:"storageAccountId,omitempty"` LastKeySync *date.Time `json:"lastKeySync,omitempty"` } -// ErrorBody is an error response from the Batch service. -type ErrorBody struct { - Code *string `json:"code,omitempty"` - Message *string `json:"message,omitempty"` - Target *string `json:"target,omitempty"` - Details *[]ErrorDetail `json:"details,omitempty"` +// CloudError is an error response from the Batch service. +type CloudError struct { + Code *string `json:"code,omitempty"` + Message *string `json:"message,omitempty"` + Target *string `json:"target,omitempty"` + Details *[]CloudError `json:"details,omitempty"` } -// ErrorDetail is specific detail about an error. -type ErrorDetail struct { - Code *string `json:"code,omitempty"` - Message *string `json:"message,omitempty"` - Target *string `json:"target,omitempty"` +// KeyVaultReference is identifies the Azure key vault associated with a Batch +// account. +type KeyVaultReference struct { + ID *string `json:"id,omitempty"` + URL *string `json:"url,omitempty"` } // ListApplicationsResult is response to an diff --git a/arm/batch/version.go b/arm/batch/version.go old mode 100644 new mode 100755 index 95af5d1a81ea..a7f35295073c --- a/arm/batch/version.go +++ b/arm/batch/version.go @@ -18,43 +18,12 @@ package batch // Changes may cause incorrect behavior and will be lost if the code is // regenerated. -import ( - "bytes" - "fmt" - "strings" -) - -const ( - major = "8" - minor = "1" - patch = "0" - tag = "beta" - userAgentFormat = "Azure-SDK-For-Go/%s arm-%s/%s" -) - -// cached results of UserAgent and Version to prevent repeated operations. -var ( - userAgent string - version string -) - // UserAgent returns the UserAgent string to use when sending http.Requests. func UserAgent() string { - if userAgent == "" { - userAgent = fmt.Sprintf(userAgentFormat, Version(), "batch", "2015-12-01") - } - return userAgent + return "Azure-SDK-For-Go/v9.0.0-beta arm-batch/2017-01-01" } // Version returns the semantic version (see http://semver.org) of the client. func Version() string { - if version == "" { - versionBuilder := bytes.NewBufferString(fmt.Sprintf("%s.%s.%s", major, minor, patch)) - if tag != "" { - versionBuilder.WriteRune('-') - versionBuilder.WriteString(strings.TrimPrefix(tag, "-")) - } - version = string(versionBuilder.Bytes()) - } - return version + return "v9.0.0-beta" } diff --git a/arm/cdn/client.go b/arm/cdn/client.go old mode 100644 new mode 100755 index 607a659db12d..ddcd786874bd --- a/arm/cdn/client.go +++ b/arm/cdn/client.go @@ -19,7 +19,7 @@ package cdn // See the License for the specific language governing permissions and // limitations under the License. // -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.0 +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 // Changes may cause incorrect behavior and will be lost if the code is // regenerated. @@ -31,9 +31,6 @@ import ( ) const ( - // APIVersion is the version of the Cdn - APIVersion = "2016-10-02" - // DefaultBaseURI is the default URI used for the service Cdn DefaultBaseURI = "https://management.azure.com" ) @@ -42,7 +39,6 @@ const ( type ManagementClient struct { autorest.Client BaseURI string - APIVersion string SubscriptionID string } @@ -56,7 +52,6 @@ func NewWithBaseURI(baseURI string, subscriptionID string) ManagementClient { return ManagementClient{ Client: autorest.NewClientWithUserAgent(UserAgent()), BaseURI: baseURI, - APIVersion: APIVersion, SubscriptionID: subscriptionID, } } @@ -94,8 +89,9 @@ func (client ManagementClient) CheckNameAvailability(checkNameAvailabilityInput // CheckNameAvailabilityPreparer prepares the CheckNameAvailability request. func (client ManagementClient) CheckNameAvailabilityPreparer(checkNameAvailabilityInput CheckNameAvailabilityInput) (*http.Request, error) { + const APIVersion = "2016-10-02" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -127,55 +123,51 @@ func (client ManagementClient) CheckNameAvailabilityResponder(resp *http.Respons return } -// CheckResourceUsage check the quota and actual usage of the CDN profiles -// under the given subscription. -func (client ManagementClient) CheckResourceUsage() (result ResourceUsageListResult, err error) { - req, err := client.CheckResourceUsagePreparer() +// ListOperations lists all of the available CDN REST API operations. +func (client ManagementClient) ListOperations() (result OperationListResult, err error) { + req, err := client.ListOperationsPreparer() if err != nil { - return result, autorest.NewErrorWithError(err, "cdn.ManagementClient", "CheckResourceUsage", nil, "Failure preparing request") + return result, autorest.NewErrorWithError(err, "cdn.ManagementClient", "ListOperations", nil, "Failure preparing request") } - resp, err := client.CheckResourceUsageSender(req) + resp, err := client.ListOperationsSender(req) if err != nil { result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "cdn.ManagementClient", "CheckResourceUsage", resp, "Failure sending request") + return result, autorest.NewErrorWithError(err, "cdn.ManagementClient", "ListOperations", resp, "Failure sending request") } - result, err = client.CheckResourceUsageResponder(resp) + result, err = client.ListOperationsResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "cdn.ManagementClient", "CheckResourceUsage", resp, "Failure responding to request") + err = autorest.NewErrorWithError(err, "cdn.ManagementClient", "ListOperations", resp, "Failure responding to request") } return } -// CheckResourceUsagePreparer prepares the CheckResourceUsage request. -func (client ManagementClient) CheckResourceUsagePreparer() (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - +// ListOperationsPreparer prepares the ListOperations request. +func (client ManagementClient) ListOperationsPreparer() (*http.Request, error) { + const APIVersion = "2016-10-02" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( - autorest.AsPost(), + autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Cdn/checkResourceUsage", pathParameters), + autorest.WithPath("/providers/Microsoft.Cdn/operations"), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare(&http.Request{}) } -// CheckResourceUsageSender sends the CheckResourceUsage request. The method will close the +// ListOperationsSender sends the ListOperations request. The method will close the // http.Response Body if it receives an error. -func (client ManagementClient) CheckResourceUsageSender(req *http.Request) (*http.Response, error) { +func (client ManagementClient) ListOperationsSender(req *http.Request) (*http.Response, error) { return autorest.SendWithSender(client, req) } -// CheckResourceUsageResponder handles the response to the CheckResourceUsage request. The method always +// ListOperationsResponder handles the response to the ListOperations request. The method always // closes the http.Response Body. -func (client ManagementClient) CheckResourceUsageResponder(resp *http.Response) (result ResourceUsageListResult, err error) { +func (client ManagementClient) ListOperationsResponder(resp *http.Response) (result OperationListResult, err error) { err = autorest.Respond( resp, client.ByInspecting(), @@ -186,74 +178,80 @@ func (client ManagementClient) CheckResourceUsageResponder(resp *http.Response) return } -// CheckResourceUsageNextResults retrieves the next set of results, if any. -func (client ManagementClient) CheckResourceUsageNextResults(lastResults ResourceUsageListResult) (result ResourceUsageListResult, err error) { - req, err := lastResults.ResourceUsageListResultPreparer() +// ListOperationsNextResults retrieves the next set of results, if any. +func (client ManagementClient) ListOperationsNextResults(lastResults OperationListResult) (result OperationListResult, err error) { + req, err := lastResults.OperationListResultPreparer() if err != nil { - return result, autorest.NewErrorWithError(err, "cdn.ManagementClient", "CheckResourceUsage", nil, "Failure preparing next results request") + return result, autorest.NewErrorWithError(err, "cdn.ManagementClient", "ListOperations", nil, "Failure preparing next results request") } if req == nil { return } - resp, err := client.CheckResourceUsageSender(req) + resp, err := client.ListOperationsSender(req) if err != nil { result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "cdn.ManagementClient", "CheckResourceUsage", resp, "Failure sending next results request") + return result, autorest.NewErrorWithError(err, "cdn.ManagementClient", "ListOperations", resp, "Failure sending next results request") } - result, err = client.CheckResourceUsageResponder(resp) + result, err = client.ListOperationsResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "cdn.ManagementClient", "CheckResourceUsage", resp, "Failure responding to next results request") + err = autorest.NewErrorWithError(err, "cdn.ManagementClient", "ListOperations", resp, "Failure responding to next results request") } return } -// ListOperations lists all of the available CDN REST API operations. -func (client ManagementClient) ListOperations() (result OperationListResult, err error) { - req, err := client.ListOperationsPreparer() +// ListResourceUsage check the quota and actual usage of the CDN profiles under +// the given subscription. +func (client ManagementClient) ListResourceUsage() (result ResourceUsageListResult, err error) { + req, err := client.ListResourceUsagePreparer() if err != nil { - return result, autorest.NewErrorWithError(err, "cdn.ManagementClient", "ListOperations", nil, "Failure preparing request") + return result, autorest.NewErrorWithError(err, "cdn.ManagementClient", "ListResourceUsage", nil, "Failure preparing request") } - resp, err := client.ListOperationsSender(req) + resp, err := client.ListResourceUsageSender(req) if err != nil { result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "cdn.ManagementClient", "ListOperations", resp, "Failure sending request") + return result, autorest.NewErrorWithError(err, "cdn.ManagementClient", "ListResourceUsage", resp, "Failure sending request") } - result, err = client.ListOperationsResponder(resp) + result, err = client.ListResourceUsageResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "cdn.ManagementClient", "ListOperations", resp, "Failure responding to request") + err = autorest.NewErrorWithError(err, "cdn.ManagementClient", "ListResourceUsage", resp, "Failure responding to request") } return } -// ListOperationsPreparer prepares the ListOperations request. -func (client ManagementClient) ListOperationsPreparer() (*http.Request, error) { +// ListResourceUsagePreparer prepares the ListResourceUsage request. +func (client ManagementClient) ListResourceUsagePreparer() (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-10-02" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( - autorest.AsGet(), + autorest.AsPost(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPath("/providers/Microsoft.Cdn/operations"), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Cdn/checkResourceUsage", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare(&http.Request{}) } -// ListOperationsSender sends the ListOperations request. The method will close the +// ListResourceUsageSender sends the ListResourceUsage request. The method will close the // http.Response Body if it receives an error. -func (client ManagementClient) ListOperationsSender(req *http.Request) (*http.Response, error) { +func (client ManagementClient) ListResourceUsageSender(req *http.Request) (*http.Response, error) { return autorest.SendWithSender(client, req) } -// ListOperationsResponder handles the response to the ListOperations request. The method always +// ListResourceUsageResponder handles the response to the ListResourceUsage request. The method always // closes the http.Response Body. -func (client ManagementClient) ListOperationsResponder(resp *http.Response) (result OperationListResult, err error) { +func (client ManagementClient) ListResourceUsageResponder(resp *http.Response) (result ResourceUsageListResult, err error) { err = autorest.Respond( resp, client.ByInspecting(), @@ -264,25 +262,25 @@ func (client ManagementClient) ListOperationsResponder(resp *http.Response) (res return } -// ListOperationsNextResults retrieves the next set of results, if any. -func (client ManagementClient) ListOperationsNextResults(lastResults OperationListResult) (result OperationListResult, err error) { - req, err := lastResults.OperationListResultPreparer() +// ListResourceUsageNextResults retrieves the next set of results, if any. +func (client ManagementClient) ListResourceUsageNextResults(lastResults ResourceUsageListResult) (result ResourceUsageListResult, err error) { + req, err := lastResults.ResourceUsageListResultPreparer() if err != nil { - return result, autorest.NewErrorWithError(err, "cdn.ManagementClient", "ListOperations", nil, "Failure preparing next results request") + return result, autorest.NewErrorWithError(err, "cdn.ManagementClient", "ListResourceUsage", nil, "Failure preparing next results request") } if req == nil { return } - resp, err := client.ListOperationsSender(req) + resp, err := client.ListResourceUsageSender(req) if err != nil { result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "cdn.ManagementClient", "ListOperations", resp, "Failure sending next results request") + return result, autorest.NewErrorWithError(err, "cdn.ManagementClient", "ListResourceUsage", resp, "Failure sending next results request") } - result, err = client.ListOperationsResponder(resp) + result, err = client.ListResourceUsageResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "cdn.ManagementClient", "ListOperations", resp, "Failure responding to next results request") + err = autorest.NewErrorWithError(err, "cdn.ManagementClient", "ListResourceUsage", resp, "Failure responding to next results request") } return diff --git a/arm/cdn/customdomains.go b/arm/cdn/customdomains.go old mode 100644 new mode 100755 index 76cbecca66be..db9b8d3c15db --- a/arm/cdn/customdomains.go +++ b/arm/cdn/customdomains.go @@ -14,7 +14,7 @@ package cdn // See the License for the specific language governing permissions and // limitations under the License. // -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.0 +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 // Changes may cause incorrect behavior and will be lost if the code is // regenerated. @@ -96,8 +96,9 @@ func (client CustomDomainsClient) CreatePreparer(resourceGroupName string, profi "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-10-02" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -178,8 +179,9 @@ func (client CustomDomainsClient) DeletePreparer(resourceGroupName string, profi "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-10-02" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -210,6 +212,160 @@ func (client CustomDomainsClient) DeleteResponder(resp *http.Response) (result a return } +// DisableCustomHTTPS disable https delivery of the custom domain. +// +// resourceGroupName is name of the Resource group within the Azure +// subscription. profileName is name of the CDN profile which is unique within +// the resource group. endpointName is name of the endpoint under the profile +// which is unique globally. customDomainName is name of the custom domain +// within an endpoint. +func (client CustomDomainsClient) DisableCustomHTTPS(resourceGroupName string, profileName string, endpointName string, customDomainName string) (result CustomDomain, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "cdn.CustomDomainsClient", "DisableCustomHTTPS") + } + + req, err := client.DisableCustomHTTPSPreparer(resourceGroupName, profileName, endpointName, customDomainName) + if err != nil { + return result, autorest.NewErrorWithError(err, "cdn.CustomDomainsClient", "DisableCustomHTTPS", nil, "Failure preparing request") + } + + resp, err := client.DisableCustomHTTPSSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "cdn.CustomDomainsClient", "DisableCustomHTTPS", resp, "Failure sending request") + } + + result, err = client.DisableCustomHTTPSResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.CustomDomainsClient", "DisableCustomHTTPS", resp, "Failure responding to request") + } + + return +} + +// DisableCustomHTTPSPreparer prepares the DisableCustomHTTPS request. +func (client CustomDomainsClient) DisableCustomHTTPSPreparer(resourceGroupName string, profileName string, endpointName string, customDomainName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "customDomainName": autorest.Encode("path", customDomainName), + "endpointName": autorest.Encode("path", endpointName), + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-10-02" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/customDomains/{customDomainName}/disableCustomHttps", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DisableCustomHTTPSSender sends the DisableCustomHTTPS request. The method will close the +// http.Response Body if it receives an error. +func (client CustomDomainsClient) DisableCustomHTTPSSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DisableCustomHTTPSResponder handles the response to the DisableCustomHTTPS request. The method always +// closes the http.Response Body. +func (client CustomDomainsClient) DisableCustomHTTPSResponder(resp *http.Response) (result CustomDomain, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusAccepted, http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// EnableCustomHTTPS enable https delivery of the custom domain. +// +// resourceGroupName is name of the Resource group within the Azure +// subscription. profileName is name of the CDN profile which is unique within +// the resource group. endpointName is name of the endpoint under the profile +// which is unique globally. customDomainName is name of the custom domain +// within an endpoint. +func (client CustomDomainsClient) EnableCustomHTTPS(resourceGroupName string, profileName string, endpointName string, customDomainName string) (result CustomDomain, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "cdn.CustomDomainsClient", "EnableCustomHTTPS") + } + + req, err := client.EnableCustomHTTPSPreparer(resourceGroupName, profileName, endpointName, customDomainName) + if err != nil { + return result, autorest.NewErrorWithError(err, "cdn.CustomDomainsClient", "EnableCustomHTTPS", nil, "Failure preparing request") + } + + resp, err := client.EnableCustomHTTPSSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "cdn.CustomDomainsClient", "EnableCustomHTTPS", resp, "Failure sending request") + } + + result, err = client.EnableCustomHTTPSResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.CustomDomainsClient", "EnableCustomHTTPS", resp, "Failure responding to request") + } + + return +} + +// EnableCustomHTTPSPreparer prepares the EnableCustomHTTPS request. +func (client CustomDomainsClient) EnableCustomHTTPSPreparer(resourceGroupName string, profileName string, endpointName string, customDomainName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "customDomainName": autorest.Encode("path", customDomainName), + "endpointName": autorest.Encode("path", endpointName), + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-10-02" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/customDomains/{customDomainName}/enableCustomHttps", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// EnableCustomHTTPSSender sends the EnableCustomHTTPS request. The method will close the +// http.Response Body if it receives an error. +func (client CustomDomainsClient) EnableCustomHTTPSSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// EnableCustomHTTPSResponder handles the response to the EnableCustomHTTPS request. The method always +// closes the http.Response Body. +func (client CustomDomainsClient) EnableCustomHTTPSResponder(resp *http.Response) (result CustomDomain, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusAccepted, http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + // Get gets an exisitng custom domain within an endpoint. // // resourceGroupName is name of the Resource group within the Azure @@ -255,8 +411,9 @@ func (client CustomDomainsClient) GetPreparer(resourceGroupName string, profileN "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-10-02" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -329,8 +486,9 @@ func (client CustomDomainsClient) ListByEndpointPreparer(resourceGroupName strin "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-10-02" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( diff --git a/arm/cdn/edgenodes.go b/arm/cdn/edgenodes.go old mode 100644 new mode 100755 index a4fb02a912cb..190b24789a32 --- a/arm/cdn/edgenodes.go +++ b/arm/cdn/edgenodes.go @@ -14,7 +14,7 @@ package cdn // See the License for the specific language governing permissions and // limitations under the License. // -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.0 +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 // Changes may cause incorrect behavior and will be lost if the code is // regenerated. @@ -65,8 +65,9 @@ func (client EdgeNodesClient) List() (result EdgenodeResult, err error) { // ListPreparer prepares the List request. func (client EdgeNodesClient) ListPreparer() (*http.Request, error) { + const APIVersion = "2016-10-02" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -95,3 +96,27 @@ func (client EdgeNodesClient) ListResponder(resp *http.Response) (result Edgenod result.Response = autorest.Response{Response: resp} return } + +// ListNextResults retrieves the next set of results, if any. +func (client EdgeNodesClient) ListNextResults(lastResults EdgenodeResult) (result EdgenodeResult, err error) { + req, err := lastResults.EdgenodeResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "cdn.EdgeNodesClient", "List", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "cdn.EdgeNodesClient", "List", resp, "Failure sending next results request") + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.EdgeNodesClient", "List", resp, "Failure responding to next results request") + } + + return +} diff --git a/arm/cdn/endpoints.go b/arm/cdn/endpoints.go old mode 100644 new mode 100755 index 828dbc1e16af..38cf134de0ff --- a/arm/cdn/endpoints.go +++ b/arm/cdn/endpoints.go @@ -14,7 +14,7 @@ package cdn // See the License for the specific language governing permissions and // limitations under the License. // -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.0 +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 // Changes may cause incorrect behavior and will be lost if the code is // regenerated. @@ -93,8 +93,9 @@ func (client EndpointsClient) CreatePreparer(resourceGroupName string, profileNa "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-10-02" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -174,8 +175,9 @@ func (client EndpointsClient) DeletePreparer(resourceGroupName string, profileNa "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-10-02" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -250,8 +252,9 @@ func (client EndpointsClient) GetPreparer(resourceGroupName string, profileName "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-10-02" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -322,8 +325,9 @@ func (client EndpointsClient) ListByProfilePreparer(resourceGroupName string, pr "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-10-02" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -421,8 +425,9 @@ func (client EndpointsClient) ListResourceUsagePreparer(resourceGroupName string "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-10-02" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -526,8 +531,9 @@ func (client EndpointsClient) LoadContentPreparer(resourceGroupName string, prof "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-10-02" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -611,8 +617,9 @@ func (client EndpointsClient) PurgeContentPreparer(resourceGroupName string, pro "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-10-02" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -691,8 +698,9 @@ func (client EndpointsClient) StartPreparer(resourceGroupName string, profileNam "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-10-02" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -769,8 +777,9 @@ func (client EndpointsClient) StopPreparer(resourceGroupName string, profileName "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-10-02" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -851,8 +860,9 @@ func (client EndpointsClient) UpdatePreparer(resourceGroupName string, profileNa "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-10-02" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -932,8 +942,9 @@ func (client EndpointsClient) ValidateCustomDomainPreparer(resourceGroupName str "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-10-02" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( diff --git a/arm/cdn/models.go b/arm/cdn/models.go old mode 100644 new mode 100755 index 3479c2b6efae..f291f8c52c31 --- a/arm/cdn/models.go +++ b/arm/cdn/models.go @@ -14,7 +14,7 @@ package cdn // See the License for the specific language governing permissions and // limitations under the License. // -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.0 +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 // Changes may cause incorrect behavior and will be lost if the code is // regenerated. @@ -37,6 +37,26 @@ const ( Deleting CustomDomainResourceState = "Deleting" ) +// CustomHTTPSProvisioningState enumerates the values for custom https +// provisioning state. +type CustomHTTPSProvisioningState string + +const ( + // Disabled specifies the disabled state for custom https provisioning + // state. + Disabled CustomHTTPSProvisioningState = "Disabled" + // Disabling specifies the disabling state for custom https provisioning + // state. + Disabling CustomHTTPSProvisioningState = "Disabling" + // Enabled specifies the enabled state for custom https provisioning state. + Enabled CustomHTTPSProvisioningState = "Enabled" + // Enabling specifies the enabling state for custom https provisioning + // state. + Enabling CustomHTTPSProvisioningState = "Enabling" + // Failed specifies the failed state for custom https provisioning state. + Failed CustomHTTPSProvisioningState = "Failed" +) + // EndpointResourceState enumerates the values for endpoint resource state. type EndpointResourceState string @@ -209,10 +229,11 @@ type CustomDomainParameters struct { // CustomDomainProperties is the JSON object that contains the properties of // the custom domain to create. type CustomDomainProperties struct { - HostName *string `json:"hostName,omitempty"` - ResourceState CustomDomainResourceState `json:"resourceState,omitempty"` - ValidationData *string `json:"validationData,omitempty"` - ProvisioningState *string `json:"provisioningState,omitempty"` + HostName *string `json:"hostName,omitempty"` + ResourceState CustomDomainResourceState `json:"resourceState,omitempty"` + CustomHTTPSProvisioningState CustomHTTPSProvisioningState `json:"customHttpsProvisioningState,omitempty"` + ValidationData *string `json:"validationData,omitempty"` + ProvisioningState *string `json:"provisioningState,omitempty"` } // CustomDomainPropertiesParameters is the JSON object that contains the @@ -256,6 +277,19 @@ type EdgeNodeProperties struct { type EdgenodeResult struct { autorest.Response `json:"-"` Value *[]EdgeNode `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// EdgenodeResultPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client EdgenodeResult) EdgenodeResultPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) } // Endpoint is cDN endpoint is the entity within a CDN profile containing diff --git a/arm/cdn/origins.go b/arm/cdn/origins.go old mode 100644 new mode 100755 index 518263dc1c5d..5a9ba17e1d41 --- a/arm/cdn/origins.go +++ b/arm/cdn/origins.go @@ -14,7 +14,7 @@ package cdn // See the License for the specific language governing permissions and // limitations under the License. // -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.0 +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 // Changes may cause incorrect behavior and will be lost if the code is // regenerated. @@ -87,8 +87,9 @@ func (client OriginsClient) GetPreparer(resourceGroupName string, profileName st "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-10-02" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -161,8 +162,9 @@ func (client OriginsClient) ListByEndpointPreparer(resourceGroupName string, pro "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-10-02" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -264,8 +266,9 @@ func (client OriginsClient) UpdatePreparer(resourceGroupName string, profileName "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-10-02" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( diff --git a/arm/cdn/profiles.go b/arm/cdn/profiles.go old mode 100644 new mode 100755 index c69b6ce5046d..c265da9b60aa --- a/arm/cdn/profiles.go +++ b/arm/cdn/profiles.go @@ -14,7 +14,7 @@ package cdn // See the License for the specific language governing permissions and // limitations under the License. // -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.0 +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 // Changes may cause incorrect behavior and will be lost if the code is // regenerated. @@ -90,8 +90,9 @@ func (client ProfilesClient) CreatePreparer(resourceGroupName string, profileNam "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-10-02" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -170,8 +171,9 @@ func (client ProfilesClient) DeletePreparer(resourceGroupName string, profileNam "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-10-02" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -248,8 +250,9 @@ func (client ProfilesClient) GenerateSsoURIPreparer(resourceGroupName string, pr "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-10-02" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -321,8 +324,9 @@ func (client ProfilesClient) GetPreparer(resourceGroupName string, profileName s "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-10-02" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -379,8 +383,9 @@ func (client ProfilesClient) ListPreparer() (*http.Request, error) { "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-10-02" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -473,8 +478,9 @@ func (client ProfilesClient) ListByResourceGroupPreparer(resourceGroupName strin "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-10-02" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -570,8 +576,9 @@ func (client ProfilesClient) ListResourceUsagePreparer(resourceGroupName string, "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-10-02" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -671,8 +678,9 @@ func (client ProfilesClient) UpdatePreparer(resourceGroupName string, profileNam "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-10-02" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( diff --git a/arm/cdn/version.go b/arm/cdn/version.go old mode 100644 new mode 100755 index 6039f3fed734..0299150ffc96 --- a/arm/cdn/version.go +++ b/arm/cdn/version.go @@ -18,43 +18,12 @@ package cdn // Changes may cause incorrect behavior and will be lost if the code is // regenerated. -import ( - "bytes" - "fmt" - "strings" -) - -const ( - major = "8" - minor = "1" - patch = "0" - tag = "beta" - userAgentFormat = "Azure-SDK-For-Go/%s arm-%s/%s" -) - -// cached results of UserAgent and Version to prevent repeated operations. -var ( - userAgent string - version string -) - // UserAgent returns the UserAgent string to use when sending http.Requests. func UserAgent() string { - if userAgent == "" { - userAgent = fmt.Sprintf(userAgentFormat, Version(), "cdn", "2016-10-02") - } - return userAgent + return "Azure-SDK-For-Go/v9.0.0-beta arm-cdn/2016-10-02" } // Version returns the semantic version (see http://semver.org) of the client. func Version() string { - if version == "" { - versionBuilder := bytes.NewBufferString(fmt.Sprintf("%s.%s.%s", major, minor, patch)) - if tag != "" { - versionBuilder.WriteRune('-') - versionBuilder.WriteString(strings.TrimPrefix(tag, "-")) - } - version = string(versionBuilder.Bytes()) - } - return version + return "v9.0.0-beta" } diff --git a/arm/cognitiveservices/accounts.go b/arm/cognitiveservices/accounts.go old mode 100644 new mode 100755 index 944afe1e523c..f423b9c7b82f --- a/arm/cognitiveservices/accounts.go +++ b/arm/cognitiveservices/accounts.go @@ -91,8 +91,9 @@ func (client AccountsClient) CreatePreparer(resourceGroupName string, accountNam "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-02-01-preview" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -167,8 +168,9 @@ func (client AccountsClient) DeletePreparer(resourceGroupName string, accountNam "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-02-01-preview" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -241,8 +243,9 @@ func (client AccountsClient) GetPropertiesPreparer(resourceGroupName string, acc "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-02-01-preview" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -300,8 +303,9 @@ func (client AccountsClient) ListPreparer() (*http.Request, error) { "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-02-01-preview" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -363,8 +367,9 @@ func (client AccountsClient) ListByResourceGroupPreparer(resourceGroupName strin "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-02-01-preview" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -438,8 +443,9 @@ func (client AccountsClient) ListKeysPreparer(resourceGroupName string, accountN "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-02-01-preview" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -512,8 +518,9 @@ func (client AccountsClient) ListSkusPreparer(resourceGroupName string, accountN "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-02-01-preview" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -587,8 +594,9 @@ func (client AccountsClient) RegenerateKeyPreparer(resourceGroupName string, acc "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-02-01-preview" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -663,8 +671,9 @@ func (client AccountsClient) UpdatePreparer(resourceGroupName string, accountNam "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-02-01-preview" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( diff --git a/arm/cognitiveservices/client.go b/arm/cognitiveservices/client.go old mode 100644 new mode 100755 index e4c65f7712e4..ba9db94240f1 --- a/arm/cognitiveservices/client.go +++ b/arm/cognitiveservices/client.go @@ -27,9 +27,6 @@ import ( ) const ( - // APIVersion is the version of the Cognitiveservices - APIVersion = "2016-02-01-preview" - // DefaultBaseURI is the default URI used for the service Cognitiveservices DefaultBaseURI = "https://management.azure.com" ) @@ -38,7 +35,6 @@ const ( type ManagementClient struct { autorest.Client BaseURI string - APIVersion string SubscriptionID string } @@ -52,7 +48,6 @@ func NewWithBaseURI(baseURI string, subscriptionID string) ManagementClient { return ManagementClient{ Client: autorest.NewClientWithUserAgent(UserAgent()), BaseURI: baseURI, - APIVersion: APIVersion, SubscriptionID: subscriptionID, } } diff --git a/arm/cognitiveservices/models.go b/arm/cognitiveservices/models.go old mode 100644 new mode 100755 diff --git a/arm/cognitiveservices/version.go b/arm/cognitiveservices/version.go old mode 100644 new mode 100755 index 68bf9d37f0ca..b978d76ce9e0 --- a/arm/cognitiveservices/version.go +++ b/arm/cognitiveservices/version.go @@ -18,43 +18,12 @@ package cognitiveservices // Changes may cause incorrect behavior and will be lost if the code is // regenerated. -import ( - "bytes" - "fmt" - "strings" -) - -const ( - major = "8" - minor = "1" - patch = "0" - tag = "beta" - userAgentFormat = "Azure-SDK-For-Go/%s arm-%s/%s" -) - -// cached results of UserAgent and Version to prevent repeated operations. -var ( - userAgent string - version string -) - // UserAgent returns the UserAgent string to use when sending http.Requests. func UserAgent() string { - if userAgent == "" { - userAgent = fmt.Sprintf(userAgentFormat, Version(), "cognitiveservices", "2016-02-01-preview") - } - return userAgent + return "Azure-SDK-For-Go/v9.0.0-beta arm-cognitiveservices/2016-02-01-preview" } // Version returns the semantic version (see http://semver.org) of the client. func Version() string { - if version == "" { - versionBuilder := bytes.NewBufferString(fmt.Sprintf("%s.%s.%s", major, minor, patch)) - if tag != "" { - versionBuilder.WriteRune('-') - versionBuilder.WriteString(strings.TrimPrefix(tag, "-")) - } - version = string(versionBuilder.Bytes()) - } - return version + return "v9.0.0-beta" } diff --git a/arm/compute/availabilitysets.go b/arm/compute/availabilitysets.go old mode 100644 new mode 100755 index 1188c8b7cfdd..6d308180fbd7 --- a/arm/compute/availabilitysets.go +++ b/arm/compute/availabilitysets.go @@ -74,8 +74,9 @@ func (client AvailabilitySetsClient) CreateOrUpdatePreparer(resourceGroupName st "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-04-30-preview" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -139,8 +140,9 @@ func (client AvailabilitySetsClient) DeletePreparer(resourceGroupName string, av "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-04-30-preview" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -202,8 +204,9 @@ func (client AvailabilitySetsClient) GetPreparer(resourceGroupName string, avail "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-04-30-preview" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -263,8 +266,9 @@ func (client AvailabilitySetsClient) ListPreparer(resourceGroupName string) (*ht "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-04-30-preview" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -327,8 +331,9 @@ func (client AvailabilitySetsClient) ListAvailableSizesPreparer(resourceGroupNam "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-04-30-preview" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( diff --git a/arm/compute/client.go b/arm/compute/client.go old mode 100644 new mode 100755 index bbe0af39c24f..c60452b9d794 --- a/arm/compute/client.go +++ b/arm/compute/client.go @@ -27,9 +27,6 @@ import ( ) const ( - // APIVersion is the version of the Compute - APIVersion = "2016-04-30-preview" - // DefaultBaseURI is the default URI used for the service Compute DefaultBaseURI = "https://management.azure.com" ) @@ -38,7 +35,6 @@ const ( type ManagementClient struct { autorest.Client BaseURI string - APIVersion string SubscriptionID string } @@ -52,7 +48,6 @@ func NewWithBaseURI(baseURI string, subscriptionID string) ManagementClient { return ManagementClient{ Client: autorest.NewClientWithUserAgent(UserAgent()), BaseURI: baseURI, - APIVersion: APIVersion, SubscriptionID: subscriptionID, } } diff --git a/arm/compute/images.go b/arm/compute/images.go old mode 100644 new mode 100755 index b585467cdf56..09a44584b34d --- a/arm/compute/images.go +++ b/arm/compute/images.go @@ -85,8 +85,9 @@ func (client ImagesClient) CreateOrUpdatePreparer(resourceGroupName string, imag "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-04-30-preview" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -153,8 +154,9 @@ func (client ImagesClient) DeletePreparer(resourceGroupName string, imageName st "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-04-30-preview" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -217,8 +219,9 @@ func (client ImagesClient) GetPreparer(resourceGroupName string, imageName strin "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-04-30-preview" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } if len(expand) > 0 { queryParameters["$expand"] = autorest.Encode("query", expand) @@ -280,8 +283,9 @@ func (client ImagesClient) ListPreparer() (*http.Request, error) { "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-04-30-preview" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -365,8 +369,9 @@ func (client ImagesClient) ListByResourceGroupPreparer(resourceGroupName string) "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-04-30-preview" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( diff --git a/arm/compute/models.go b/arm/compute/models.go old mode 100644 new mode 100755 index 405048772a02..a9524daeffac --- a/arm/compute/models.go +++ b/arm/compute/models.go @@ -107,6 +107,15 @@ const ( HTTPS ProtocolTypes = "Https" ) +// ResourceIdentityType enumerates the values for resource identity type. +type ResourceIdentityType string + +const ( + // SystemAssigned specifies the system assigned state for resource identity + // type. + SystemAssigned ResourceIdentityType = "SystemAssigned" +) + // SettingNames enumerates the values for setting names. type SettingNames string @@ -783,6 +792,7 @@ type VirtualMachine struct { Plan *Plan `json:"plan,omitempty"` *VirtualMachineProperties `json:"properties,omitempty"` Resources *[]VirtualMachineExtension `json:"resources,omitempty"` + Identity *VirtualMachineIdentity `json:"identity,omitempty"` } // VirtualMachineAgentInstanceView is the instance view of the VM Agent running @@ -877,6 +887,13 @@ type VirtualMachineExtensionProperties struct { InstanceView *VirtualMachineExtensionInstanceView `json:"instanceView,omitempty"` } +// VirtualMachineIdentity is identity for the virtual machine. +type VirtualMachineIdentity struct { + PrincipalID *string `json:"principalId,omitempty"` + TenantID *string `json:"tenantId,omitempty"` + Type ResourceIdentityType `json:"type,omitempty"` +} + // VirtualMachineImage is describes a Virtual Machine Image. type VirtualMachineImage struct { autorest.Response `json:"-"` @@ -959,6 +976,7 @@ type VirtualMachineScaleSet struct { Sku *Sku `json:"sku,omitempty"` Plan *Plan `json:"plan,omitempty"` *VirtualMachineScaleSetProperties `json:"properties,omitempty"` + Identity *VirtualMachineScaleSetIdentity `json:"identity,omitempty"` } // VirtualMachineScaleSetDataDisk is describes a virtual machine scale set data @@ -998,6 +1016,14 @@ type VirtualMachineScaleSetExtensionProperties struct { ProvisioningState *string `json:"provisioningState,omitempty"` } +// VirtualMachineScaleSetIdentity is identity for the virtual machine scale +// set. +type VirtualMachineScaleSetIdentity struct { + PrincipalID *string `json:"principalId,omitempty"` + TenantID *string `json:"tenantId,omitempty"` + Type ResourceIdentityType `json:"type,omitempty"` +} + // VirtualMachineScaleSetInstanceView is the instance view of a virtual machine // scale set. type VirtualMachineScaleSetInstanceView struct { diff --git a/arm/compute/usage.go b/arm/compute/usage.go old mode 100644 new mode 100755 index 241b95bea6b8..b0a071d74ba2 --- a/arm/compute/usage.go +++ b/arm/compute/usage.go @@ -78,8 +78,9 @@ func (client UsageClient) ListPreparer(location string) (*http.Request, error) { "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-04-30-preview" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( diff --git a/arm/compute/version.go b/arm/compute/version.go old mode 100644 new mode 100755 index b28e58d362ce..9c13dca55b96 --- a/arm/compute/version.go +++ b/arm/compute/version.go @@ -18,43 +18,12 @@ package compute // Changes may cause incorrect behavior and will be lost if the code is // regenerated. -import ( - "bytes" - "fmt" - "strings" -) - -const ( - major = "8" - minor = "1" - patch = "0" - tag = "beta" - userAgentFormat = "Azure-SDK-For-Go/%s arm-%s/%s" -) - -// cached results of UserAgent and Version to prevent repeated operations. -var ( - userAgent string - version string -) - // UserAgent returns the UserAgent string to use when sending http.Requests. func UserAgent() string { - if userAgent == "" { - userAgent = fmt.Sprintf(userAgentFormat, Version(), "compute", "2016-04-30-preview") - } - return userAgent + return "Azure-SDK-For-Go/v9.0.0-beta arm-compute/2016-04-30-preview" } // Version returns the semantic version (see http://semver.org) of the client. func Version() string { - if version == "" { - versionBuilder := bytes.NewBufferString(fmt.Sprintf("%s.%s.%s", major, minor, patch)) - if tag != "" { - versionBuilder.WriteRune('-') - versionBuilder.WriteString(strings.TrimPrefix(tag, "-")) - } - version = string(versionBuilder.Bytes()) - } - return version + return "v9.0.0-beta" } diff --git a/arm/compute/virtualmachineextensionimages.go b/arm/compute/virtualmachineextensionimages.go old mode 100644 new mode 100755 index dc91c9b4bd9c..0d0b2f3eb77b --- a/arm/compute/virtualmachineextensionimages.go +++ b/arm/compute/virtualmachineextensionimages.go @@ -73,8 +73,9 @@ func (client VirtualMachineExtensionImagesClient) GetPreparer(location string, p "version": autorest.Encode("path", version), } + const APIVersion = "2016-04-30-preview" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -134,8 +135,9 @@ func (client VirtualMachineExtensionImagesClient) ListTypesPreparer(location str "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-04-30-preview" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -197,8 +199,9 @@ func (client VirtualMachineExtensionImagesClient) ListVersionsPreparer(location "type": autorest.Encode("path", typeParameter), } + const APIVersion = "2016-04-30-preview" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } if len(filter) > 0 { queryParameters["$filter"] = autorest.Encode("query", filter) diff --git a/arm/compute/virtualmachineextensions.go b/arm/compute/virtualmachineextensions.go old mode 100644 new mode 100755 index 143877549193..f82c9ff7fdd7 --- a/arm/compute/virtualmachineextensions.go +++ b/arm/compute/virtualmachineextensions.go @@ -80,8 +80,9 @@ func (client VirtualMachineExtensionsClient) CreateOrUpdatePreparer(resourceGrou "vmName": autorest.Encode("path", vmName), } + const APIVersion = "2016-04-30-preview" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -151,8 +152,9 @@ func (client VirtualMachineExtensionsClient) DeletePreparer(resourceGroupName st "vmName": autorest.Encode("path", vmName), } + const APIVersion = "2016-04-30-preview" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -218,8 +220,9 @@ func (client VirtualMachineExtensionsClient) GetPreparer(resourceGroupName strin "vmName": autorest.Encode("path", vmName), } + const APIVersion = "2016-04-30-preview" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } if len(expand) > 0 { queryParameters["$expand"] = autorest.Encode("query", expand) diff --git a/arm/compute/virtualmachineimages.go b/arm/compute/virtualmachineimages.go old mode 100644 new mode 100755 index 21562370b846..4ad282ef517a --- a/arm/compute/virtualmachineimages.go +++ b/arm/compute/virtualmachineimages.go @@ -77,8 +77,9 @@ func (client VirtualMachineImagesClient) GetPreparer(location string, publisherN "version": autorest.Encode("path", version), } + const APIVersion = "2016-04-30-preview" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -144,8 +145,9 @@ func (client VirtualMachineImagesClient) ListPreparer(location string, publisher "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-04-30-preview" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } if len(filter) > 0 { queryParameters["$filter"] = autorest.Encode("query", filter) @@ -217,8 +219,9 @@ func (client VirtualMachineImagesClient) ListOffersPreparer(location string, pub "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-04-30-preview" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -279,8 +282,9 @@ func (client VirtualMachineImagesClient) ListPublishersPreparer(location string) "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-04-30-preview" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -344,8 +348,9 @@ func (client VirtualMachineImagesClient) ListSkusPreparer(location string, publi "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-04-30-preview" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( diff --git a/arm/compute/virtualmachines.go b/arm/compute/virtualmachines.go old mode 100644 new mode 100755 index d1009f9d8a8d..fa0d073ea671 --- a/arm/compute/virtualmachines.go +++ b/arm/compute/virtualmachines.go @@ -87,8 +87,9 @@ func (client VirtualMachinesClient) CapturePreparer(resourceGroupName string, vm "vmName": autorest.Encode("path", vmName), } + const APIVersion = "2016-04-30-preview" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -157,8 +158,9 @@ func (client VirtualMachinesClient) ConvertToManagedDisksPreparer(resourceGroupN "vmName": autorest.Encode("path", vmName), } + const APIVersion = "2016-04-30-preview" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -246,8 +248,9 @@ func (client VirtualMachinesClient) CreateOrUpdatePreparer(resourceGroupName str "vmName": autorest.Encode("path", vmName), } + const APIVersion = "2016-04-30-preview" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -316,8 +319,9 @@ func (client VirtualMachinesClient) DeallocatePreparer(resourceGroupName string, "vmName": autorest.Encode("path", vmName), } + const APIVersion = "2016-04-30-preview" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -383,8 +387,9 @@ func (client VirtualMachinesClient) DeletePreparer(resourceGroupName string, vmN "vmName": autorest.Encode("path", vmName), } + const APIVersion = "2016-04-30-preview" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -447,8 +452,9 @@ func (client VirtualMachinesClient) GeneralizePreparer(resourceGroupName string, "vmName": autorest.Encode("path", vmName), } + const APIVersion = "2016-04-30-preview" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -512,8 +518,9 @@ func (client VirtualMachinesClient) GetPreparer(resourceGroupName string, vmName "vmName": autorest.Encode("path", vmName), } + const APIVersion = "2016-04-30-preview" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } if len(string(expand)) > 0 { queryParameters["$expand"] = autorest.Encode("query", expand) @@ -578,8 +585,9 @@ func (client VirtualMachinesClient) ListPreparer(resourceGroupName string) (*htt "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-04-30-preview" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -662,8 +670,9 @@ func (client VirtualMachinesClient) ListAllPreparer() (*http.Request, error) { "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-04-30-preview" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -750,8 +759,9 @@ func (client VirtualMachinesClient) ListAvailableSizesPreparer(resourceGroupName "vmName": autorest.Encode("path", vmName), } + const APIVersion = "2016-04-30-preview" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -817,8 +827,9 @@ func (client VirtualMachinesClient) PowerOffPreparer(resourceGroupName string, v "vmName": autorest.Encode("path", vmName), } + const APIVersion = "2016-04-30-preview" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -884,8 +895,9 @@ func (client VirtualMachinesClient) RedeployPreparer(resourceGroupName string, v "vmName": autorest.Encode("path", vmName), } + const APIVersion = "2016-04-30-preview" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -951,8 +963,9 @@ func (client VirtualMachinesClient) RestartPreparer(resourceGroupName string, vm "vmName": autorest.Encode("path", vmName), } + const APIVersion = "2016-04-30-preview" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -1018,8 +1031,9 @@ func (client VirtualMachinesClient) StartPreparer(resourceGroupName string, vmNa "vmName": autorest.Encode("path", vmName), } + const APIVersion = "2016-04-30-preview" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( diff --git a/arm/compute/virtualmachinescalesets.go b/arm/compute/virtualmachinescalesets.go old mode 100644 new mode 100755 index 8e170561987d..9c53144cf900 --- a/arm/compute/virtualmachinescalesets.go +++ b/arm/compute/virtualmachinescalesets.go @@ -77,8 +77,9 @@ func (client VirtualMachineScaleSetsClient) CreateOrUpdatePreparer(resourceGroup "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-04-30-preview" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -149,8 +150,9 @@ func (client VirtualMachineScaleSetsClient) DeallocatePreparer(resourceGroupName "vmScaleSetName": autorest.Encode("path", vmScaleSetName), } + const APIVersion = "2016-04-30-preview" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -220,8 +222,9 @@ func (client VirtualMachineScaleSetsClient) DeletePreparer(resourceGroupName str "vmScaleSetName": autorest.Encode("path", vmScaleSetName), } + const APIVersion = "2016-04-30-preview" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -294,8 +297,9 @@ func (client VirtualMachineScaleSetsClient) DeleteInstancesPreparer(resourceGrou "vmScaleSetName": autorest.Encode("path", vmScaleSetName), } + const APIVersion = "2016-04-30-preview" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -360,8 +364,9 @@ func (client VirtualMachineScaleSetsClient) GetPreparer(resourceGroupName string "vmScaleSetName": autorest.Encode("path", vmScaleSetName), } + const APIVersion = "2016-04-30-preview" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -423,8 +428,9 @@ func (client VirtualMachineScaleSetsClient) GetInstanceViewPreparer(resourceGrou "vmScaleSetName": autorest.Encode("path", vmScaleSetName), } + const APIVersion = "2016-04-30-preview" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -484,8 +490,9 @@ func (client VirtualMachineScaleSetsClient) ListPreparer(resourceGroupName strin "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-04-30-preview" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -569,8 +576,9 @@ func (client VirtualMachineScaleSetsClient) ListAllPreparer() (*http.Request, er "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-04-30-preview" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -657,8 +665,9 @@ func (client VirtualMachineScaleSetsClient) ListSkusPreparer(resourceGroupName s "vmScaleSetName": autorest.Encode("path", vmScaleSetName), } + const APIVersion = "2016-04-30-preview" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -750,8 +759,9 @@ func (client VirtualMachineScaleSetsClient) PowerOffPreparer(resourceGroupName s "vmScaleSetName": autorest.Encode("path", vmScaleSetName), } + const APIVersion = "2016-04-30-preview" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -822,8 +832,9 @@ func (client VirtualMachineScaleSetsClient) ReimagePreparer(resourceGroupName st "vmScaleSetName": autorest.Encode("path", vmScaleSetName), } + const APIVersion = "2016-04-30-preview" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -890,8 +901,9 @@ func (client VirtualMachineScaleSetsClient) ReimageAllPreparer(resourceGroupName "vmScaleSetName": autorest.Encode("path", vmScaleSetName), } + const APIVersion = "2016-04-30-preview" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -958,8 +970,9 @@ func (client VirtualMachineScaleSetsClient) RestartPreparer(resourceGroupName st "vmScaleSetName": autorest.Encode("path", vmScaleSetName), } + const APIVersion = "2016-04-30-preview" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -1031,8 +1044,9 @@ func (client VirtualMachineScaleSetsClient) StartPreparer(resourceGroupName stri "vmScaleSetName": autorest.Encode("path", vmScaleSetName), } + const APIVersion = "2016-04-30-preview" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -1110,8 +1124,9 @@ func (client VirtualMachineScaleSetsClient) UpdateInstancesPreparer(resourceGrou "vmScaleSetName": autorest.Encode("path", vmScaleSetName), } + const APIVersion = "2016-04-30-preview" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( diff --git a/arm/compute/virtualmachinescalesetvms.go b/arm/compute/virtualmachinescalesetvms.go old mode 100644 new mode 100755 index 1b9e341774f6..2079d509a6fd --- a/arm/compute/virtualmachinescalesetvms.go +++ b/arm/compute/virtualmachinescalesetvms.go @@ -80,8 +80,9 @@ func (client VirtualMachineScaleSetVMsClient) DeallocatePreparer(resourceGroupNa "vmScaleSetName": autorest.Encode("path", vmScaleSetName), } + const APIVersion = "2016-04-30-preview" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -149,8 +150,9 @@ func (client VirtualMachineScaleSetVMsClient) DeletePreparer(resourceGroupName s "vmScaleSetName": autorest.Encode("path", vmScaleSetName), } + const APIVersion = "2016-04-30-preview" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -215,8 +217,9 @@ func (client VirtualMachineScaleSetVMsClient) GetPreparer(resourceGroupName stri "vmScaleSetName": autorest.Encode("path", vmScaleSetName), } + const APIVersion = "2016-04-30-preview" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -280,8 +283,9 @@ func (client VirtualMachineScaleSetVMsClient) GetInstanceViewPreparer(resourceGr "vmScaleSetName": autorest.Encode("path", vmScaleSetName), } + const APIVersion = "2016-04-30-preview" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -345,8 +349,9 @@ func (client VirtualMachineScaleSetVMsClient) ListPreparer(resourceGroupName str "virtualMachineScaleSetName": autorest.Encode("path", virtualMachineScaleSetName), } + const APIVersion = "2016-04-30-preview" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } if len(filter) > 0 { queryParameters["$filter"] = autorest.Encode("query", filter) @@ -448,8 +453,9 @@ func (client VirtualMachineScaleSetVMsClient) PowerOffPreparer(resourceGroupName "vmScaleSetName": autorest.Encode("path", vmScaleSetName), } + const APIVersion = "2016-04-30-preview" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -517,8 +523,9 @@ func (client VirtualMachineScaleSetVMsClient) ReimagePreparer(resourceGroupName "vmScaleSetName": autorest.Encode("path", vmScaleSetName), } + const APIVersion = "2016-04-30-preview" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -587,8 +594,9 @@ func (client VirtualMachineScaleSetVMsClient) ReimageAllPreparer(resourceGroupNa "vmScaleSetName": autorest.Encode("path", vmScaleSetName), } + const APIVersion = "2016-04-30-preview" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -656,8 +664,9 @@ func (client VirtualMachineScaleSetVMsClient) RestartPreparer(resourceGroupName "vmScaleSetName": autorest.Encode("path", vmScaleSetName), } + const APIVersion = "2016-04-30-preview" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -725,8 +734,9 @@ func (client VirtualMachineScaleSetVMsClient) StartPreparer(resourceGroupName st "vmScaleSetName": autorest.Encode("path", vmScaleSetName), } + const APIVersion = "2016-04-30-preview" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( diff --git a/arm/compute/virtualmachinesizes.go b/arm/compute/virtualmachinesizes.go old mode 100644 new mode 100755 index 169b79286567..63a807aa719e --- a/arm/compute/virtualmachinesizes.go +++ b/arm/compute/virtualmachinesizes.go @@ -79,8 +79,9 @@ func (client VirtualMachineSizesClient) ListPreparer(location string) (*http.Req "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-04-30-preview" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( diff --git a/arm/containerregistry/client.go b/arm/containerregistry/client.go old mode 100644 new mode 100755 index 986e763f325f..4c2e1f90d4da --- a/arm/containerregistry/client.go +++ b/arm/containerregistry/client.go @@ -27,9 +27,6 @@ import ( ) const ( - // APIVersion is the version of the Containerregistry - APIVersion = "2016-06-27-preview" - // DefaultBaseURI is the default URI used for the service Containerregistry DefaultBaseURI = "https://management.azure.com" ) @@ -38,7 +35,6 @@ const ( type ManagementClient struct { autorest.Client BaseURI string - APIVersion string SubscriptionID string } @@ -52,7 +48,6 @@ func NewWithBaseURI(baseURI string, subscriptionID string) ManagementClient { return ManagementClient{ Client: autorest.NewClientWithUserAgent(UserAgent()), BaseURI: baseURI, - APIVersion: APIVersion, SubscriptionID: subscriptionID, } } diff --git a/arm/containerregistry/models.go b/arm/containerregistry/models.go old mode 100644 new mode 100755 diff --git a/arm/containerregistry/registries.go b/arm/containerregistry/registries.go old mode 100644 new mode 100755 index 58b16d9dc40b..186d010f6666 --- a/arm/containerregistry/registries.go +++ b/arm/containerregistry/registries.go @@ -81,8 +81,9 @@ func (client RegistriesClient) CheckNameAvailabilityPreparer(registryNameCheckRe "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-06-27-preview" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -159,8 +160,9 @@ func (client RegistriesClient) CreateOrUpdatePreparer(resourceGroupName string, "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-06-27-preview" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -224,8 +226,9 @@ func (client RegistriesClient) DeletePreparer(resourceGroupName string, registry "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-06-27-preview" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -287,8 +290,9 @@ func (client RegistriesClient) GetCredentialsPreparer(resourceGroupName string, "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-06-27-preview" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -350,8 +354,9 @@ func (client RegistriesClient) GetPropertiesPreparer(resourceGroupName string, r "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-06-27-preview" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -409,8 +414,9 @@ func (client RegistriesClient) ListPreparer() (*http.Request, error) { "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-06-27-preview" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -496,8 +502,9 @@ func (client RegistriesClient) ListByResourceGroupPreparer(resourceGroupName str "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-06-27-preview" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -584,8 +591,9 @@ func (client RegistriesClient) RegenerateCredentialsPreparer(resourceGroupName s "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-06-27-preview" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -649,8 +657,9 @@ func (client RegistriesClient) UpdatePreparer(resourceGroupName string, registry "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-06-27-preview" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( diff --git a/arm/containerregistry/version.go b/arm/containerregistry/version.go old mode 100644 new mode 100755 index 1de3b5d8e15d..2a02a3ee90ae --- a/arm/containerregistry/version.go +++ b/arm/containerregistry/version.go @@ -18,43 +18,12 @@ package containerregistry // Changes may cause incorrect behavior and will be lost if the code is // regenerated. -import ( - "bytes" - "fmt" - "strings" -) - -const ( - major = "8" - minor = "1" - patch = "0" - tag = "beta" - userAgentFormat = "Azure-SDK-For-Go/%s arm-%s/%s" -) - -// cached results of UserAgent and Version to prevent repeated operations. -var ( - userAgent string - version string -) - // UserAgent returns the UserAgent string to use when sending http.Requests. func UserAgent() string { - if userAgent == "" { - userAgent = fmt.Sprintf(userAgentFormat, Version(), "containerregistry", "2016-06-27-preview") - } - return userAgent + return "Azure-SDK-For-Go/v9.0.0-beta arm-containerregistry/2016-06-27-preview" } // Version returns the semantic version (see http://semver.org) of the client. func Version() string { - if version == "" { - versionBuilder := bytes.NewBufferString(fmt.Sprintf("%s.%s.%s", major, minor, patch)) - if tag != "" { - versionBuilder.WriteRune('-') - versionBuilder.WriteString(strings.TrimPrefix(tag, "-")) - } - version = string(versionBuilder.Bytes()) - } - return version + return "v9.0.0-beta" } diff --git a/arm/containerservice/client.go b/arm/containerservice/client.go old mode 100644 new mode 100755 index 56fa7aecd43a..a2cdfdf7e37c --- a/arm/containerservice/client.go +++ b/arm/containerservice/client.go @@ -1,5 +1,5 @@ // Package containerservice implements the Azure ARM Containerservice service -// API version 2017-01-31. +// API version 2016-09-30. // // The Container Service Client. package containerservice @@ -27,9 +27,6 @@ import ( ) const ( - // APIVersion is the version of the Containerservice - APIVersion = "2017-01-31" - // DefaultBaseURI is the default URI used for the service Containerservice DefaultBaseURI = "https://management.azure.com" ) @@ -38,7 +35,6 @@ const ( type ManagementClient struct { autorest.Client BaseURI string - APIVersion string SubscriptionID string } @@ -52,7 +48,6 @@ func NewWithBaseURI(baseURI string, subscriptionID string) ManagementClient { return ManagementClient{ Client: autorest.NewClientWithUserAgent(UserAgent()), BaseURI: baseURI, - APIVersion: APIVersion, SubscriptionID: subscriptionID, } } diff --git a/arm/containerservice/containerservices.go b/arm/containerservice/containerservices.go old mode 100644 new mode 100755 index 772a6aeb4110..d700024c838b --- a/arm/containerservice/containerservices.go +++ b/arm/containerservice/containerservices.go @@ -112,8 +112,9 @@ func (client ContainerServicesClient) CreateOrUpdatePreparer(resourceGroupName s "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-09-30" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -186,8 +187,9 @@ func (client ContainerServicesClient) DeletePreparer(resourceGroupName string, c "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-09-30" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -254,8 +256,9 @@ func (client ContainerServicesClient) GetPreparer(resourceGroupName string, cont "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-09-30" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -314,8 +317,9 @@ func (client ContainerServicesClient) ListPreparer() (*http.Request, error) { "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-09-30" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -402,8 +406,9 @@ func (client ContainerServicesClient) ListByResourceGroupPreparer(resourceGroupN "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-09-30" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( diff --git a/arm/containerservice/models.go b/arm/containerservice/models.go old mode 100644 new mode 100755 diff --git a/arm/containerservice/version.go b/arm/containerservice/version.go old mode 100644 new mode 100755 index fc81f62f5769..47f91fc6a1f2 --- a/arm/containerservice/version.go +++ b/arm/containerservice/version.go @@ -18,43 +18,12 @@ package containerservice // Changes may cause incorrect behavior and will be lost if the code is // regenerated. -import ( - "bytes" - "fmt" - "strings" -) - -const ( - major = "8" - minor = "1" - patch = "0" - tag = "beta" - userAgentFormat = "Azure-SDK-For-Go/%s arm-%s/%s" -) - -// cached results of UserAgent and Version to prevent repeated operations. -var ( - userAgent string - version string -) - // UserAgent returns the UserAgent string to use when sending http.Requests. func UserAgent() string { - if userAgent == "" { - userAgent = fmt.Sprintf(userAgentFormat, Version(), "containerservice", "2017-01-31") - } - return userAgent + return "Azure-SDK-For-Go/v9.0.0-beta arm-containerservice/2016-09-30" } // Version returns the semantic version (see http://semver.org) of the client. func Version() string { - if version == "" { - versionBuilder := bytes.NewBufferString(fmt.Sprintf("%s.%s.%s", major, minor, patch)) - if tag != "" { - versionBuilder.WriteRune('-') - versionBuilder.WriteString(strings.TrimPrefix(tag, "-")) - } - version = string(versionBuilder.Bytes()) - } - return version + return "v9.0.0-beta" } diff --git a/arm/datalake-analytics/account/accountgroup.go b/arm/datalake-analytics/account/accountgroup.go old mode 100644 new mode 100755 index 00b42dc06be5..857db12ce19a --- a/arm/datalake-analytics/account/accountgroup.go +++ b/arm/datalake-analytics/account/accountgroup.go @@ -14,7 +14,7 @@ package account // See the License for the specific language governing permissions and // limitations under the License. // -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.0 +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 // Changes may cause incorrect behavior and will be lost if the code is // regenerated. @@ -96,8 +96,9 @@ func (client GroupClient) CreatePreparer(resourceGroupName string, accountName s "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-11-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -166,8 +167,9 @@ func (client GroupClient) DeletePreparer(resourceGroupName string, accountName s "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-11-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -231,8 +233,9 @@ func (client GroupClient) GetPreparer(resourceGroupName string, accountName stri "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-11-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -311,8 +314,9 @@ func (client GroupClient) ListPreparer(filter string, top *int32, skip *int32, s "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-11-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } if len(filter) > 0 { queryParameters["$filter"] = autorest.Encode("query", filter) @@ -436,8 +440,9 @@ func (client GroupClient) ListByResourceGroupPreparer(resourceGroupName string, "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-11-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } if len(filter) > 0 { queryParameters["$filter"] = autorest.Encode("query", filter) @@ -547,8 +552,9 @@ func (client GroupClient) UpdatePreparer(resourceGroupName string, accountName s "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-11-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( diff --git a/arm/datalake-analytics/account/client.go b/arm/datalake-analytics/account/client.go old mode 100644 new mode 100755 index 4a1645ea350a..41f91ac70904 --- a/arm/datalake-analytics/account/client.go +++ b/arm/datalake-analytics/account/client.go @@ -18,7 +18,7 @@ package account // See the License for the specific language governing permissions and // limitations under the License. // -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.0 +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 // Changes may cause incorrect behavior and will be lost if the code is // regenerated. @@ -27,9 +27,6 @@ import ( ) const ( - // APIVersion is the version of the Account - APIVersion = "2016-11-01" - // DefaultBaseURI is the default URI used for the service Account DefaultBaseURI = "https://management.azure.com" ) @@ -38,7 +35,6 @@ const ( type ManagementClient struct { autorest.Client BaseURI string - APIVersion string SubscriptionID string } @@ -52,7 +48,6 @@ func NewWithBaseURI(baseURI string, subscriptionID string) ManagementClient { return ManagementClient{ Client: autorest.NewClientWithUserAgent(UserAgent()), BaseURI: baseURI, - APIVersion: APIVersion, SubscriptionID: subscriptionID, } } diff --git a/arm/datalake-analytics/account/datalakestoreaccounts.go b/arm/datalake-analytics/account/datalakestoreaccounts.go old mode 100644 new mode 100755 index 00f194c78001..629fe0ef4f5d --- a/arm/datalake-analytics/account/datalakestoreaccounts.go +++ b/arm/datalake-analytics/account/datalakestoreaccounts.go @@ -14,7 +14,7 @@ package account // See the License for the specific language governing permissions and // limitations under the License. // -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.0 +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 // Changes may cause incorrect behavior and will be lost if the code is // regenerated. @@ -80,8 +80,9 @@ func (client DataLakeStoreAccountsClient) AddPreparer(resourceGroupName string, "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-11-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -152,8 +153,9 @@ func (client DataLakeStoreAccountsClient) DeletePreparer(resourceGroupName strin "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-11-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -219,8 +221,9 @@ func (client DataLakeStoreAccountsClient) GetPreparer(resourceGroupName string, "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-11-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -305,8 +308,9 @@ func (client DataLakeStoreAccountsClient) ListByAccountPreparer(resourceGroupNam "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-11-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } if len(filter) > 0 { queryParameters["$filter"] = autorest.Encode("query", filter) diff --git a/arm/datalake-analytics/account/firewallrules.go b/arm/datalake-analytics/account/firewallrules.go new file mode 100755 index 000000000000..043ba81e8198 --- /dev/null +++ b/arm/datalake-analytics/account/firewallrules.go @@ -0,0 +1,422 @@ +package account + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// 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/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// FirewallRulesClient is the creates an Azure Data Lake Analytics account +// management client. +type FirewallRulesClient struct { + ManagementClient +} + +// 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. +func NewFirewallRulesClientWithBaseURI(baseURI string, subscriptionID string) FirewallRulesClient { + return FirewallRulesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates or updates the specified firewall rule. During +// update, the firewall rule with the specified name will be replaced with this +// new firewall rule. +// +// resourceGroupName is the name of the Azure resource group that contains the +// Data Lake Analytics account. accountName is the name of the Data Lake +// Analytics account to add or replace the firewall rule. firewallRuleName is +// the name of the firewall rule to create or update. parameters is parameters +// supplied to create or update the firewall rule. +func (client FirewallRulesClient) CreateOrUpdate(resourceGroupName string, accountName string, firewallRuleName string, parameters FirewallRule) (result FirewallRule, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.FirewallRuleProperties", Name: validation.Null, Rule: true, + 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.NewErrorWithValidationError(err, "account.FirewallRulesClient", "CreateOrUpdate") + } + + req, err := client.CreateOrUpdatePreparer(resourceGroupName, accountName, firewallRuleName, parameters) + if err != nil { + return result, autorest.NewErrorWithError(err, "account.FirewallRulesClient", "CreateOrUpdate", nil, "Failure preparing request") + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "account.FirewallRulesClient", "CreateOrUpdate", resp, "Failure sending request") + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "account.FirewallRulesClient", "CreateOrUpdate", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client FirewallRulesClient) CreateOrUpdatePreparer(resourceGroupName string, accountName string, firewallRuleName string, parameters FirewallRule) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "firewallRuleName": autorest.Encode("path", firewallRuleName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-11-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeAnalytics/accounts/{accountName}/firewallRules/{firewallRuleName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// 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 autorest.SendWithSender(client, req) +} + +// 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, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes the specified firewall rule from the specified Data Lake +// Analytics account +// +// resourceGroupName is the name of the Azure resource group that contains the +// Data Lake Analytics account. accountName is the name of the Data Lake +// Analytics account from which to delete the firewall rule. firewallRuleName +// is the name of the firewall rule to delete. +func (client FirewallRulesClient) Delete(resourceGroupName string, accountName string, firewallRuleName string) (result autorest.Response, err error) { + req, err := client.DeletePreparer(resourceGroupName, accountName, firewallRuleName) + if err != nil { + return result, autorest.NewErrorWithError(err, "account.FirewallRulesClient", "Delete", nil, "Failure preparing request") + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + return result, autorest.NewErrorWithError(err, "account.FirewallRulesClient", "Delete", resp, "Failure sending request") + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "account.FirewallRulesClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client FirewallRulesClient) DeletePreparer(resourceGroupName string, accountName string, firewallRuleName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "firewallRuleName": autorest.Encode("path", firewallRuleName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-11-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.DataLakeAnalytics/accounts/{accountName}/firewallRules/{firewallRuleName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// 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 autorest.SendWithSender(client, req) +} + +// 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, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets the specified Data Lake Analytics firewall rule. +// +// resourceGroupName is the name of the Azure resource group that contains the +// Data Lake Analytics account. accountName is the name of the Data Lake +// Analytics account from which to get the firewall rule. firewallRuleName is +// the name of the firewall rule to retrieve. +func (client FirewallRulesClient) Get(resourceGroupName string, accountName string, firewallRuleName string) (result FirewallRule, err error) { + req, err := client.GetPreparer(resourceGroupName, accountName, firewallRuleName) + if err != nil { + return result, autorest.NewErrorWithError(err, "account.FirewallRulesClient", "Get", nil, "Failure preparing request") + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "account.FirewallRulesClient", "Get", resp, "Failure sending request") + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "account.FirewallRulesClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client FirewallRulesClient) GetPreparer(resourceGroupName string, accountName string, firewallRuleName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "firewallRuleName": autorest.Encode("path", firewallRuleName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-11-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeAnalytics/accounts/{accountName}/firewallRules/{firewallRuleName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// 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 autorest.SendWithSender(client, req) +} + +// 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, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByAccount lists the Data Lake Analytics firewall rules within the +// specified Data Lake Analytics account. +// +// resourceGroupName is the name of the Azure resource group that contains the +// Data Lake Analytics account. accountName is the name of the Data Lake +// Analytics account from which to get the firewall rules. +func (client FirewallRulesClient) ListByAccount(resourceGroupName string, accountName string) (result DataLakeAnalyticsFirewallRuleListResult, err error) { + req, err := client.ListByAccountPreparer(resourceGroupName, accountName) + if err != nil { + return result, autorest.NewErrorWithError(err, "account.FirewallRulesClient", "ListByAccount", nil, "Failure preparing request") + } + + resp, err := client.ListByAccountSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "account.FirewallRulesClient", "ListByAccount", resp, "Failure sending request") + } + + result, err = client.ListByAccountResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "account.FirewallRulesClient", "ListByAccount", resp, "Failure responding to request") + } + + return +} + +// ListByAccountPreparer prepares the ListByAccount request. +func (client FirewallRulesClient) ListByAccountPreparer(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 = "2016-11-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeAnalytics/accounts/{accountName}/firewallRules", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListByAccountSender sends the ListByAccount request. The method will close the +// http.Response Body if it receives an error. +func (client FirewallRulesClient) ListByAccountSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListByAccountResponder handles the response to the ListByAccount request. The method always +// closes the http.Response Body. +func (client FirewallRulesClient) ListByAccountResponder(resp *http.Response) (result DataLakeAnalyticsFirewallRuleListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByAccountNextResults retrieves the next set of results, if any. +func (client FirewallRulesClient) ListByAccountNextResults(lastResults DataLakeAnalyticsFirewallRuleListResult) (result DataLakeAnalyticsFirewallRuleListResult, err error) { + req, err := lastResults.DataLakeAnalyticsFirewallRuleListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "account.FirewallRulesClient", "ListByAccount", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListByAccountSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "account.FirewallRulesClient", "ListByAccount", resp, "Failure sending next results request") + } + + result, err = client.ListByAccountResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "account.FirewallRulesClient", "ListByAccount", resp, "Failure responding to next results request") + } + + return +} + +// Update updates the specified firewall rule. +// +// resourceGroupName is the name of the Azure resource group that contains the +// Data Lake Analytics account. accountName is the name of the Data Lake +// Analytics account to which to update the firewall rule. firewallRuleName is +// the name of the firewall rule to update. parameters is parameters supplied +// to update the firewall rule. +func (client FirewallRulesClient) Update(resourceGroupName string, accountName string, firewallRuleName string, parameters *UpdateFirewallRuleParameters) (result FirewallRule, err error) { + req, err := client.UpdatePreparer(resourceGroupName, accountName, firewallRuleName, parameters) + if err != nil { + return result, autorest.NewErrorWithError(err, "account.FirewallRulesClient", "Update", nil, "Failure preparing request") + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "account.FirewallRulesClient", "Update", resp, "Failure sending request") + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "account.FirewallRulesClient", "Update", resp, "Failure responding to request") + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client FirewallRulesClient) UpdatePreparer(resourceGroupName string, accountName string, firewallRuleName string, parameters *UpdateFirewallRuleParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "firewallRuleName": autorest.Encode("path", firewallRuleName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-11-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeAnalytics/accounts/{accountName}/firewallRules/{firewallRuleName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + if parameters != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithJSON(parameters)) + } + return preparer.Prepare(&http.Request{}) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client FirewallRulesClient) UpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client FirewallRulesClient) UpdateResponder(resp *http.Response) (result FirewallRule, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/arm/datalake-analytics/account/models.go b/arm/datalake-analytics/account/models.go old mode 100644 new mode 100755 index 83fda5edfefa..8ca7a8d2a129 --- a/arm/datalake-analytics/account/models.go +++ b/arm/datalake-analytics/account/models.go @@ -14,7 +14,7 @@ package account // See the License for the specific language governing permissions and // limitations under the License. // -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.0 +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 // Changes may cause incorrect behavior and will be lost if the code is // regenerated. @@ -71,6 +71,30 @@ const ( Suspending DataLakeAnalyticsAccountStatus = "Suspending" ) +// FirewallAllowAzureIpsState enumerates the values for firewall allow azure +// ips state. +type FirewallAllowAzureIpsState string + +const ( + // Disabled specifies the disabled state for firewall allow azure ips + // state. + Disabled FirewallAllowAzureIpsState = "Disabled" + // Enabled specifies the enabled state for firewall allow azure ips state. + Enabled FirewallAllowAzureIpsState = "Enabled" +) + +// FirewallState enumerates the values for firewall state. +type FirewallState string + +const ( + // FirewallStateDisabled specifies the firewall state disabled state for + // firewall state. + FirewallStateDisabled FirewallState = "Disabled" + // FirewallStateEnabled specifies the firewall state enabled state for + // firewall state. + FirewallStateEnabled FirewallState = "Enabled" +) + // TierType enumerates the values for tier type. type TierType string @@ -204,6 +228,9 @@ type DataLakeAnalyticsAccountProperties struct { Endpoint *string `json:"endpoint,omitempty"` NewTier TierType `json:"newTier,omitempty"` CurrentTier TierType `json:"currentTier,omitempty"` + FirewallState FirewallState `json:"firewallState,omitempty"` + FirewallAllowAzureIps FirewallAllowAzureIpsState `json:"firewallAllowAzureIps,omitempty"` + FirewallRules *[]FirewallRule `json:"firewallRules,omitempty"` } // DataLakeAnalyticsAccountUpdateParameters is the parameters that can be used @@ -213,6 +240,26 @@ type DataLakeAnalyticsAccountUpdateParameters struct { *UpdateDataLakeAnalyticsAccountProperties `json:"properties,omitempty"` } +// DataLakeAnalyticsFirewallRuleListResult is data Lake Analytics firewall rule +// list information. +type DataLakeAnalyticsFirewallRuleListResult struct { + autorest.Response `json:"-"` + Value *[]FirewallRule `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// DataLakeAnalyticsFirewallRuleListResultPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client DataLakeAnalyticsFirewallRuleListResult) DataLakeAnalyticsFirewallRuleListResultPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + // DataLakeStoreAccountInfo is data Lake Store account information. type DataLakeStoreAccountInfo struct { autorest.Response `json:"-"` @@ -228,11 +275,20 @@ type DataLakeStoreAccountInfoProperties struct { Suffix *string `json:"suffix,omitempty"` } -// ErrorDetails is generic resource error details information. -type ErrorDetails struct { - Code *string `json:"code,omitempty"` - Message *string `json:"message,omitempty"` - Target *string `json:"target,omitempty"` +// FirewallRule is data Lake Analytics firewall rule information +type FirewallRule struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + *FirewallRuleProperties `json:"properties,omitempty"` +} + +// FirewallRuleProperties is data Lake Analytics firewall rule properties +// information +type FirewallRuleProperties struct { + StartIPAddress *string `json:"startIpAddress,omitempty"` + EndIPAddress *string `json:"endIpAddress,omitempty"` } // ListSasTokensResult is the SAS response that contains the storage account, @@ -275,6 +331,14 @@ func (client ListStorageContainersResult) ListStorageContainersResultPreparer() autorest.WithBaseURL(to.String(client.NextLink))) } +// OptionalSubResource is the Resource model definition for a nested resource +// with no required properties. +type OptionalSubResource struct { + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` +} + // Resource is the Resource model definition. type Resource struct { ID *string `json:"id,omitempty"` @@ -329,10 +393,26 @@ type SubResource struct { // UpdateDataLakeAnalyticsAccountProperties is the properties to update that // are associated with an underlying Data Lake Analytics account to. type UpdateDataLakeAnalyticsAccountProperties struct { - MaxDegreeOfParallelism *int32 `json:"maxDegreeOfParallelism,omitempty"` - QueryStoreRetention *int32 `json:"queryStoreRetention,omitempty"` - MaxJobCount *int32 `json:"maxJobCount,omitempty"` - NewTier TierType `json:"newTier,omitempty"` + MaxDegreeOfParallelism *int32 `json:"maxDegreeOfParallelism,omitempty"` + QueryStoreRetention *int32 `json:"queryStoreRetention,omitempty"` + MaxJobCount *int32 `json:"maxJobCount,omitempty"` + NewTier TierType `json:"newTier,omitempty"` + FirewallState FirewallState `json:"firewallState,omitempty"` + FirewallAllowAzureIps FirewallAllowAzureIpsState `json:"firewallAllowAzureIps,omitempty"` + FirewallRules *[]FirewallRule `json:"firewallRules,omitempty"` +} + +// UpdateFirewallRuleParameters is data Lake Analytics firewall rule update +// parameters +type UpdateFirewallRuleParameters struct { + *UpdateFirewallRuleProperties `json:"properties,omitempty"` +} + +// UpdateFirewallRuleProperties is data Lake Analytics firewall rule properties +// information +type UpdateFirewallRuleProperties struct { + StartIPAddress *string `json:"startIpAddress,omitempty"` + EndIPAddress *string `json:"endIpAddress,omitempty"` } // UpdateStorageAccountParameters is storage account parameters for a storage diff --git a/arm/datalake-analytics/account/storageaccounts.go b/arm/datalake-analytics/account/storageaccounts.go old mode 100644 new mode 100755 index 5aee409c0c9b..4a9089d3cb72 --- a/arm/datalake-analytics/account/storageaccounts.go +++ b/arm/datalake-analytics/account/storageaccounts.go @@ -14,7 +14,7 @@ package account // See the License for the specific language governing permissions and // limitations under the License. // -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.0 +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 // Changes may cause incorrect behavior and will be lost if the code is // regenerated. @@ -88,8 +88,9 @@ func (client StorageAccountsClient) AddPreparer(resourceGroupName string, accoun "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-11-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -156,8 +157,9 @@ func (client StorageAccountsClient) DeletePreparer(resourceGroupName string, acc "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-11-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -223,8 +225,9 @@ func (client StorageAccountsClient) GetPreparer(resourceGroupName string, accoun "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-11-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -293,8 +296,9 @@ func (client StorageAccountsClient) GetStorageContainerPreparer(resourceGroupNam "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-11-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -379,8 +383,9 @@ func (client StorageAccountsClient) ListByAccountPreparer(resourceGroupName stri "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-11-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } if len(filter) > 0 { queryParameters["$filter"] = autorest.Encode("query", filter) @@ -491,8 +496,9 @@ func (client StorageAccountsClient) ListSasTokensPreparer(resourceGroupName stri "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-11-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -585,8 +591,9 @@ func (client StorageAccountsClient) ListStorageContainersPreparer(resourceGroupN "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-11-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -678,8 +685,9 @@ func (client StorageAccountsClient) UpdatePreparer(resourceGroupName string, acc "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-11-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( diff --git a/arm/datalake-analytics/account/version.go b/arm/datalake-analytics/account/version.go old mode 100644 new mode 100755 index 967046476e40..6d5381fe019c --- a/arm/datalake-analytics/account/version.go +++ b/arm/datalake-analytics/account/version.go @@ -18,43 +18,12 @@ package account // Changes may cause incorrect behavior and will be lost if the code is // regenerated. -import ( - "bytes" - "fmt" - "strings" -) - -const ( - major = "8" - minor = "1" - patch = "0" - tag = "beta" - userAgentFormat = "Azure-SDK-For-Go/%s arm-%s/%s" -) - -// cached results of UserAgent and Version to prevent repeated operations. -var ( - userAgent string - version string -) - // UserAgent returns the UserAgent string to use when sending http.Requests. func UserAgent() string { - if userAgent == "" { - userAgent = fmt.Sprintf(userAgentFormat, Version(), "account", "2016-11-01") - } - return userAgent + return "Azure-SDK-For-Go/v9.0.0-beta arm-account/2016-11-01" } // Version returns the semantic version (see http://semver.org) of the client. func Version() string { - if version == "" { - versionBuilder := bytes.NewBufferString(fmt.Sprintf("%s.%s.%s", major, minor, patch)) - if tag != "" { - versionBuilder.WriteRune('-') - versionBuilder.WriteString(strings.TrimPrefix(tag, "-")) - } - version = string(versionBuilder.Bytes()) - } - return version + return "v9.0.0-beta" } diff --git a/arm/datalake-store/account/accountgroup.go b/arm/datalake-store/account/accountgroup.go old mode 100644 new mode 100755 index 897830ef30e2..7e50c31ecd10 --- a/arm/datalake-store/account/accountgroup.go +++ b/arm/datalake-store/account/accountgroup.go @@ -94,8 +94,9 @@ func (client GroupClient) CreatePreparer(resourceGroupName string, name string, "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-11-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -164,8 +165,9 @@ func (client GroupClient) DeletePreparer(resourceGroupName string, name string, "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-11-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -230,8 +232,9 @@ func (client GroupClient) EnableKeyVaultPreparer(resourceGroupName string, accou "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-11-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -293,8 +296,9 @@ func (client GroupClient) GetPreparer(resourceGroupName string, name string) (*h "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-11-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -373,8 +377,9 @@ func (client GroupClient) ListPreparer(filter string, top *int32, skip *int32, s "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-11-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } if len(filter) > 0 { queryParameters["$filter"] = autorest.Encode("query", filter) @@ -498,8 +503,9 @@ func (client GroupClient) ListByResourceGroupPreparer(resourceGroupName string, "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-11-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } if len(filter) > 0 { queryParameters["$filter"] = autorest.Encode("query", filter) @@ -608,8 +614,9 @@ func (client GroupClient) UpdatePreparer(resourceGroupName string, name string, "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-11-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( diff --git a/arm/datalake-store/account/client.go b/arm/datalake-store/account/client.go old mode 100644 new mode 100755 index 489773bbd44e..b48c790c3e86 --- a/arm/datalake-store/account/client.go +++ b/arm/datalake-store/account/client.go @@ -27,9 +27,6 @@ import ( ) const ( - // APIVersion is the version of the Account - APIVersion = "2016-11-01" - // DefaultBaseURI is the default URI used for the service Account DefaultBaseURI = "https://management.azure.com" ) @@ -38,7 +35,6 @@ const ( type ManagementClient struct { autorest.Client BaseURI string - APIVersion string SubscriptionID string } @@ -52,7 +48,6 @@ func NewWithBaseURI(baseURI string, subscriptionID string) ManagementClient { return ManagementClient{ Client: autorest.NewClientWithUserAgent(UserAgent()), BaseURI: baseURI, - APIVersion: APIVersion, SubscriptionID: subscriptionID, } } diff --git a/arm/datalake-store/account/firewallrules.go b/arm/datalake-store/account/firewallrules.go old mode 100644 new mode 100755 index e93daf8a80d8..31e24f5f8d7f --- a/arm/datalake-store/account/firewallrules.go +++ b/arm/datalake-store/account/firewallrules.go @@ -90,8 +90,9 @@ func (client FirewallRulesClient) CreateOrUpdatePreparer(resourceGroupName strin "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-11-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -159,8 +160,9 @@ func (client FirewallRulesClient) DeletePreparer(resourceGroupName string, accou "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-11-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -224,8 +226,9 @@ func (client FirewallRulesClient) GetPreparer(resourceGroupName string, accountN "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-11-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -289,8 +292,9 @@ func (client FirewallRulesClient) ListByAccountPreparer(resourceGroupName string "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-11-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -380,8 +384,9 @@ func (client FirewallRulesClient) UpdatePreparer(resourceGroupName string, accou "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-11-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( diff --git a/arm/datalake-store/account/models.go b/arm/datalake-store/account/models.go old mode 100644 new mode 100755 diff --git a/arm/datalake-store/account/trustedidproviders.go b/arm/datalake-store/account/trustedidproviders.go old mode 100644 new mode 100755 index 86f5160880dc..33d603665b66 --- a/arm/datalake-store/account/trustedidproviders.go +++ b/arm/datalake-store/account/trustedidproviders.go @@ -89,8 +89,9 @@ func (client TrustedIDProvidersClient) CreateOrUpdatePreparer(resourceGroupName "trustedIdProviderName": autorest.Encode("path", trustedIDProviderName), } + const APIVersion = "2016-11-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -159,8 +160,9 @@ func (client TrustedIDProvidersClient) DeletePreparer(resourceGroupName string, "trustedIdProviderName": autorest.Encode("path", trustedIDProviderName), } + const APIVersion = "2016-11-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -225,8 +227,9 @@ func (client TrustedIDProvidersClient) GetPreparer(resourceGroupName string, acc "trustedIdProviderName": autorest.Encode("path", trustedIDProviderName), } + const APIVersion = "2016-11-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -290,8 +293,9 @@ func (client TrustedIDProvidersClient) ListByAccountPreparer(resourceGroupName s "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-11-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -382,8 +386,9 @@ func (client TrustedIDProvidersClient) UpdatePreparer(resourceGroupName string, "trustedIdProviderName": autorest.Encode("path", trustedIDProviderName), } + const APIVersion = "2016-11-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( diff --git a/arm/datalake-store/account/version.go b/arm/datalake-store/account/version.go old mode 100644 new mode 100755 index 967046476e40..6d5381fe019c --- a/arm/datalake-store/account/version.go +++ b/arm/datalake-store/account/version.go @@ -18,43 +18,12 @@ package account // Changes may cause incorrect behavior and will be lost if the code is // regenerated. -import ( - "bytes" - "fmt" - "strings" -) - -const ( - major = "8" - minor = "1" - patch = "0" - tag = "beta" - userAgentFormat = "Azure-SDK-For-Go/%s arm-%s/%s" -) - -// cached results of UserAgent and Version to prevent repeated operations. -var ( - userAgent string - version string -) - // UserAgent returns the UserAgent string to use when sending http.Requests. func UserAgent() string { - if userAgent == "" { - userAgent = fmt.Sprintf(userAgentFormat, Version(), "account", "2016-11-01") - } - return userAgent + return "Azure-SDK-For-Go/v9.0.0-beta arm-account/2016-11-01" } // Version returns the semantic version (see http://semver.org) of the client. func Version() string { - if version == "" { - versionBuilder := bytes.NewBufferString(fmt.Sprintf("%s.%s.%s", major, minor, patch)) - if tag != "" { - versionBuilder.WriteRune('-') - versionBuilder.WriteString(strings.TrimPrefix(tag, "-")) - } - version = string(versionBuilder.Bytes()) - } - return version + return "v9.0.0-beta" } diff --git a/arm/disk/client.go b/arm/disk/client.go old mode 100644 new mode 100755 index d64eb228798e..8bab7acc1324 --- a/arm/disk/client.go +++ b/arm/disk/client.go @@ -27,9 +27,6 @@ import ( ) const ( - // APIVersion is the version of the Disk - APIVersion = "2016-04-30-preview" - // DefaultBaseURI is the default URI used for the service Disk DefaultBaseURI = "https://management.azure.com" ) @@ -38,7 +35,6 @@ const ( type ManagementClient struct { autorest.Client BaseURI string - APIVersion string SubscriptionID string } @@ -52,7 +48,6 @@ func NewWithBaseURI(baseURI string, subscriptionID string) ManagementClient { return ManagementClient{ Client: autorest.NewClientWithUserAgent(UserAgent()), BaseURI: baseURI, - APIVersion: APIVersion, SubscriptionID: subscriptionID, } } diff --git a/arm/disk/disks.go b/arm/disk/disks.go old mode 100644 new mode 100755 index 6fb03876f4e5..5653b185f5d8 --- a/arm/disk/disks.go +++ b/arm/disk/disks.go @@ -97,8 +97,9 @@ func (client DisksClient) CreateOrUpdatePreparer(resourceGroupName string, diskN "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-04-30-preview" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -165,8 +166,9 @@ func (client DisksClient) DeletePreparer(resourceGroupName string, diskName stri "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-04-30-preview" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -229,8 +231,9 @@ func (client DisksClient) GetPreparer(resourceGroupName string, diskName string) "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-04-30-preview" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -301,8 +304,9 @@ func (client DisksClient) GrantAccessPreparer(resourceGroupName string, diskName "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-04-30-preview" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -362,8 +366,9 @@ func (client DisksClient) ListPreparer() (*http.Request, error) { "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-04-30-preview" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -447,8 +452,9 @@ func (client DisksClient) ListByResourceGroupPreparer(resourceGroupName string) "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-04-30-preview" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -536,8 +542,9 @@ func (client DisksClient) RevokeAccessPreparer(resourceGroupName string, diskNam "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-04-30-preview" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -603,8 +610,9 @@ func (client DisksClient) UpdatePreparer(resourceGroupName string, diskName stri "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-04-30-preview" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( diff --git a/arm/disk/models.go b/arm/disk/models.go old mode 100644 new mode 100755 diff --git a/arm/disk/snapshots.go b/arm/disk/snapshots.go old mode 100644 new mode 100755 index 20e6ec758bd4..55c51822a8cf --- a/arm/disk/snapshots.go +++ b/arm/disk/snapshots.go @@ -98,8 +98,9 @@ func (client SnapshotsClient) CreateOrUpdatePreparer(resourceGroupName string, s "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-04-30-preview" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -166,8 +167,9 @@ func (client SnapshotsClient) DeletePreparer(resourceGroupName string, snapshotN "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-04-30-preview" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -230,8 +232,9 @@ func (client SnapshotsClient) GetPreparer(resourceGroupName string, snapshotName "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-04-30-preview" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -304,8 +307,9 @@ func (client SnapshotsClient) GrantAccessPreparer(resourceGroupName string, snap "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-04-30-preview" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -365,8 +369,9 @@ func (client SnapshotsClient) ListPreparer() (*http.Request, error) { "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-04-30-preview" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -450,8 +455,9 @@ func (client SnapshotsClient) ListByResourceGroupPreparer(resourceGroupName stri "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-04-30-preview" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -540,8 +546,9 @@ func (client SnapshotsClient) RevokeAccessPreparer(resourceGroupName string, sna "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-04-30-preview" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -608,8 +615,9 @@ func (client SnapshotsClient) UpdatePreparer(resourceGroupName string, snapshotN "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-04-30-preview" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( diff --git a/arm/disk/version.go b/arm/disk/version.go old mode 100644 new mode 100755 index 9b5497d54d5e..093c23a5437a --- a/arm/disk/version.go +++ b/arm/disk/version.go @@ -18,43 +18,12 @@ package disk // Changes may cause incorrect behavior and will be lost if the code is // regenerated. -import ( - "bytes" - "fmt" - "strings" -) - -const ( - major = "8" - minor = "1" - patch = "0" - tag = "beta" - userAgentFormat = "Azure-SDK-For-Go/%s arm-%s/%s" -) - -// cached results of UserAgent and Version to prevent repeated operations. -var ( - userAgent string - version string -) - // UserAgent returns the UserAgent string to use when sending http.Requests. func UserAgent() string { - if userAgent == "" { - userAgent = fmt.Sprintf(userAgentFormat, Version(), "disk", "2016-04-30-preview") - } - return userAgent + return "Azure-SDK-For-Go/v9.0.0-beta arm-disk/2016-04-30-preview" } // Version returns the semantic version (see http://semver.org) of the client. func Version() string { - if version == "" { - versionBuilder := bytes.NewBufferString(fmt.Sprintf("%s.%s.%s", major, minor, patch)) - if tag != "" { - versionBuilder.WriteRune('-') - versionBuilder.WriteString(strings.TrimPrefix(tag, "-")) - } - version = string(versionBuilder.Bytes()) - } - return version + return "v9.0.0-beta" } diff --git a/arm/dns/client.go b/arm/dns/client.go old mode 100644 new mode 100755 index 4bcc2b9147ba..05ef369957d0 --- a/arm/dns/client.go +++ b/arm/dns/client.go @@ -17,7 +17,7 @@ package dns // See the License for the specific language governing permissions and // limitations under the License. // -// Code generated by Microsoft (R) AutoRest Code Generator 0.17.0.0 +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 // Changes may cause incorrect behavior and will be lost if the code is // regenerated. @@ -26,9 +26,6 @@ import ( ) const ( - // APIVersion is the version of the Dns - APIVersion = "2016-04-01" - // DefaultBaseURI is the default URI used for the service Dns DefaultBaseURI = "https://management.azure.com" ) @@ -37,7 +34,6 @@ const ( type ManagementClient struct { autorest.Client BaseURI string - APIVersion string SubscriptionID string } @@ -51,7 +47,6 @@ func NewWithBaseURI(baseURI string, subscriptionID string) ManagementClient { return ManagementClient{ Client: autorest.NewClientWithUserAgent(UserAgent()), BaseURI: baseURI, - APIVersion: APIVersion, SubscriptionID: subscriptionID, } } diff --git a/arm/dns/models.go b/arm/dns/models.go old mode 100644 new mode 100755 index fb8681393708..a95db4a295e0 --- a/arm/dns/models.go +++ b/arm/dns/models.go @@ -14,7 +14,7 @@ package dns // See the License for the specific language governing permissions and // limitations under the License. // -// Code generated by Microsoft (R) AutoRest Code Generator 0.17.0.0 +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 // Changes may cause incorrect behavior and will be lost if the code is // regenerated. @@ -42,8 +42,8 @@ const ( Continue HTTPStatusCode = "Continue" // Created specifies the created state for http status code. Created HTTPStatusCode = "Created" - // ExpectationFailed specifies the expectation failed state for http - // status code. + // ExpectationFailed specifies the expectation failed state for http status + // code. ExpectationFailed HTTPStatusCode = "ExpectationFailed" // Forbidden specifies the forbidden state for http status code. Forbidden HTTPStatusCode = "Forbidden" @@ -126,13 +126,13 @@ const ( // SwitchingProtocols specifies the switching protocols state for http // status code. SwitchingProtocols HTTPStatusCode = "SwitchingProtocols" - // TemporaryRedirect specifies the temporary redirect state for http - // status code. + // TemporaryRedirect specifies the temporary redirect state for http status + // code. TemporaryRedirect HTTPStatusCode = "TemporaryRedirect" // Unauthorized specifies the unauthorized state for http status code. Unauthorized HTTPStatusCode = "Unauthorized" - // UnsupportedMediaType specifies the unsupported media type state for - // http status code. + // UnsupportedMediaType specifies the unsupported media type state for http + // status code. UnsupportedMediaType HTTPStatusCode = "UnsupportedMediaType" // Unused specifies the unused state for http status code. Unused HTTPStatusCode = "Unused" @@ -259,14 +259,14 @@ type RecordSetProperties struct { Metadata *map[string]*string `json:"metadata,omitempty"` TTL *int64 `json:"TTL,omitempty"` ARecords *[]ARecord `json:"ARecords,omitempty"` - AAAARecords *[]AaaaRecord `json:"AAAARecords,omitempty"` - MXRecords *[]MxRecord `json:"MXRecords,omitempty"` - NSRecords *[]NsRecord `json:"NSRecords,omitempty"` - PTRRecords *[]PtrRecord `json:"PTRRecords,omitempty"` - SRVRecords *[]SrvRecord `json:"SRVRecords,omitempty"` - TXTRecords *[]TxtRecord `json:"TXTRecords,omitempty"` - CNAMERecord *CnameRecord `json:"CNAMERecord,omitempty"` - SOARecord *SoaRecord `json:"SOARecord,omitempty"` + AaaaRecords *[]AaaaRecord `json:"AAAARecords,omitempty"` + MxRecords *[]MxRecord `json:"MXRecords,omitempty"` + NsRecords *[]NsRecord `json:"NSRecords,omitempty"` + PtrRecords *[]PtrRecord `json:"PTRRecords,omitempty"` + SrvRecords *[]SrvRecord `json:"SRVRecords,omitempty"` + TxtRecords *[]TxtRecord `json:"TXTRecords,omitempty"` + CnameRecord *CnameRecord `json:"CNAMERecord,omitempty"` + SoaRecord *SoaRecord `json:"SOARecord,omitempty"` } // RecordSetUpdateParameters is parameters supplied to update a record set. diff --git a/arm/dns/recordsets.go b/arm/dns/recordsets.go old mode 100644 new mode 100755 index 7280a4dc18be..240c42660c55 --- a/arm/dns/recordsets.go +++ b/arm/dns/recordsets.go @@ -14,7 +14,7 @@ package dns // See the License for the specific language governing permissions and // limitations under the License. // -// Code generated by Microsoft (R) AutoRest Code Generator 0.17.0.0 +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 // Changes may cause incorrect behavior and will be lost if the code is // regenerated. @@ -42,18 +42,17 @@ func NewRecordSetsClientWithBaseURI(baseURI string, subscriptionID string) Recor // CreateOrUpdate creates or updates a record set within a DNS zone. // -// resourceGroupName is the name of the resource group. zoneName is the name -// of the DNS zone (without a terminating dot). relativeRecordSetName is the -// name of the record set, relative to the name of the zone. recordType is -// the type of DNS record in this record set. Record sets of type SOA can be -// updated but not created (they are created when the DNS zone is created). -// Possible values include: 'A', 'AAAA', 'CNAME', 'MX', 'NS', 'PTR', 'SOA', -// 'SRV', 'TXT' parameters is parameters supplied to the CreateOrUpdate -// operation. ifMatch is the etag of the record set. Omit this value to -// always overwrite the current record set. Specify the last-seen etag value -// to prevent accidentally overwritting any concurrent changes. ifNoneMatch -// is set to '*' to allow a new record set to be created, but to prevent -// updating an existing record set. Other values will be ignored. +// resourceGroupName is the name of the resource group. zoneName is the name of +// the DNS zone (without a terminating dot). relativeRecordSetName is the name +// of the record set, relative to the name of the zone. recordType is the type +// of DNS record in this record set. Record sets of type SOA can be updated but +// not created (they are created when the DNS zone is created). parameters is +// parameters supplied to the CreateOrUpdate operation. ifMatch is the etag of +// the record set. Omit this value to always overwrite the current record set. +// Specify the last-seen etag value to prevent accidentally overwritting any +// concurrent changes. ifNoneMatch is set to '*' to allow a new record set to +// be created, but to prevent updating an existing record set. Other values +// will be ignored. func (client RecordSetsClient) CreateOrUpdate(resourceGroupName string, zoneName string, relativeRecordSetName string, recordType RecordType, parameters RecordSet, ifMatch string, ifNoneMatch string) (result RecordSet, err error) { req, err := client.CreateOrUpdatePreparer(resourceGroupName, zoneName, relativeRecordSetName, recordType, parameters, ifMatch, ifNoneMatch) if err != nil { @@ -84,8 +83,9 @@ func (client RecordSetsClient) CreateOrUpdatePreparer(resourceGroupName string, "zoneName": autorest.Encode("path", zoneName), } + const APIVersion = "2016-04-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -128,15 +128,14 @@ func (client RecordSetsClient) CreateOrUpdateResponder(resp *http.Response) (res // Delete deletes a record set from a DNS zone. This operation cannot be // undone. // -// resourceGroupName is the name of the resource group. zoneName is the name -// of the DNS zone (without a terminating dot). relativeRecordSetName is the -// name of the record set, relative to the name of the zone. recordType is -// the type of DNS record in this record set. Record sets of type SOA cannot -// be deleted (they are deleted when the DNS zone is deleted). Possible -// values include: 'A', 'AAAA', 'CNAME', 'MX', 'NS', 'PTR', 'SOA', 'SRV', -// 'TXT' ifMatch is the etag of the record set. Omit this value to always -// delete the current record set. Specify the last-seen etag value to prevent -// accidentally deleting any concurrent changes. +// resourceGroupName is the name of the resource group. zoneName is the name of +// the DNS zone (without a terminating dot). relativeRecordSetName is the name +// of the record set, relative to the name of the zone. recordType is the type +// of DNS record in this record set. Record sets of type SOA cannot be deleted +// (they are deleted when the DNS zone is deleted). ifMatch is the etag of the +// record set. Omit this value to always delete the current record set. Specify +// the last-seen etag value to prevent accidentally deleting any concurrent +// changes. func (client RecordSetsClient) Delete(resourceGroupName string, zoneName string, relativeRecordSetName string, recordType RecordType, ifMatch string) (result autorest.Response, err error) { req, err := client.DeletePreparer(resourceGroupName, zoneName, relativeRecordSetName, recordType, ifMatch) if err != nil { @@ -167,8 +166,9 @@ func (client RecordSetsClient) DeletePreparer(resourceGroupName string, zoneName "zoneName": autorest.Encode("path", zoneName), } + const APIVersion = "2016-04-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -203,11 +203,10 @@ func (client RecordSetsClient) DeleteResponder(resp *http.Response) (result auto // Get gets a record set. // -// resourceGroupName is the name of the resource group. zoneName is the name -// of the DNS zone (without a terminating dot). relativeRecordSetName is the -// name of the record set, relative to the name of the zone. recordType is -// the type of DNS record in this record set. Possible values include: 'A', -// 'AAAA', 'CNAME', 'MX', 'NS', 'PTR', 'SOA', 'SRV', 'TXT' +// resourceGroupName is the name of the resource group. zoneName is the name of +// the DNS zone (without a terminating dot). relativeRecordSetName is the name +// of the record set, relative to the name of the zone. recordType is the type +// of DNS record in this record set. func (client RecordSetsClient) Get(resourceGroupName string, zoneName string, relativeRecordSetName string, recordType RecordType) (result RecordSet, err error) { req, err := client.GetPreparer(resourceGroupName, zoneName, relativeRecordSetName, recordType) if err != nil { @@ -238,8 +237,9 @@ func (client RecordSetsClient) GetPreparer(resourceGroupName string, zoneName st "zoneName": autorest.Encode("path", zoneName), } + const APIVersion = "2016-04-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -271,8 +271,8 @@ func (client RecordSetsClient) GetResponder(resp *http.Response) (result RecordS // ListByDNSZone lists all record sets in a DNS zone. // -// resourceGroupName is the name of the resource group. zoneName is the name -// of the DNS zone (without a terminating dot). top is the maximum number of +// resourceGroupName is the name of the resource group. zoneName is the name of +// the DNS zone (without a terminating dot). top is the maximum number of // record sets to return. If not specified, returns up to 100 record sets. func (client RecordSetsClient) ListByDNSZone(resourceGroupName string, zoneName string, top *int32) (result RecordSetListResult, err error) { req, err := client.ListByDNSZonePreparer(resourceGroupName, zoneName, top) @@ -302,8 +302,9 @@ func (client RecordSetsClient) ListByDNSZonePreparer(resourceGroupName string, z "zoneName": autorest.Encode("path", zoneName), } + const APIVersion = "2016-04-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } if top != nil { queryParameters["$top"] = autorest.Encode("query", *top) @@ -362,11 +363,10 @@ func (client RecordSetsClient) ListByDNSZoneNextResults(lastResults RecordSetLis // ListByType lists the record sets of a specified type in a DNS zone. // -// resourceGroupName is the name of the resource group. zoneName is the name -// of the DNS zone (without a terminating dot). recordType is the type of -// record sets to enumerate. Possible values include: 'A', 'AAAA', 'CNAME', -// 'MX', 'NS', 'PTR', 'SOA', 'SRV', 'TXT' top is the maximum number of record -// sets to return. If not specified, returns up to 100 record sets. +// resourceGroupName is the name of the resource group. zoneName is the name of +// the DNS zone (without a terminating dot). recordType is the type of record +// sets to enumerate. top is the maximum number of record sets to return. If +// not specified, returns up to 100 record sets. func (client RecordSetsClient) ListByType(resourceGroupName string, zoneName string, recordType RecordType, top *int32) (result RecordSetListResult, err error) { req, err := client.ListByTypePreparer(resourceGroupName, zoneName, recordType, top) if err != nil { @@ -396,8 +396,9 @@ func (client RecordSetsClient) ListByTypePreparer(resourceGroupName string, zone "zoneName": autorest.Encode("path", zoneName), } + const APIVersion = "2016-04-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } if top != nil { queryParameters["$top"] = autorest.Encode("query", *top) @@ -456,15 +457,13 @@ func (client RecordSetsClient) ListByTypeNextResults(lastResults RecordSetListRe // Update updates a record set within a DNS zone. // -// resourceGroupName is the name of the resource group. zoneName is the name -// of the DNS zone (without a terminating dot). relativeRecordSetName is the -// name of the record set, relative to the name of the zone. recordType is -// the type of DNS record in this record set. Possible values include: 'A', -// 'AAAA', 'CNAME', 'MX', 'NS', 'PTR', 'SOA', 'SRV', 'TXT' parameters is -// parameters supplied to the Update operation. ifMatch is the etag of the -// record set. Omit this value to always overwrite the current record set. -// Specify the last-seen etag value to prevent accidentally overwritting -// concurrent changes. +// resourceGroupName is the name of the resource group. zoneName is the name of +// the DNS zone (without a terminating dot). relativeRecordSetName is the name +// of the record set, relative to the name of the zone. recordType is the type +// of DNS record in this record set. parameters is parameters supplied to the +// Update operation. ifMatch is the etag of the record set. Omit this value to +// always overwrite the current record set. Specify the last-seen etag value to +// prevent accidentally overwritting concurrent changes. func (client RecordSetsClient) Update(resourceGroupName string, zoneName string, relativeRecordSetName string, recordType RecordType, parameters RecordSet, ifMatch string) (result RecordSet, err error) { req, err := client.UpdatePreparer(resourceGroupName, zoneName, relativeRecordSetName, recordType, parameters, ifMatch) if err != nil { @@ -495,8 +494,9 @@ func (client RecordSetsClient) UpdatePreparer(resourceGroupName string, zoneName "zoneName": autorest.Encode("path", zoneName), } + const APIVersion = "2016-04-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( diff --git a/arm/dns/version.go b/arm/dns/version.go old mode 100644 new mode 100755 index 9b2db8c41ba0..530508bf77e6 --- a/arm/dns/version.go +++ b/arm/dns/version.go @@ -18,43 +18,12 @@ package dns // Changes may cause incorrect behavior and will be lost if the code is // regenerated. -import ( - "bytes" - "fmt" - "strings" -) - -const ( - major = "8" - minor = "1" - patch = "0" - tag = "beta" - userAgentFormat = "Azure-SDK-For-Go/%s arm-%s/%s" -) - -// cached results of UserAgent and Version to prevent repeated operations. -var ( - userAgent string - version string -) - // UserAgent returns the UserAgent string to use when sending http.Requests. func UserAgent() string { - if userAgent == "" { - userAgent = fmt.Sprintf(userAgentFormat, Version(), "dns", "2016-04-01") - } - return userAgent + return "Azure-SDK-For-Go/v9.0.0-beta arm-dns/2016-04-01" } // Version returns the semantic version (see http://semver.org) of the client. func Version() string { - if version == "" { - versionBuilder := bytes.NewBufferString(fmt.Sprintf("%s.%s.%s", major, minor, patch)) - if tag != "" { - versionBuilder.WriteRune('-') - versionBuilder.WriteString(strings.TrimPrefix(tag, "-")) - } - version = string(versionBuilder.Bytes()) - } - return version + return "v9.0.0-beta" } diff --git a/arm/dns/zones.go b/arm/dns/zones.go old mode 100644 new mode 100755 index 48dc928986b1..e421f8d9ce10 --- a/arm/dns/zones.go +++ b/arm/dns/zones.go @@ -14,7 +14,7 @@ package dns // See the License for the specific language governing permissions and // limitations under the License. // -// Code generated by Microsoft (R) AutoRest Code Generator 0.17.0.0 +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 // Changes may cause incorrect behavior and will be lost if the code is // regenerated. @@ -42,13 +42,13 @@ func NewZonesClientWithBaseURI(baseURI string, subscriptionID string) ZonesClien // CreateOrUpdate creates or updates a DNS zone. Does not modify DNS records // within the zone. // -// resourceGroupName is the name of the resource group. zoneName is the name -// of the DNS zone (without a terminating dot). parameters is parameters -// supplied to the CreateOrUpdate operation. ifMatch is the etag of the DNS -// zone. Omit this value to always overwrite the current zone. Specify the -// last-seen etag value to prevent accidentally overwritting any concurrent -// changes. ifNoneMatch is set to '*' to allow a new DNS zone to be created, -// but to prevent updating an existing zone. Other values will be ignored. +// resourceGroupName is the name of the resource group. zoneName is the name of +// the DNS zone (without a terminating dot). parameters is parameters supplied +// to the CreateOrUpdate operation. ifMatch is the etag of the DNS zone. Omit +// this value to always overwrite the current zone. Specify the last-seen etag +// value to prevent accidentally overwritting any concurrent changes. +// ifNoneMatch is set to '*' to allow a new DNS zone to be created, but to +// prevent updating an existing zone. Other values will be ignored. func (client ZonesClient) CreateOrUpdate(resourceGroupName string, zoneName string, parameters Zone, ifMatch string, ifNoneMatch string) (result Zone, err error) { req, err := client.CreateOrUpdatePreparer(resourceGroupName, zoneName, parameters, ifMatch, ifNoneMatch) if err != nil { @@ -77,8 +77,9 @@ func (client ZonesClient) CreateOrUpdatePreparer(resourceGroupName string, zoneN "zoneName": autorest.Encode("path", zoneName), } + const APIVersion = "2016-04-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -118,15 +119,15 @@ func (client ZonesClient) CreateOrUpdateResponder(resp *http.Response) (result Z return } -// Delete deletes a DNS zone. WARNING: All DNS records in the zone will also -// be deleted. This operation cannot be undone. This method may poll for -// completion. Polling can be canceled by passing the cancel channel -// argument. The channel will be used to cancel polling and any outstanding -// HTTP requests. +// Delete deletes a DNS zone. WARNING: All DNS records in the zone will also be +// deleted. This operation cannot be undone. This method may poll for +// completion. Polling can be canceled by passing the cancel channel argument. +// The channel will be used to cancel polling and any outstanding HTTP +// requests. // -// resourceGroupName is the name of the resource group. zoneName is the name -// of the DNS zone (without a terminating dot). ifMatch is the etag of the -// DNS zone. Omit this value to always delete the current zone. Specify the +// resourceGroupName is the name of the resource group. zoneName is the name of +// the DNS zone (without a terminating dot). ifMatch is the etag of the DNS +// zone. Omit this value to always delete the current zone. Specify the // last-seen etag value to prevent accidentally deleting any concurrent // changes. func (client ZonesClient) Delete(resourceGroupName string, zoneName string, ifMatch string, cancel <-chan struct{}) (result autorest.Response, err error) { @@ -157,8 +158,9 @@ func (client ZonesClient) DeletePreparer(resourceGroupName string, zoneName stri "zoneName": autorest.Encode("path", zoneName), } + const APIVersion = "2016-04-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -196,8 +198,8 @@ func (client ZonesClient) DeleteResponder(resp *http.Response) (result autorest. // Get gets a DNS zone. Retrieves the zone properties, but not the record sets // within the zone. // -// resourceGroupName is the name of the resource group. zoneName is the name -// of the DNS zone (without a terminating dot). +// resourceGroupName is the name of the resource group. zoneName is the name of +// the DNS zone (without a terminating dot). func (client ZonesClient) Get(resourceGroupName string, zoneName string) (result Zone, err error) { req, err := client.GetPreparer(resourceGroupName, zoneName) if err != nil { @@ -226,8 +228,9 @@ func (client ZonesClient) GetPreparer(resourceGroupName string, zoneName string) "zoneName": autorest.Encode("path", zoneName), } + const APIVersion = "2016-04-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -287,8 +290,9 @@ func (client ZonesClient) ListPreparer(top *int32) (*http.Request, error) { "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-04-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } if top != nil { queryParameters["$top"] = autorest.Encode("query", *top) @@ -348,8 +352,8 @@ func (client ZonesClient) ListNextResults(lastResults ZoneListResult) (result Zo // ListByResourceGroup lists the DNS zones within a resource group. // // resourceGroupName is the name of the resource group. top is the maximum -// number of record sets to return. If not specified, returns up to 100 -// record sets. +// number of record sets to return. If not specified, returns up to 100 record +// sets. func (client ZonesClient) ListByResourceGroup(resourceGroupName string, top *int32) (result ZoneListResult, err error) { req, err := client.ListByResourceGroupPreparer(resourceGroupName, top) if err != nil { @@ -377,8 +381,9 @@ func (client ZonesClient) ListByResourceGroupPreparer(resourceGroupName string, "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-04-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } if top != nil { queryParameters["$top"] = autorest.Encode("query", *top) diff --git a/arm/documentdb/client.go b/arm/documentdb/client.go old mode 100644 new mode 100755 index 48843430495d..5c0752c01209 --- a/arm/documentdb/client.go +++ b/arm/documentdb/client.go @@ -27,9 +27,6 @@ import ( ) const ( - // APIVersion is the version of the Documentdb - APIVersion = "2015-04-08" - // DefaultBaseURI is the default URI used for the service Documentdb DefaultBaseURI = "https://management.azure.com" ) @@ -38,7 +35,6 @@ const ( type ManagementClient struct { autorest.Client BaseURI string - APIVersion string SubscriptionID string } @@ -52,7 +48,6 @@ func NewWithBaseURI(baseURI string, subscriptionID string) ManagementClient { return ManagementClient{ Client: autorest.NewClientWithUserAgent(UserAgent()), BaseURI: baseURI, - APIVersion: APIVersion, SubscriptionID: subscriptionID, } } diff --git a/arm/documentdb/databaseaccounts.go b/arm/documentdb/databaseaccounts.go old mode 100644 new mode 100755 index 58e14cb2223a..86c62aa99af5 --- a/arm/documentdb/databaseaccounts.go +++ b/arm/documentdb/databaseaccounts.go @@ -81,8 +81,9 @@ func (client DatabaseAccountsClient) CheckNameExistsPreparer(accountName string) "accountName": autorest.Encode("path", accountName), } + const APIVersion = "2015-04-08" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -173,8 +174,9 @@ func (client DatabaseAccountsClient) CreateOrUpdatePreparer(resourceGroupName st "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2015-04-08" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -253,8 +255,9 @@ func (client DatabaseAccountsClient) DeletePreparer(resourceGroupName string, ac "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2015-04-08" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -335,8 +338,9 @@ func (client DatabaseAccountsClient) FailoverPriorityChangePreparer(resourceGrou "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2015-04-08" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -413,8 +417,9 @@ func (client DatabaseAccountsClient) GetPreparer(resourceGroupName string, accou "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2015-04-08" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -472,8 +477,9 @@ func (client DatabaseAccountsClient) ListPreparer() (*http.Request, error) { "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2015-04-08" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -542,8 +548,9 @@ func (client DatabaseAccountsClient) ListByResourceGroupPreparer(resourceGroupNa "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2015-04-08" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -617,8 +624,9 @@ func (client DatabaseAccountsClient) ListConnectionStringsPreparer(resourceGroup "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2015-04-08" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -692,8 +700,9 @@ func (client DatabaseAccountsClient) ListKeysPreparer(resourceGroupName string, "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2015-04-08" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -767,8 +776,9 @@ func (client DatabaseAccountsClient) ListReadOnlyKeysPreparer(resourceGroupName "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2015-04-08" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -845,8 +855,9 @@ func (client DatabaseAccountsClient) PatchPreparer(resourceGroupName string, acc "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2015-04-08" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -926,8 +937,9 @@ func (client DatabaseAccountsClient) RegenerateKeyPreparer(resourceGroupName str "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2015-04-08" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( diff --git a/arm/documentdb/models.go b/arm/documentdb/models.go old mode 100644 new mode 100755 diff --git a/arm/documentdb/version.go b/arm/documentdb/version.go old mode 100644 new mode 100755 index 809eb5bdd033..ca6f793ce91e --- a/arm/documentdb/version.go +++ b/arm/documentdb/version.go @@ -18,43 +18,12 @@ package documentdb // Changes may cause incorrect behavior and will be lost if the code is // regenerated. -import ( - "bytes" - "fmt" - "strings" -) - -const ( - major = "8" - minor = "1" - patch = "0" - tag = "beta" - userAgentFormat = "Azure-SDK-For-Go/%s arm-%s/%s" -) - -// cached results of UserAgent and Version to prevent repeated operations. -var ( - userAgent string - version string -) - // UserAgent returns the UserAgent string to use when sending http.Requests. func UserAgent() string { - if userAgent == "" { - userAgent = fmt.Sprintf(userAgentFormat, Version(), "documentdb", "2015-04-08") - } - return userAgent + return "Azure-SDK-For-Go/v9.0.0-beta arm-documentdb/2015-04-08" } // Version returns the semantic version (see http://semver.org) of the client. func Version() string { - if version == "" { - versionBuilder := bytes.NewBufferString(fmt.Sprintf("%s.%s.%s", major, minor, patch)) - if tag != "" { - versionBuilder.WriteRune('-') - versionBuilder.WriteString(strings.TrimPrefix(tag, "-")) - } - version = string(versionBuilder.Bytes()) - } - return version + return "v9.0.0-beta" } diff --git a/arm/eventhub/client.go b/arm/eventhub/client.go old mode 100644 new mode 100755 index 5eb6b54016dc..204ad67293d7 --- a/arm/eventhub/client.go +++ b/arm/eventhub/client.go @@ -18,7 +18,7 @@ package eventhub // See the License for the specific language governing permissions and // limitations under the License. // -// Code generated by Microsoft (R) AutoRest Code Generator 0.17.0.0 +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 // Changes may cause incorrect behavior and will be lost if the code is // regenerated. @@ -27,9 +27,6 @@ import ( ) const ( - // APIVersion is the version of the Eventhub - APIVersion = "2015-08-01" - // DefaultBaseURI is the default URI used for the service Eventhub DefaultBaseURI = "https://management.azure.com" ) @@ -38,7 +35,6 @@ const ( type ManagementClient struct { autorest.Client BaseURI string - APIVersion string SubscriptionID string } @@ -52,7 +48,6 @@ func NewWithBaseURI(baseURI string, subscriptionID string) ManagementClient { return ManagementClient{ Client: autorest.NewClientWithUserAgent(UserAgent()), BaseURI: baseURI, - APIVersion: APIVersion, SubscriptionID: subscriptionID, } } diff --git a/arm/eventhub/consumergroups.go b/arm/eventhub/consumergroups.go old mode 100644 new mode 100755 index e355a354f63d..0ed63300f1fc --- a/arm/eventhub/consumergroups.go +++ b/arm/eventhub/consumergroups.go @@ -14,7 +14,7 @@ package eventhub // See the License for the specific language governing permissions and // limitations under the License. // -// Code generated by Microsoft (R) AutoRest Code Generator 0.17.0.0 +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 // Changes may cause incorrect behavior and will be lost if the code is // regenerated. @@ -45,14 +45,24 @@ func NewConsumerGroupsClientWithBaseURI(baseURI string, subscriptionID string) C // CreateOrUpdate creates or updates an Event Hubs consumer group as a nested // resource within a namespace. // -// resourceGroupName is the name of the resource group. namespaceName is the -// namespace name. eventHubName is the Event Hub name. consumerGroupName is -// the consumer group name. parameters is parameters supplied to create a -// consumer group resource. -func (client ConsumerGroupsClient) CreateOrUpdate(resourceGroupName string, namespaceName string, eventHubName string, consumerGroupName string, parameters ConsumerGroupCreateOrUpdateParameters) (result ConsumerGroupResource, err error) { +// resourceGroupName is name of the Resource group within the Azure +// subscription. namespaceName is the namespace name eventHubName is the +// eventhub name consumerGroupName is the consumer group name parameters is +// parameters supplied to create a consumer group resource. +func (client ConsumerGroupsClient) CreateOrUpdate(resourceGroupName string, namespaceName string, eventHubName string, consumerGroupName string, parameters ConsumerGroup) (result ConsumerGroup, err error) { if err := validation.Validate([]validation.Validation{ - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.Location", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: namespaceName, + Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, + {TargetValue: eventHubName, + Constraints: []validation.Constraint{{Target: "eventHubName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "eventHubName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: consumerGroupName, + Constraints: []validation.Constraint{{Target: "consumerGroupName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "consumerGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewErrorWithValidationError(err, "eventhub.ConsumerGroupsClient", "CreateOrUpdate") } @@ -76,7 +86,7 @@ func (client ConsumerGroupsClient) CreateOrUpdate(resourceGroupName string, name } // CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client ConsumerGroupsClient) CreateOrUpdatePreparer(resourceGroupName string, namespaceName string, eventHubName string, consumerGroupName string, parameters ConsumerGroupCreateOrUpdateParameters) (*http.Request, error) { +func (client ConsumerGroupsClient) CreateOrUpdatePreparer(resourceGroupName string, namespaceName string, eventHubName string, consumerGroupName string, parameters ConsumerGroup) (*http.Request, error) { pathParameters := map[string]interface{}{ "consumerGroupName": autorest.Encode("path", consumerGroupName), "eventHubName": autorest.Encode("path", eventHubName), @@ -85,8 +95,9 @@ func (client ConsumerGroupsClient) CreateOrUpdatePreparer(resourceGroupName stri "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2015-08-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -107,7 +118,7 @@ func (client ConsumerGroupsClient) CreateOrUpdateSender(req *http.Request) (*htt // CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always // closes the http.Response Body. -func (client ConsumerGroupsClient) CreateOrUpdateResponder(resp *http.Response) (result ConsumerGroupResource, err error) { +func (client ConsumerGroupsClient) CreateOrUpdateResponder(resp *http.Response) (result ConsumerGroup, err error) { err = autorest.Respond( resp, client.ByInspecting(), @@ -121,10 +132,26 @@ func (client ConsumerGroupsClient) CreateOrUpdateResponder(resp *http.Response) // Delete deletes a consumer group from the specified Event Hub and resource // group. // -// resourceGroupName is the name of the resource group. namespaceName is the -// namespace name. eventHubName is the Event Hub name. consumerGroupName is -// the Cconsumer group name. +// resourceGroupName is name of the Resource group within the Azure +// subscription. namespaceName is the namespace name eventHubName is the +// eventhub name consumerGroupName is the consumer group name func (client ConsumerGroupsClient) Delete(resourceGroupName string, namespaceName string, eventHubName string, consumerGroupName string) (result autorest.Response, err error) { + if err := validation.Validate([]validation.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: namespaceName, + Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, + {TargetValue: eventHubName, + Constraints: []validation.Constraint{{Target: "eventHubName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "eventHubName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: consumerGroupName, + Constraints: []validation.Constraint{{Target: "consumerGroupName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "consumerGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "eventhub.ConsumerGroupsClient", "Delete") + } + req, err := client.DeletePreparer(resourceGroupName, namespaceName, eventHubName, consumerGroupName) if err != nil { return result, autorest.NewErrorWithError(err, "eventhub.ConsumerGroupsClient", "Delete", nil, "Failure preparing request") @@ -154,8 +181,9 @@ func (client ConsumerGroupsClient) DeletePreparer(resourceGroupName string, name "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2015-08-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -186,10 +214,26 @@ func (client ConsumerGroupsClient) DeleteResponder(resp *http.Response) (result // Get gets a description for the specified consumer group. // -// resourceGroupName is the name of the resource group. namespaceName is the -// namespace name. eventHubName is the Event Hub name. consumerGroupName is -// the consumer group name. -func (client ConsumerGroupsClient) Get(resourceGroupName string, namespaceName string, eventHubName string, consumerGroupName string) (result ConsumerGroupResource, err error) { +// resourceGroupName is name of the Resource group within the Azure +// subscription. namespaceName is the namespace name eventHubName is the +// eventhub name consumerGroupName is the consumer group name +func (client ConsumerGroupsClient) Get(resourceGroupName string, namespaceName string, eventHubName string, consumerGroupName string) (result ConsumerGroup, err error) { + if err := validation.Validate([]validation.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: namespaceName, + Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, + {TargetValue: eventHubName, + Constraints: []validation.Constraint{{Target: "eventHubName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "eventHubName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: consumerGroupName, + Constraints: []validation.Constraint{{Target: "consumerGroupName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "consumerGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "eventhub.ConsumerGroupsClient", "Get") + } + req, err := client.GetPreparer(resourceGroupName, namespaceName, eventHubName, consumerGroupName) if err != nil { return result, autorest.NewErrorWithError(err, "eventhub.ConsumerGroupsClient", "Get", nil, "Failure preparing request") @@ -219,8 +263,9 @@ func (client ConsumerGroupsClient) GetPreparer(resourceGroupName string, namespa "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2015-08-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -239,7 +284,7 @@ func (client ConsumerGroupsClient) GetSender(req *http.Request) (*http.Response, // GetResponder handles the response to the Get request. The method always // closes the http.Response Body. -func (client ConsumerGroupsClient) GetResponder(resp *http.Response) (result ConsumerGroupResource, err error) { +func (client ConsumerGroupsClient) GetResponder(resp *http.Response) (result ConsumerGroup, err error) { err = autorest.Respond( resp, client.ByInspecting(), @@ -250,33 +295,47 @@ func (client ConsumerGroupsClient) GetResponder(resp *http.Response) (result Con return } -// ListAll gets all the consumer groups in a namespace. An empty feed is -// returned if no consumer group exists in the namespace. +// ListByEventHub gets all the consumer groups in a eventhub. An empty feed is +// returned if no consumer group exists in the eventhub. // -// resourceGroupName is the name of the resource group. namespaceName is the -// namespace name. eventHubName is the Event Hub name. -func (client ConsumerGroupsClient) ListAll(resourceGroupName string, namespaceName string, eventHubName string) (result ConsumerGroupListResult, err error) { - req, err := client.ListAllPreparer(resourceGroupName, namespaceName, eventHubName) +// resourceGroupName is name of the Resource group within the Azure +// subscription. namespaceName is the namespace name eventHubName is the +// eventhub name +func (client ConsumerGroupsClient) ListByEventHub(resourceGroupName string, namespaceName string, eventHubName string) (result ConsumerGroupListResult, err error) { + if err := validation.Validate([]validation.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: namespaceName, + Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, + {TargetValue: eventHubName, + Constraints: []validation.Constraint{{Target: "eventHubName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "eventHubName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "eventhub.ConsumerGroupsClient", "ListByEventHub") + } + + req, err := client.ListByEventHubPreparer(resourceGroupName, namespaceName, eventHubName) if err != nil { - return result, autorest.NewErrorWithError(err, "eventhub.ConsumerGroupsClient", "ListAll", nil, "Failure preparing request") + return result, autorest.NewErrorWithError(err, "eventhub.ConsumerGroupsClient", "ListByEventHub", nil, "Failure preparing request") } - resp, err := client.ListAllSender(req) + resp, err := client.ListByEventHubSender(req) if err != nil { result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "eventhub.ConsumerGroupsClient", "ListAll", resp, "Failure sending request") + return result, autorest.NewErrorWithError(err, "eventhub.ConsumerGroupsClient", "ListByEventHub", resp, "Failure sending request") } - result, err = client.ListAllResponder(resp) + result, err = client.ListByEventHubResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "eventhub.ConsumerGroupsClient", "ListAll", resp, "Failure responding to request") + err = autorest.NewErrorWithError(err, "eventhub.ConsumerGroupsClient", "ListByEventHub", resp, "Failure responding to request") } return } -// ListAllPreparer prepares the ListAll request. -func (client ConsumerGroupsClient) ListAllPreparer(resourceGroupName string, namespaceName string, eventHubName string) (*http.Request, error) { +// ListByEventHubPreparer prepares the ListByEventHub request. +func (client ConsumerGroupsClient) ListByEventHubPreparer(resourceGroupName string, namespaceName string, eventHubName string) (*http.Request, error) { pathParameters := map[string]interface{}{ "eventHubName": autorest.Encode("path", eventHubName), "namespaceName": autorest.Encode("path", namespaceName), @@ -284,8 +343,9 @@ func (client ConsumerGroupsClient) ListAllPreparer(resourceGroupName string, nam "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2015-08-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -296,15 +356,15 @@ func (client ConsumerGroupsClient) ListAllPreparer(resourceGroupName string, nam return preparer.Prepare(&http.Request{}) } -// ListAllSender sends the ListAll request. The method will close the +// ListByEventHubSender sends the ListByEventHub request. The method will close the // http.Response Body if it receives an error. -func (client ConsumerGroupsClient) ListAllSender(req *http.Request) (*http.Response, error) { +func (client ConsumerGroupsClient) ListByEventHubSender(req *http.Request) (*http.Response, error) { return autorest.SendWithSender(client, req) } -// ListAllResponder handles the response to the ListAll request. The method always +// ListByEventHubResponder handles the response to the ListByEventHub request. The method always // closes the http.Response Body. -func (client ConsumerGroupsClient) ListAllResponder(resp *http.Response) (result ConsumerGroupListResult, err error) { +func (client ConsumerGroupsClient) ListByEventHubResponder(resp *http.Response) (result ConsumerGroupListResult, err error) { err = autorest.Respond( resp, client.ByInspecting(), @@ -315,25 +375,25 @@ func (client ConsumerGroupsClient) ListAllResponder(resp *http.Response) (result return } -// ListAllNextResults retrieves the next set of results, if any. -func (client ConsumerGroupsClient) ListAllNextResults(lastResults ConsumerGroupListResult) (result ConsumerGroupListResult, err error) { +// ListByEventHubNextResults retrieves the next set of results, if any. +func (client ConsumerGroupsClient) ListByEventHubNextResults(lastResults ConsumerGroupListResult) (result ConsumerGroupListResult, err error) { req, err := lastResults.ConsumerGroupListResultPreparer() if err != nil { - return result, autorest.NewErrorWithError(err, "eventhub.ConsumerGroupsClient", "ListAll", nil, "Failure preparing next results request") + return result, autorest.NewErrorWithError(err, "eventhub.ConsumerGroupsClient", "ListByEventHub", nil, "Failure preparing next results request") } if req == nil { return } - resp, err := client.ListAllSender(req) + resp, err := client.ListByEventHubSender(req) if err != nil { result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "eventhub.ConsumerGroupsClient", "ListAll", resp, "Failure sending next results request") + return result, autorest.NewErrorWithError(err, "eventhub.ConsumerGroupsClient", "ListByEventHub", resp, "Failure sending next results request") } - result, err = client.ListAllResponder(resp) + result, err = client.ListByEventHubResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "eventhub.ConsumerGroupsClient", "ListAll", resp, "Failure responding to next results request") + err = autorest.NewErrorWithError(err, "eventhub.ConsumerGroupsClient", "ListByEventHub", resp, "Failure responding to next results request") } return diff --git a/arm/eventhub/eventhubs.go b/arm/eventhub/eventhubs.go old mode 100644 new mode 100755 index 11cd8c61d9e6..ac65a07656fd --- a/arm/eventhub/eventhubs.go +++ b/arm/eventhub/eventhubs.go @@ -14,7 +14,7 @@ package eventhub // See the License for the specific language governing permissions and // limitations under the License. // -// Code generated by Microsoft (R) AutoRest Code Generator 0.17.0.0 +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 // Changes may cause incorrect behavior and will be lost if the code is // regenerated. @@ -44,13 +44,21 @@ func NewEventHubsClientWithBaseURI(baseURI string, subscriptionID string) EventH // CreateOrUpdate creates or updates a new Event Hub as a nested resource // within a namespace. // -// resourceGroupName is the name of the resource group. namespaceName is the -// namespace name. eventHubName is the Event Hub name. parameters is -// parameters supplied to create an Event Hub resource. -func (client EventHubsClient) CreateOrUpdate(resourceGroupName string, namespaceName string, eventHubName string, parameters CreateOrUpdateParameters) (result ResourceType, err error) { +// resourceGroupName is name of the Resource group within the Azure +// subscription. namespaceName is the namespace name eventHubName is the +// eventhub name parameters is parameters supplied to create an Event Hub +// resource. +func (client EventHubsClient) CreateOrUpdate(resourceGroupName string, namespaceName string, eventHubName string, parameters EventHub) (result EventHub, err error) { if err := validation.Validate([]validation.Validation{ - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.Location", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: namespaceName, + Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, + {TargetValue: eventHubName, + Constraints: []validation.Constraint{{Target: "eventHubName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "eventHubName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewErrorWithValidationError(err, "eventhub.EventHubsClient", "CreateOrUpdate") } @@ -74,7 +82,7 @@ func (client EventHubsClient) CreateOrUpdate(resourceGroupName string, namespace } // CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client EventHubsClient) CreateOrUpdatePreparer(resourceGroupName string, namespaceName string, eventHubName string, parameters CreateOrUpdateParameters) (*http.Request, error) { +func (client EventHubsClient) CreateOrUpdatePreparer(resourceGroupName string, namespaceName string, eventHubName string, parameters EventHub) (*http.Request, error) { pathParameters := map[string]interface{}{ "eventHubName": autorest.Encode("path", eventHubName), "namespaceName": autorest.Encode("path", namespaceName), @@ -82,8 +90,9 @@ func (client EventHubsClient) CreateOrUpdatePreparer(resourceGroupName string, n "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2015-08-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -104,7 +113,7 @@ func (client EventHubsClient) CreateOrUpdateSender(req *http.Request) (*http.Res // CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always // closes the http.Response Body. -func (client EventHubsClient) CreateOrUpdateResponder(resp *http.Response) (result ResourceType, err error) { +func (client EventHubsClient) CreateOrUpdateResponder(resp *http.Response) (result EventHub, err error) { err = autorest.Respond( resp, client.ByInspecting(), @@ -115,15 +124,27 @@ func (client EventHubsClient) CreateOrUpdateResponder(resp *http.Response) (resu return } -// CreateOrUpdateAuthorizationRule creates or updates an authorization rule -// for the specified Event Hub. +// CreateOrUpdateAuthorizationRule creates or updates an authorization rule for +// the specified Event Hub. // -// resourceGroupName is the name of the resource group. namespaceName is the -// namespace name. eventHubName is the Event Hub name. authorizationRuleName -// is the authorization rule name. parameters is the shared access -// authorization rule. -func (client EventHubsClient) CreateOrUpdateAuthorizationRule(resourceGroupName string, namespaceName string, eventHubName string, authorizationRuleName string, parameters SharedAccessAuthorizationRuleCreateOrUpdateParameters) (result SharedAccessAuthorizationRuleResource, err error) { +// resourceGroupName is name of the Resource group within the Azure +// subscription. namespaceName is the namespace name eventHubName is the +// eventhub name authorizationRuleName is the authorizationrule name. +// parameters is the shared access authorization rule. +func (client EventHubsClient) CreateOrUpdateAuthorizationRule(resourceGroupName string, namespaceName string, eventHubName string, authorizationRuleName string, parameters SharedAccessAuthorizationRule) (result SharedAccessAuthorizationRule, err error) { if err := validation.Validate([]validation.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: namespaceName, + Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, + {TargetValue: eventHubName, + Constraints: []validation.Constraint{{Target: "eventHubName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "eventHubName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: authorizationRuleName, + Constraints: []validation.Constraint{{Target: "authorizationRuleName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "authorizationRuleName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: parameters, Constraints: []validation.Constraint{{Target: "parameters.SharedAccessAuthorizationRuleProperties", Name: validation.Null, Rule: false, Chain: []validation.Constraint{{Target: "parameters.SharedAccessAuthorizationRuleProperties.Rights", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { @@ -150,7 +171,7 @@ func (client EventHubsClient) CreateOrUpdateAuthorizationRule(resourceGroupName } // CreateOrUpdateAuthorizationRulePreparer prepares the CreateOrUpdateAuthorizationRule request. -func (client EventHubsClient) CreateOrUpdateAuthorizationRulePreparer(resourceGroupName string, namespaceName string, eventHubName string, authorizationRuleName string, parameters SharedAccessAuthorizationRuleCreateOrUpdateParameters) (*http.Request, error) { +func (client EventHubsClient) CreateOrUpdateAuthorizationRulePreparer(resourceGroupName string, namespaceName string, eventHubName string, authorizationRuleName string, parameters SharedAccessAuthorizationRule) (*http.Request, error) { pathParameters := map[string]interface{}{ "authorizationRuleName": autorest.Encode("path", authorizationRuleName), "eventHubName": autorest.Encode("path", eventHubName), @@ -159,8 +180,9 @@ func (client EventHubsClient) CreateOrUpdateAuthorizationRulePreparer(resourceGr "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2015-08-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -181,7 +203,7 @@ func (client EventHubsClient) CreateOrUpdateAuthorizationRuleSender(req *http.Re // CreateOrUpdateAuthorizationRuleResponder handles the response to the CreateOrUpdateAuthorizationRule request. The method always // closes the http.Response Body. -func (client EventHubsClient) CreateOrUpdateAuthorizationRuleResponder(resp *http.Response) (result SharedAccessAuthorizationRuleResource, err error) { +func (client EventHubsClient) CreateOrUpdateAuthorizationRuleResponder(resp *http.Response) (result SharedAccessAuthorizationRule, err error) { err = autorest.Respond( resp, client.ByInspecting(), @@ -194,9 +216,23 @@ func (client EventHubsClient) CreateOrUpdateAuthorizationRuleResponder(resp *htt // Delete deletes an Event Hub from the specified namespace and resource group. // -// resourceGroupName is the name of the resource group. namespaceName is the -// namespace name. eventHubName is the name of the Event Hub to delete. +// resourceGroupName is name of the Resource group within the Azure +// subscription. namespaceName is the namespace name eventHubName is the +// eventhub name func (client EventHubsClient) Delete(resourceGroupName string, namespaceName string, eventHubName string) (result autorest.Response, err error) { + if err := validation.Validate([]validation.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: namespaceName, + Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, + {TargetValue: eventHubName, + Constraints: []validation.Constraint{{Target: "eventHubName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "eventHubName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "eventhub.EventHubsClient", "Delete") + } + req, err := client.DeletePreparer(resourceGroupName, namespaceName, eventHubName) if err != nil { return result, autorest.NewErrorWithError(err, "eventhub.EventHubsClient", "Delete", nil, "Failure preparing request") @@ -225,8 +261,9 @@ func (client EventHubsClient) DeletePreparer(resourceGroupName string, namespace "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2015-08-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -257,10 +294,26 @@ func (client EventHubsClient) DeleteResponder(resp *http.Response) (result autor // DeleteAuthorizationRule deletes an Event Hubs authorization rule. // -// resourceGroupName is the name of the resource group. namespaceName is the -// namespace name. eventHubName is the Event Hub name. authorizationRuleName -// is the authorization rule name. +// resourceGroupName is name of the Resource group within the Azure +// subscription. namespaceName is the namespace name eventHubName is the +// eventhub name authorizationRuleName is the authorizationrule name. func (client EventHubsClient) DeleteAuthorizationRule(resourceGroupName string, namespaceName string, eventHubName string, authorizationRuleName string) (result autorest.Response, err error) { + if err := validation.Validate([]validation.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: namespaceName, + Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, + {TargetValue: eventHubName, + Constraints: []validation.Constraint{{Target: "eventHubName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "eventHubName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: authorizationRuleName, + Constraints: []validation.Constraint{{Target: "authorizationRuleName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "authorizationRuleName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "eventhub.EventHubsClient", "DeleteAuthorizationRule") + } + req, err := client.DeleteAuthorizationRulePreparer(resourceGroupName, namespaceName, eventHubName, authorizationRuleName) if err != nil { return result, autorest.NewErrorWithError(err, "eventhub.EventHubsClient", "DeleteAuthorizationRule", nil, "Failure preparing request") @@ -290,8 +343,9 @@ func (client EventHubsClient) DeleteAuthorizationRulePreparer(resourceGroupName "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2015-08-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -322,9 +376,23 @@ func (client EventHubsClient) DeleteAuthorizationRuleResponder(resp *http.Respon // Get gets an Event Hubs description for the specified Event Hub. // -// resourceGroupName is the name of the resource group. namespaceName is the -// namespace name. eventHubName is the Event Hub name. -func (client EventHubsClient) Get(resourceGroupName string, namespaceName string, eventHubName string) (result ResourceType, err error) { +// resourceGroupName is name of the Resource group within the Azure +// subscription. namespaceName is the namespace name eventHubName is the +// eventhub name +func (client EventHubsClient) Get(resourceGroupName string, namespaceName string, eventHubName string) (result EventHub, err error) { + if err := validation.Validate([]validation.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: namespaceName, + Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, + {TargetValue: eventHubName, + Constraints: []validation.Constraint{{Target: "eventHubName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "eventHubName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "eventhub.EventHubsClient", "Get") + } + req, err := client.GetPreparer(resourceGroupName, namespaceName, eventHubName) if err != nil { return result, autorest.NewErrorWithError(err, "eventhub.EventHubsClient", "Get", nil, "Failure preparing request") @@ -353,8 +421,9 @@ func (client EventHubsClient) GetPreparer(resourceGroupName string, namespaceNam "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2015-08-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -373,7 +442,7 @@ func (client EventHubsClient) GetSender(req *http.Request) (*http.Response, erro // GetResponder handles the response to the Get request. The method always // closes the http.Response Body. -func (client EventHubsClient) GetResponder(resp *http.Response) (result ResourceType, err error) { +func (client EventHubsClient) GetResponder(resp *http.Response) (result EventHub, err error) { err = autorest.Respond( resp, client.ByInspecting(), @@ -387,10 +456,26 @@ func (client EventHubsClient) GetResponder(resp *http.Response) (result Resource // GetAuthorizationRule gets an authorization rule for an Event Hub by rule // name. // -// resourceGroupName is the name of the resource group. namespaceName is the -// namespace name. eventHubName is the Event Hub name. authorizationRuleName -// is the authorization rule name. -func (client EventHubsClient) GetAuthorizationRule(resourceGroupName string, namespaceName string, eventHubName string, authorizationRuleName string) (result SharedAccessAuthorizationRuleResource, err error) { +// resourceGroupName is name of the Resource group within the Azure +// subscription. namespaceName is the namespace name eventHubName is the +// eventhub name authorizationRuleName is the authorizationrule name. +func (client EventHubsClient) GetAuthorizationRule(resourceGroupName string, namespaceName string, eventHubName string, authorizationRuleName string) (result SharedAccessAuthorizationRule, err error) { + if err := validation.Validate([]validation.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: namespaceName, + Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, + {TargetValue: eventHubName, + Constraints: []validation.Constraint{{Target: "eventHubName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "eventHubName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: authorizationRuleName, + Constraints: []validation.Constraint{{Target: "authorizationRuleName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "authorizationRuleName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "eventhub.EventHubsClient", "GetAuthorizationRule") + } + req, err := client.GetAuthorizationRulePreparer(resourceGroupName, namespaceName, eventHubName, authorizationRuleName) if err != nil { return result, autorest.NewErrorWithError(err, "eventhub.EventHubsClient", "GetAuthorizationRule", nil, "Failure preparing request") @@ -420,8 +505,9 @@ func (client EventHubsClient) GetAuthorizationRulePreparer(resourceGroupName str "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2015-08-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -440,7 +526,7 @@ func (client EventHubsClient) GetAuthorizationRuleSender(req *http.Request) (*ht // GetAuthorizationRuleResponder handles the response to the GetAuthorizationRule request. The method always // closes the http.Response Body. -func (client EventHubsClient) GetAuthorizationRuleResponder(resp *http.Response) (result SharedAccessAuthorizationRuleResource, err error) { +func (client EventHubsClient) GetAuthorizationRuleResponder(resp *http.Response) (result SharedAccessAuthorizationRule, err error) { err = autorest.Respond( resp, client.ByInspecting(), @@ -451,59 +537,75 @@ func (client EventHubsClient) GetAuthorizationRuleResponder(resp *http.Response) return } -// ListAll gets all the Event Hubs in a namespace. +// ListAuthorizationRules gets the authorization rules for an Event Hub. // -// resourceGroupName is the name of the resource group. namespaceName is the -// namespace name. -func (client EventHubsClient) ListAll(resourceGroupName string, namespaceName string) (result ListResult, err error) { - req, err := client.ListAllPreparer(resourceGroupName, namespaceName) +// resourceGroupName is name of the Resource group within the Azure +// subscription. namespaceName is the namespace name eventHubName is the +// eventhub name +func (client EventHubsClient) ListAuthorizationRules(resourceGroupName string, namespaceName string, eventHubName string) (result SharedAccessAuthorizationRuleListResult, err error) { + if err := validation.Validate([]validation.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: namespaceName, + Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, + {TargetValue: eventHubName, + Constraints: []validation.Constraint{{Target: "eventHubName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "eventHubName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "eventhub.EventHubsClient", "ListAuthorizationRules") + } + + req, err := client.ListAuthorizationRulesPreparer(resourceGroupName, namespaceName, eventHubName) if err != nil { - return result, autorest.NewErrorWithError(err, "eventhub.EventHubsClient", "ListAll", nil, "Failure preparing request") + return result, autorest.NewErrorWithError(err, "eventhub.EventHubsClient", "ListAuthorizationRules", nil, "Failure preparing request") } - resp, err := client.ListAllSender(req) + resp, err := client.ListAuthorizationRulesSender(req) if err != nil { result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "eventhub.EventHubsClient", "ListAll", resp, "Failure sending request") + return result, autorest.NewErrorWithError(err, "eventhub.EventHubsClient", "ListAuthorizationRules", resp, "Failure sending request") } - result, err = client.ListAllResponder(resp) + result, err = client.ListAuthorizationRulesResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "eventhub.EventHubsClient", "ListAll", resp, "Failure responding to request") + err = autorest.NewErrorWithError(err, "eventhub.EventHubsClient", "ListAuthorizationRules", resp, "Failure responding to request") } return } -// ListAllPreparer prepares the ListAll request. -func (client EventHubsClient) ListAllPreparer(resourceGroupName string, namespaceName string) (*http.Request, error) { +// ListAuthorizationRulesPreparer prepares the ListAuthorizationRules request. +func (client EventHubsClient) ListAuthorizationRulesPreparer(resourceGroupName string, namespaceName string, eventHubName string) (*http.Request, error) { pathParameters := map[string]interface{}{ + "eventHubName": autorest.Encode("path", eventHubName), "namespaceName": autorest.Encode("path", namespaceName), "resourceGroupName": autorest.Encode("path", resourceGroupName), "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2015-08-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/eventhubs", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/eventhubs/{eventHubName}/authorizationRules", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare(&http.Request{}) } -// ListAllSender sends the ListAll request. The method will close the +// ListAuthorizationRulesSender sends the ListAuthorizationRules request. The method will close the // http.Response Body if it receives an error. -func (client EventHubsClient) ListAllSender(req *http.Request) (*http.Response, error) { +func (client EventHubsClient) ListAuthorizationRulesSender(req *http.Request) (*http.Response, error) { return autorest.SendWithSender(client, req) } -// ListAllResponder handles the response to the ListAll request. The method always +// ListAuthorizationRulesResponder handles the response to the ListAuthorizationRules request. The method always // closes the http.Response Body. -func (client EventHubsClient) ListAllResponder(resp *http.Response) (result ListResult, err error) { +func (client EventHubsClient) ListAuthorizationRulesResponder(resp *http.Response) (result SharedAccessAuthorizationRuleListResult, err error) { err = autorest.Respond( resp, client.ByInspecting(), @@ -514,84 +616,94 @@ func (client EventHubsClient) ListAllResponder(resp *http.Response) (result List return } -// ListAllNextResults retrieves the next set of results, if any. -func (client EventHubsClient) ListAllNextResults(lastResults ListResult) (result ListResult, err error) { - req, err := lastResults.ListResultPreparer() +// ListAuthorizationRulesNextResults retrieves the next set of results, if any. +func (client EventHubsClient) ListAuthorizationRulesNextResults(lastResults SharedAccessAuthorizationRuleListResult) (result SharedAccessAuthorizationRuleListResult, err error) { + req, err := lastResults.SharedAccessAuthorizationRuleListResultPreparer() if err != nil { - return result, autorest.NewErrorWithError(err, "eventhub.EventHubsClient", "ListAll", nil, "Failure preparing next results request") + return result, autorest.NewErrorWithError(err, "eventhub.EventHubsClient", "ListAuthorizationRules", nil, "Failure preparing next results request") } if req == nil { return } - resp, err := client.ListAllSender(req) + resp, err := client.ListAuthorizationRulesSender(req) if err != nil { result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "eventhub.EventHubsClient", "ListAll", resp, "Failure sending next results request") + return result, autorest.NewErrorWithError(err, "eventhub.EventHubsClient", "ListAuthorizationRules", resp, "Failure sending next results request") } - result, err = client.ListAllResponder(resp) + result, err = client.ListAuthorizationRulesResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "eventhub.EventHubsClient", "ListAll", resp, "Failure responding to next results request") + err = autorest.NewErrorWithError(err, "eventhub.EventHubsClient", "ListAuthorizationRules", resp, "Failure responding to next results request") } return } -// ListAuthorizationRules gets the authorization rules for an Event Hub. +// ListByNamespace gets all the Event Hubs in a namespace. // -// resourceGroupName is the name of the resource group. namespaceName is the -// namespace name eventHubName is the Event Hub name. -func (client EventHubsClient) ListAuthorizationRules(resourceGroupName string, namespaceName string, eventHubName string) (result SharedAccessAuthorizationRuleListResult, err error) { - req, err := client.ListAuthorizationRulesPreparer(resourceGroupName, namespaceName, eventHubName) +// resourceGroupName is name of the Resource group within the Azure +// subscription. namespaceName is the namespace name +func (client EventHubsClient) ListByNamespace(resourceGroupName string, namespaceName string) (result ListResult, err error) { + if err := validation.Validate([]validation.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: namespaceName, + Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "eventhub.EventHubsClient", "ListByNamespace") + } + + req, err := client.ListByNamespacePreparer(resourceGroupName, namespaceName) if err != nil { - return result, autorest.NewErrorWithError(err, "eventhub.EventHubsClient", "ListAuthorizationRules", nil, "Failure preparing request") + return result, autorest.NewErrorWithError(err, "eventhub.EventHubsClient", "ListByNamespace", nil, "Failure preparing request") } - resp, err := client.ListAuthorizationRulesSender(req) + resp, err := client.ListByNamespaceSender(req) if err != nil { result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "eventhub.EventHubsClient", "ListAuthorizationRules", resp, "Failure sending request") + return result, autorest.NewErrorWithError(err, "eventhub.EventHubsClient", "ListByNamespace", resp, "Failure sending request") } - result, err = client.ListAuthorizationRulesResponder(resp) + result, err = client.ListByNamespaceResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "eventhub.EventHubsClient", "ListAuthorizationRules", resp, "Failure responding to request") + err = autorest.NewErrorWithError(err, "eventhub.EventHubsClient", "ListByNamespace", resp, "Failure responding to request") } return } -// ListAuthorizationRulesPreparer prepares the ListAuthorizationRules request. -func (client EventHubsClient) ListAuthorizationRulesPreparer(resourceGroupName string, namespaceName string, eventHubName string) (*http.Request, error) { +// ListByNamespacePreparer prepares the ListByNamespace request. +func (client EventHubsClient) ListByNamespacePreparer(resourceGroupName string, namespaceName string) (*http.Request, error) { pathParameters := map[string]interface{}{ - "eventHubName": autorest.Encode("path", eventHubName), "namespaceName": autorest.Encode("path", namespaceName), "resourceGroupName": autorest.Encode("path", resourceGroupName), "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2015-08-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/eventhubs/{eventHubName}/authorizationRules", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/eventhubs", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare(&http.Request{}) } -// ListAuthorizationRulesSender sends the ListAuthorizationRules request. The method will close the +// ListByNamespaceSender sends the ListByNamespace request. The method will close the // http.Response Body if it receives an error. -func (client EventHubsClient) ListAuthorizationRulesSender(req *http.Request) (*http.Response, error) { +func (client EventHubsClient) ListByNamespaceSender(req *http.Request) (*http.Response, error) { return autorest.SendWithSender(client, req) } -// ListAuthorizationRulesResponder handles the response to the ListAuthorizationRules request. The method always +// ListByNamespaceResponder handles the response to the ListByNamespace request. The method always // closes the http.Response Body. -func (client EventHubsClient) ListAuthorizationRulesResponder(resp *http.Response) (result SharedAccessAuthorizationRuleListResult, err error) { +func (client EventHubsClient) ListByNamespaceResponder(resp *http.Response) (result ListResult, err error) { err = autorest.Respond( resp, client.ByInspecting(), @@ -602,25 +714,25 @@ func (client EventHubsClient) ListAuthorizationRulesResponder(resp *http.Respons return } -// ListAuthorizationRulesNextResults retrieves the next set of results, if any. -func (client EventHubsClient) ListAuthorizationRulesNextResults(lastResults SharedAccessAuthorizationRuleListResult) (result SharedAccessAuthorizationRuleListResult, err error) { - req, err := lastResults.SharedAccessAuthorizationRuleListResultPreparer() +// ListByNamespaceNextResults retrieves the next set of results, if any. +func (client EventHubsClient) ListByNamespaceNextResults(lastResults ListResult) (result ListResult, err error) { + req, err := lastResults.ListResultPreparer() if err != nil { - return result, autorest.NewErrorWithError(err, "eventhub.EventHubsClient", "ListAuthorizationRules", nil, "Failure preparing next results request") + return result, autorest.NewErrorWithError(err, "eventhub.EventHubsClient", "ListByNamespace", nil, "Failure preparing next results request") } if req == nil { return } - resp, err := client.ListAuthorizationRulesSender(req) + resp, err := client.ListByNamespaceSender(req) if err != nil { result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "eventhub.EventHubsClient", "ListAuthorizationRules", resp, "Failure sending next results request") + return result, autorest.NewErrorWithError(err, "eventhub.EventHubsClient", "ListByNamespace", resp, "Failure sending next results request") } - result, err = client.ListAuthorizationRulesResponder(resp) + result, err = client.ListByNamespaceResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "eventhub.EventHubsClient", "ListAuthorizationRules", resp, "Failure responding to next results request") + err = autorest.NewErrorWithError(err, "eventhub.EventHubsClient", "ListByNamespace", resp, "Failure responding to next results request") } return @@ -628,11 +740,26 @@ func (client EventHubsClient) ListAuthorizationRulesNextResults(lastResults Shar // ListKeys gets the ACS and SAS connection strings for the Event Hub. // -// resourceGroupName is the name of the resource group. namespaceName is the -// namespace name. eventHubName is the Event Hub name. authorizationRuleName -// is the connection string of the namespace for the specified authorization -// rule. +// resourceGroupName is name of the Resource group within the Azure +// subscription. namespaceName is the namespace name eventHubName is the +// eventhub name authorizationRuleName is the authorizationrule name. func (client EventHubsClient) ListKeys(resourceGroupName string, namespaceName string, eventHubName string, authorizationRuleName string) (result ResourceListKeys, err error) { + if err := validation.Validate([]validation.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: namespaceName, + Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, + {TargetValue: eventHubName, + Constraints: []validation.Constraint{{Target: "eventHubName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "eventHubName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: authorizationRuleName, + Constraints: []validation.Constraint{{Target: "authorizationRuleName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "authorizationRuleName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "eventhub.EventHubsClient", "ListKeys") + } + req, err := client.ListKeysPreparer(resourceGroupName, namespaceName, eventHubName, authorizationRuleName) if err != nil { return result, autorest.NewErrorWithError(err, "eventhub.EventHubsClient", "ListKeys", nil, "Failure preparing request") @@ -662,8 +789,9 @@ func (client EventHubsClient) ListKeysPreparer(resourceGroupName string, namespa "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2015-08-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -696,12 +824,27 @@ func (client EventHubsClient) ListKeysResponder(resp *http.Response) (result Res // RegenerateKeys regenerates the ACS and SAS connection strings for the Event // Hub. // -// resourceGroupName is the name of the resource group. namespaceName is the -// namespace name. eventHubName is the Event Hub name. authorizationRuleName -// is the connection string of the Event Hub for the specified authorization -// rule. parameters is parameters supplied to regenerate the authorization -// rule. +// resourceGroupName is name of the Resource group within the Azure +// subscription. namespaceName is the namespace name eventHubName is the +// eventhub name authorizationRuleName is the authorizationrule name. +// parameters is parameters supplied to regenerate the authorization rule. func (client EventHubsClient) RegenerateKeys(resourceGroupName string, namespaceName string, eventHubName string, authorizationRuleName string, parameters RegenerateKeysParameters) (result ResourceListKeys, err error) { + if err := validation.Validate([]validation.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: namespaceName, + Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, + {TargetValue: eventHubName, + Constraints: []validation.Constraint{{Target: "eventHubName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "eventHubName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: authorizationRuleName, + Constraints: []validation.Constraint{{Target: "authorizationRuleName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "authorizationRuleName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "eventhub.EventHubsClient", "RegenerateKeys") + } + req, err := client.RegenerateKeysPreparer(resourceGroupName, namespaceName, eventHubName, authorizationRuleName, parameters) if err != nil { return result, autorest.NewErrorWithError(err, "eventhub.EventHubsClient", "RegenerateKeys", nil, "Failure preparing request") @@ -731,8 +874,9 @@ func (client EventHubsClient) RegenerateKeysPreparer(resourceGroupName string, n "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2015-08-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( diff --git a/arm/eventhub/models.go b/arm/eventhub/models.go old mode 100644 new mode 100755 index ec1c5b1177d2..07fc20a04097 --- a/arm/eventhub/models.go +++ b/arm/eventhub/models.go @@ -14,7 +14,7 @@ package eventhub // See the License for the specific language governing permissions and // limitations under the License. // -// Code generated by Microsoft (R) AutoRest Code Generator 0.17.0.0 +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 // Changes may cause incorrect behavior and will be lost if the code is // regenerated. @@ -61,51 +61,6 @@ const ( Unknown EntityStatus = "Unknown" ) -// NamespaceState enumerates the values for namespace state. -type NamespaceState string - -const ( - // NamespaceStateActivating specifies the namespace state activating state - // for namespace state. - NamespaceStateActivating NamespaceState = "Activating" - // NamespaceStateActive specifies the namespace state active state for - // namespace state. - NamespaceStateActive NamespaceState = "Active" - // NamespaceStateCreated specifies the namespace state created state for - // namespace state. - NamespaceStateCreated NamespaceState = "Created" - // NamespaceStateCreating specifies the namespace state creating state for - // namespace state. - NamespaceStateCreating NamespaceState = "Creating" - // NamespaceStateDisabled specifies the namespace state disabled state for - // namespace state. - NamespaceStateDisabled NamespaceState = "Disabled" - // NamespaceStateDisabling specifies the namespace state disabling state - // for namespace state. - NamespaceStateDisabling NamespaceState = "Disabling" - // NamespaceStateEnabling specifies the namespace state enabling state for - // namespace state. - NamespaceStateEnabling NamespaceState = "Enabling" - // NamespaceStateFailed specifies the namespace state failed state for - // namespace state. - NamespaceStateFailed NamespaceState = "Failed" - // NamespaceStateRemoved specifies the namespace state removed state for - // namespace state. - NamespaceStateRemoved NamespaceState = "Removed" - // NamespaceStateRemoving specifies the namespace state removing state for - // namespace state. - NamespaceStateRemoving NamespaceState = "Removing" - // NamespaceStateSoftDeleted specifies the namespace state soft deleted - // state for namespace state. - NamespaceStateSoftDeleted NamespaceState = "SoftDeleted" - // NamespaceStateSoftDeleting specifies the namespace state soft deleting - // state for namespace state. - NamespaceStateSoftDeleting NamespaceState = "SoftDeleting" - // NamespaceStateUnknown specifies the namespace state unknown state for - // namespace state. - NamespaceStateUnknown NamespaceState = "Unknown" -) - // Policykey enumerates the values for policykey. type Policykey string @@ -122,8 +77,6 @@ type SkuName string const ( // Basic specifies the basic state for sku name. Basic SkuName = "Basic" - // Premium specifies the premium state for sku name. - Premium SkuName = "Premium" // Standard specifies the standard state for sku name. Standard SkuName = "Standard" ) @@ -140,12 +93,48 @@ const ( SkuTierStandard SkuTier = "Standard" ) -// ConsumerGroupCreateOrUpdateParameters is parameters supplied to the Create -// Or Update Consumer Group operation. -type ConsumerGroupCreateOrUpdateParameters struct { - Location *string `json:"location,omitempty"` - Type *string `json:"type,omitempty"` +// UnavailableReason enumerates the values for unavailable reason. +type UnavailableReason string + +const ( + // InvalidName specifies the invalid name state for unavailable reason. + InvalidName UnavailableReason = "InvalidName" + // NameInLockdown specifies the name in lockdown state for unavailable + // reason. + NameInLockdown UnavailableReason = "NameInLockdown" + // NameInUse specifies the name in use state for unavailable reason. + NameInUse UnavailableReason = "NameInUse" + // None specifies the none state for unavailable reason. + None UnavailableReason = "None" + // SubscriptionIsDisabled specifies the subscription is disabled state for + // unavailable reason. + SubscriptionIsDisabled UnavailableReason = "SubscriptionIsDisabled" + // TooManyNamespaceInCurrentSubscription specifies the too many namespace + // in current subscription state for unavailable reason. + TooManyNamespaceInCurrentSubscription UnavailableReason = "TooManyNamespaceInCurrentSubscription" +) + +// CheckNameAvailability is description of a Check Name availability request +// properties. +type CheckNameAvailability struct { + Name *string `json:"name,omitempty"` +} + +// CheckNameAvailabilityResult is description of a Check Name availability +// request properties. +type CheckNameAvailabilityResult struct { + autorest.Response `json:"-"` + NameAvailable *bool `json:"nameAvailable,omitempty"` + Reason UnavailableReason `json:"reason,omitempty"` + Message *string `json:"message,omitempty"` +} + +// ConsumerGroup is description of the consumer group resource. +type ConsumerGroup struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` *ConsumerGroupProperties `json:"properties,omitempty"` } @@ -153,8 +142,8 @@ type ConsumerGroupCreateOrUpdateParameters struct { // operation. type ConsumerGroupListResult struct { autorest.Response `json:"-"` - Value *[]ConsumerGroupResource `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` + Value *[]ConsumerGroup `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` } // ConsumerGroupListResultPreparer prepares a request to retrieve the next set of results. It returns @@ -169,7 +158,7 @@ func (client ConsumerGroupListResult) ConsumerGroupListResultPreparer() (*http.R autorest.WithBaseURL(to.String(client.NextLink))) } -// ConsumerGroupProperties is +// ConsumerGroupProperties is description of a Consumer Group properties. type ConsumerGroupProperties struct { CreatedAt *date.Time `json:"createdAt,omitempty"` EventHubPath *string `json:"eventHubPath,omitempty"` @@ -177,31 +166,27 @@ type ConsumerGroupProperties struct { UserMetadata *string `json:"userMetadata,omitempty"` } -// ConsumerGroupResource is description of the consumer group resource. -type ConsumerGroupResource struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - *ConsumerGroupProperties `json:"properties,omitempty"` +// ErrorResponse is error reponse indicates EventHub service is not able to +// process the incoming request. The reason is provided in the error message. +type ErrorResponse struct { + Code *string `json:"code,omitempty"` + Message *string `json:"message,omitempty"` } -// CreateOrUpdateParameters is parameters supplied to the Create Or Update -// Event Hub operation. -type CreateOrUpdateParameters struct { - Location *string `json:"location,omitempty"` - Type *string `json:"type,omitempty"` - Name *string `json:"name,omitempty"` - Properties *Properties `json:"properties,omitempty"` +// EventHub is description of the Event Hub resource. +type EventHub struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + *Properties `json:"properties,omitempty"` } // ListResult is the response of the List Event Hubs operation. type ListResult struct { autorest.Response `json:"-"` - Value *[]ResourceType `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` + Value *[]EventHub `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` } // ListResultPreparer prepares a request to retrieve the next set of results. It returns @@ -216,20 +201,23 @@ func (client ListResult) ListResultPreparer() (*http.Request, error) { autorest.WithBaseURL(to.String(client.NextLink))) } -// NamespaceCreateOrUpdateParameters is parameters supplied to the Create Or -// Update Namespace operation. -type NamespaceCreateOrUpdateParameters struct { +// Namespace is description of a namespace resource. +type Namespace struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` Location *string `json:"location,omitempty"` - Sku *Sku `json:"sku,omitempty"` Tags *map[string]*string `json:"tags,omitempty"` + Sku *Sku `json:"sku,omitempty"` *NamespaceProperties `json:"properties,omitempty"` } // NamespaceListResult is the response of the List Namespace operation. type NamespaceListResult struct { autorest.Response `json:"-"` - Value *[]NamespaceResource `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` + Value *[]Namespace `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` } // NamespaceListResultPreparer prepares a request to retrieve the next set of results. It returns @@ -246,28 +234,53 @@ func (client NamespaceListResult) NamespaceListResultPreparer() (*http.Request, // NamespaceProperties is properties of the namespace. type NamespaceProperties struct { - ProvisioningState *string `json:"provisioningState,omitempty"` - Status NamespaceState `json:"status,omitempty"` - CreatedAt *date.Time `json:"createdAt,omitempty"` - UpdatedAt *date.Time `json:"updatedAt,omitempty"` - ServiceBusEndpoint *string `json:"serviceBusEndpoint,omitempty"` - CreateACSNamespace *bool `json:"createACSNamespace,omitempty"` - Enabled *bool `json:"enabled,omitempty"` + ProvisioningState *string `json:"provisioningState,omitempty"` + CreatedAt *date.Time `json:"createdAt,omitempty"` + UpdatedAt *date.Time `json:"updatedAt,omitempty"` + ServiceBusEndpoint *string `json:"serviceBusEndpoint,omitempty"` } -// NamespaceResource is description of a namespace resource. -type NamespaceResource struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - Sku *Sku `json:"sku,omitempty"` - *NamespaceProperties `json:"properties,omitempty"` +// NamespaceUpdateParameter is parameters supplied to the Patch Namespace +// operation. +type NamespaceUpdateParameter struct { + Tags *map[string]*string `json:"tags,omitempty"` + Sku *Sku `json:"sku,omitempty"` +} + +// Operation is a EventHub REST API operation +type Operation struct { + Name *string `json:"name,omitempty"` + Display *OperationDisplay `json:"display,omitempty"` +} + +// OperationDisplay is the object that represents the operation. +type OperationDisplay struct { + Provider *string `json:"provider,omitempty"` + Resource *string `json:"resource,omitempty"` + Operation *string `json:"operation,omitempty"` +} + +// OperationListResult is result of the request to list EventHub 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 *[]Operation `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` } -// Properties is +// OperationListResultPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client OperationListResult) OperationListResultPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// Properties is description of a EventHub Properties. type Properties struct { CreatedAt *date.Time `json:"createdAt,omitempty"` MessageRetentionInDays *int64 `json:"messageRetentionInDays,omitempty"` @@ -280,16 +293,14 @@ type Properties struct { // RegenerateKeysParameters is parameters supplied to the Regenerate // Authorization Rule operation. type RegenerateKeysParameters struct { - Policykey Policykey `json:"Policykey,omitempty"` + Policykey Policykey `json:"policykey,omitempty"` } -// Resource is +// Resource is the Resource definition type Resource struct { - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` } // ResourceListKeys is namespace/EventHub Connection String @@ -302,22 +313,13 @@ type ResourceListKeys struct { KeyName *string `json:"keyName,omitempty"` } -// ResourceType is description of the Event Hub resource. -type ResourceType struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - *Properties `json:"properties,omitempty"` -} - -// SharedAccessAuthorizationRuleCreateOrUpdateParameters is parameters -// supplied to the Create Or Update Authorization Rules operation. -type SharedAccessAuthorizationRuleCreateOrUpdateParameters struct { - Location *string `json:"location,omitempty"` +// SharedAccessAuthorizationRule is description of a namespace authorization +// rule. +type SharedAccessAuthorizationRule struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` *SharedAccessAuthorizationRuleProperties `json:"properties,omitempty"` } @@ -325,8 +327,8 @@ type SharedAccessAuthorizationRuleCreateOrUpdateParameters struct { // Namespace operation. type SharedAccessAuthorizationRuleListResult struct { autorest.Response `json:"-"` - Value *[]SharedAccessAuthorizationRuleResource `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` + Value *[]SharedAccessAuthorizationRule `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` } // SharedAccessAuthorizationRuleListResultPreparer prepares a request to retrieve the next set of results. It returns @@ -347,21 +349,18 @@ type SharedAccessAuthorizationRuleProperties struct { Rights *[]AccessRights `json:"rights,omitempty"` } -// SharedAccessAuthorizationRuleResource is description of a namespace -// authorization rule. -type SharedAccessAuthorizationRuleResource struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - *SharedAccessAuthorizationRuleProperties `json:"properties,omitempty"` -} - // Sku is sKU of the namespace. type Sku struct { Name SkuName `json:"name,omitempty"` Tier SkuTier `json:"tier,omitempty"` Capacity *int32 `json:"capacity,omitempty"` } + +// TrackedResource is definition of Resource +type TrackedResource struct { + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Location *string `json:"location,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` +} diff --git a/arm/eventhub/namespaces.go b/arm/eventhub/namespaces.go old mode 100644 new mode 100755 index be52e0d8959f..f9315bc9aae5 --- a/arm/eventhub/namespaces.go +++ b/arm/eventhub/namespaces.go @@ -14,7 +14,7 @@ package eventhub // See the License for the specific language governing permissions and // limitations under the License. // -// Code generated by Microsoft (R) AutoRest Code Generator 0.17.0.0 +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 // Changes may cause incorrect behavior and will be lost if the code is // regenerated. @@ -41,19 +41,92 @@ func NewNamespacesClientWithBaseURI(baseURI string, subscriptionID string) Names return NamespacesClient{NewWithBaseURI(baseURI, subscriptionID)} } +// CheckNameAvailabilityMethod check the give namespace name availability. +// +// parameters is parameters to check availability of the given namespace name +func (client NamespacesClient) CheckNameAvailabilityMethod(parameters CheckNameAvailability) (result CheckNameAvailabilityResult, err error) { + 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.NewErrorWithValidationError(err, "eventhub.NamespacesClient", "CheckNameAvailabilityMethod") + } + + req, err := client.CheckNameAvailabilityMethodPreparer(parameters) + if err != nil { + return result, autorest.NewErrorWithError(err, "eventhub.NamespacesClient", "CheckNameAvailabilityMethod", nil, "Failure preparing request") + } + + resp, err := client.CheckNameAvailabilityMethodSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "eventhub.NamespacesClient", "CheckNameAvailabilityMethod", resp, "Failure sending request") + } + + result, err = client.CheckNameAvailabilityMethodResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "eventhub.NamespacesClient", "CheckNameAvailabilityMethod", resp, "Failure responding to request") + } + + return +} + +// CheckNameAvailabilityMethodPreparer prepares the CheckNameAvailabilityMethod request. +func (client NamespacesClient) CheckNameAvailabilityMethodPreparer(parameters CheckNameAvailability) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.EventHub/CheckNameAvailability", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CheckNameAvailabilityMethodSender sends the CheckNameAvailabilityMethod request. The method will close the +// http.Response Body if it receives an error. +func (client NamespacesClient) CheckNameAvailabilityMethodSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CheckNameAvailabilityMethodResponder handles the response to the CheckNameAvailabilityMethod request. The method always +// closes the http.Response Body. +func (client NamespacesClient) CheckNameAvailabilityMethodResponder(resp *http.Response) (result CheckNameAvailabilityResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + // CreateOrUpdate creates or updates a namespace. Once created, this // namespace's resource manifest is immutable. This operation is idempotent. -// This method may poll for completion. Polling can be canceled by passing -// the cancel channel argument. The channel will be used to cancel polling -// and any outstanding HTTP requests. +// This method may poll for completion. Polling can be canceled by passing the +// cancel channel argument. The channel will be used to cancel polling and any +// outstanding HTTP requests. // -// resourceGroupName is the name of the resource group. namespaceName is the -// namespace name. parameters is parameters for creating a namespace -// resource. -func (client NamespacesClient) CreateOrUpdate(resourceGroupName string, namespaceName string, parameters NamespaceCreateOrUpdateParameters, cancel <-chan struct{}) (result autorest.Response, err error) { +// resourceGroupName is name of the Resource group within the Azure +// subscription. namespaceName is the namespace name parameters is parameters +// for creating a namespace resource. +func (client NamespacesClient) CreateOrUpdate(resourceGroupName string, namespaceName string, parameters Namespace, cancel <-chan struct{}) (result autorest.Response, err error) { if err := validation.Validate([]validation.Validation{ - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.Location", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: namespaceName, + Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}}); err != nil { return result, validation.NewErrorWithValidationError(err, "eventhub.NamespacesClient", "CreateOrUpdate") } @@ -77,15 +150,16 @@ func (client NamespacesClient) CreateOrUpdate(resourceGroupName string, namespac } // CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client NamespacesClient) CreateOrUpdatePreparer(resourceGroupName string, namespaceName string, parameters NamespaceCreateOrUpdateParameters, cancel <-chan struct{}) (*http.Request, error) { +func (client NamespacesClient) CreateOrUpdatePreparer(resourceGroupName string, namespaceName string, parameters Namespace, cancel <-chan struct{}) (*http.Request, error) { pathParameters := map[string]interface{}{ "namespaceName": autorest.Encode("path", namespaceName), "resourceGroupName": autorest.Encode("path", resourceGroupName), "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2015-08-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -112,21 +186,30 @@ func (client NamespacesClient) CreateOrUpdateResponder(resp *http.Response) (res err = autorest.Respond( resp, client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), + azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK, http.StatusAccepted), autorest.ByClosing()) result.Response = resp return } -// CreateOrUpdateAuthorizationRule creates or updates an authorization rule -// for a namespace. +// CreateOrUpdateAuthorizationRule creates or updates an authorization rule for +// a namespace. // -// resourceGroupName is the name of the resource group in which the namespace -// lives. namespaceName is the namespace name. authorizationRuleName is -// namespace authorization rule name. parameters is the shared access -// authorization rule. -func (client NamespacesClient) CreateOrUpdateAuthorizationRule(resourceGroupName string, namespaceName string, authorizationRuleName string, parameters SharedAccessAuthorizationRuleCreateOrUpdateParameters) (result SharedAccessAuthorizationRuleResource, err error) { +// resourceGroupName is name of the Resource group within the Azure +// subscription. namespaceName is the namespace name authorizationRuleName is +// the authorizationrule name. parameters is the shared access authorization +// rule. +func (client NamespacesClient) CreateOrUpdateAuthorizationRule(resourceGroupName string, namespaceName string, authorizationRuleName string, parameters SharedAccessAuthorizationRule) (result SharedAccessAuthorizationRule, err error) { if err := validation.Validate([]validation.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: namespaceName, + Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, + {TargetValue: authorizationRuleName, + Constraints: []validation.Constraint{{Target: "authorizationRuleName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "authorizationRuleName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: parameters, Constraints: []validation.Constraint{{Target: "parameters.SharedAccessAuthorizationRuleProperties", Name: validation.Null, Rule: false, Chain: []validation.Constraint{{Target: "parameters.SharedAccessAuthorizationRuleProperties.Rights", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { @@ -153,7 +236,7 @@ func (client NamespacesClient) CreateOrUpdateAuthorizationRule(resourceGroupName } // CreateOrUpdateAuthorizationRulePreparer prepares the CreateOrUpdateAuthorizationRule request. -func (client NamespacesClient) CreateOrUpdateAuthorizationRulePreparer(resourceGroupName string, namespaceName string, authorizationRuleName string, parameters SharedAccessAuthorizationRuleCreateOrUpdateParameters) (*http.Request, error) { +func (client NamespacesClient) CreateOrUpdateAuthorizationRulePreparer(resourceGroupName string, namespaceName string, authorizationRuleName string, parameters SharedAccessAuthorizationRule) (*http.Request, error) { pathParameters := map[string]interface{}{ "authorizationRuleName": autorest.Encode("path", authorizationRuleName), "namespaceName": autorest.Encode("path", namespaceName), @@ -161,8 +244,9 @@ func (client NamespacesClient) CreateOrUpdateAuthorizationRulePreparer(resourceG "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2015-08-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -183,7 +267,7 @@ func (client NamespacesClient) CreateOrUpdateAuthorizationRuleSender(req *http.R // CreateOrUpdateAuthorizationRuleResponder handles the response to the CreateOrUpdateAuthorizationRule request. The method always // closes the http.Response Body. -func (client NamespacesClient) CreateOrUpdateAuthorizationRuleResponder(resp *http.Response) (result SharedAccessAuthorizationRuleResource, err error) { +func (client NamespacesClient) CreateOrUpdateAuthorizationRuleResponder(resp *http.Response) (result SharedAccessAuthorizationRule, err error) { err = autorest.Respond( resp, client.ByInspecting(), @@ -196,13 +280,23 @@ func (client NamespacesClient) CreateOrUpdateAuthorizationRuleResponder(resp *ht // Delete deletes an existing namespace. This operation also removes all // associated resources under the namespace. This method may poll for -// completion. Polling can be canceled by passing the cancel channel -// argument. The channel will be used to cancel polling and any outstanding -// HTTP requests. +// completion. Polling can be canceled by passing the cancel channel argument. +// The channel will be used to cancel polling and any outstanding HTTP +// requests. // -// resourceGroupName is the name of the resource group in which the namespace -// lives. namespaceName is the name of the namespace to delete. +// resourceGroupName is name of the Resource group within the Azure +// subscription. namespaceName is the namespace name func (client NamespacesClient) Delete(resourceGroupName string, namespaceName string, cancel <-chan struct{}) (result autorest.Response, err error) { + if err := validation.Validate([]validation.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: namespaceName, + Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "eventhub.NamespacesClient", "Delete") + } + req, err := client.DeletePreparer(resourceGroupName, namespaceName, cancel) if err != nil { return result, autorest.NewErrorWithError(err, "eventhub.NamespacesClient", "Delete", nil, "Failure preparing request") @@ -230,8 +324,9 @@ func (client NamespacesClient) DeletePreparer(resourceGroupName string, namespac "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2015-08-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -264,10 +359,23 @@ func (client NamespacesClient) DeleteResponder(resp *http.Response) (result auto // DeleteAuthorizationRule deletes an authorization rule for a namespace. // -// resourceGroupName is the name of the resource group in which the namespace -// lives. namespaceName is the namespace name. authorizationRuleName is -// authorization rule name. +// resourceGroupName is name of the Resource group within the Azure +// subscription. namespaceName is the namespace name authorizationRuleName is +// the authorizationrule name. func (client NamespacesClient) DeleteAuthorizationRule(resourceGroupName string, namespaceName string, authorizationRuleName string) (result autorest.Response, err error) { + if err := validation.Validate([]validation.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: namespaceName, + Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, + {TargetValue: authorizationRuleName, + Constraints: []validation.Constraint{{Target: "authorizationRuleName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "authorizationRuleName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "eventhub.NamespacesClient", "DeleteAuthorizationRule") + } + req, err := client.DeleteAuthorizationRulePreparer(resourceGroupName, namespaceName, authorizationRuleName) if err != nil { return result, autorest.NewErrorWithError(err, "eventhub.NamespacesClient", "DeleteAuthorizationRule", nil, "Failure preparing request") @@ -296,8 +404,9 @@ func (client NamespacesClient) DeleteAuthorizationRulePreparer(resourceGroupName "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2015-08-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -328,9 +437,19 @@ func (client NamespacesClient) DeleteAuthorizationRuleResponder(resp *http.Respo // Get gets the description of the specified namespace. // -// resourceGroupName is the name of the resource group in which the namespace -// lives. namespaceName is the name of the specified namespace. -func (client NamespacesClient) Get(resourceGroupName string, namespaceName string) (result NamespaceResource, err error) { +// resourceGroupName is name of the Resource group within the Azure +// subscription. namespaceName is the namespace name +func (client NamespacesClient) Get(resourceGroupName string, namespaceName string) (result Namespace, err error) { + if err := validation.Validate([]validation.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: namespaceName, + Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "eventhub.NamespacesClient", "Get") + } + req, err := client.GetPreparer(resourceGroupName, namespaceName) if err != nil { return result, autorest.NewErrorWithError(err, "eventhub.NamespacesClient", "Get", nil, "Failure preparing request") @@ -358,8 +477,9 @@ func (client NamespacesClient) GetPreparer(resourceGroupName string, namespaceNa "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2015-08-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -378,7 +498,7 @@ func (client NamespacesClient) GetSender(req *http.Request) (*http.Response, err // GetResponder handles the response to the Get request. The method always // closes the http.Response Body. -func (client NamespacesClient) GetResponder(resp *http.Response) (result NamespaceResource, err error) { +func (client NamespacesClient) GetResponder(resp *http.Response) (result Namespace, err error) { err = autorest.Respond( resp, client.ByInspecting(), @@ -392,10 +512,23 @@ func (client NamespacesClient) GetResponder(resp *http.Response) (result Namespa // GetAuthorizationRule gets an authorization rule for a namespace by rule // name. // -// resourceGroupName is the name of the resource group in which the namespace -// lives. namespaceName is the namespace name. authorizationRuleName is -// authorization rule name. -func (client NamespacesClient) GetAuthorizationRule(resourceGroupName string, namespaceName string, authorizationRuleName string) (result SharedAccessAuthorizationRuleResource, err error) { +// resourceGroupName is name of the Resource group within the Azure +// subscription. namespaceName is the namespace name authorizationRuleName is +// the authorizationrule name. +func (client NamespacesClient) GetAuthorizationRule(resourceGroupName string, namespaceName string, authorizationRuleName string) (result SharedAccessAuthorizationRule, err error) { + if err := validation.Validate([]validation.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: namespaceName, + Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, + {TargetValue: authorizationRuleName, + Constraints: []validation.Constraint{{Target: "authorizationRuleName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "authorizationRuleName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "eventhub.NamespacesClient", "GetAuthorizationRule") + } + req, err := client.GetAuthorizationRulePreparer(resourceGroupName, namespaceName, authorizationRuleName) if err != nil { return result, autorest.NewErrorWithError(err, "eventhub.NamespacesClient", "GetAuthorizationRule", nil, "Failure preparing request") @@ -424,8 +557,9 @@ func (client NamespacesClient) GetAuthorizationRulePreparer(resourceGroupName st "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2015-08-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -444,7 +578,7 @@ func (client NamespacesClient) GetAuthorizationRuleSender(req *http.Request) (*h // GetAuthorizationRuleResponder handles the response to the GetAuthorizationRule request. The method always // closes the http.Response Body. -func (client NamespacesClient) GetAuthorizationRuleResponder(resp *http.Response) (result SharedAccessAuthorizationRuleResource, err error) { +func (client NamespacesClient) GetAuthorizationRuleResponder(resp *http.Response) (result SharedAccessAuthorizationRule, err error) { err = autorest.Respond( resp, client.ByInspecting(), @@ -455,59 +589,56 @@ func (client NamespacesClient) GetAuthorizationRuleResponder(resp *http.Response return } -// ListAuthorizationRules gets a list of authorization rules for a namespace. -// -// resourceGroupName is the name of the resource group in which the namespace -// lives. namespaceName is the namespace name. -func (client NamespacesClient) ListAuthorizationRules(resourceGroupName string, namespaceName string) (result SharedAccessAuthorizationRuleListResult, err error) { - req, err := client.ListAuthorizationRulesPreparer(resourceGroupName, namespaceName) +// List lists all the available namespaces within a subscription, irrespective +// of the resource groups. +func (client NamespacesClient) List() (result NamespaceListResult, err error) { + req, err := client.ListPreparer() if err != nil { - return result, autorest.NewErrorWithError(err, "eventhub.NamespacesClient", "ListAuthorizationRules", nil, "Failure preparing request") + return result, autorest.NewErrorWithError(err, "eventhub.NamespacesClient", "List", nil, "Failure preparing request") } - resp, err := client.ListAuthorizationRulesSender(req) + resp, err := client.ListSender(req) if err != nil { result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "eventhub.NamespacesClient", "ListAuthorizationRules", resp, "Failure sending request") + return result, autorest.NewErrorWithError(err, "eventhub.NamespacesClient", "List", resp, "Failure sending request") } - result, err = client.ListAuthorizationRulesResponder(resp) + result, err = client.ListResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "eventhub.NamespacesClient", "ListAuthorizationRules", resp, "Failure responding to request") + err = autorest.NewErrorWithError(err, "eventhub.NamespacesClient", "List", resp, "Failure responding to request") } return } -// ListAuthorizationRulesPreparer prepares the ListAuthorizationRules request. -func (client NamespacesClient) ListAuthorizationRulesPreparer(resourceGroupName string, namespaceName string) (*http.Request, error) { +// ListPreparer prepares the List request. +func (client NamespacesClient) ListPreparer() (*http.Request, error) { pathParameters := map[string]interface{}{ - "namespaceName": autorest.Encode("path", namespaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2015-08-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/AuthorizationRules", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.EventHub/namespaces", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare(&http.Request{}) } -// ListAuthorizationRulesSender sends the ListAuthorizationRules request. The method will close the +// ListSender sends the List request. The method will close the // http.Response Body if it receives an error. -func (client NamespacesClient) ListAuthorizationRulesSender(req *http.Request) (*http.Response, error) { +func (client NamespacesClient) ListSender(req *http.Request) (*http.Response, error) { return autorest.SendWithSender(client, req) } -// ListAuthorizationRulesResponder handles the response to the ListAuthorizationRules request. The method always +// ListResponder handles the response to the List request. The method always // closes the http.Response Body. -func (client NamespacesClient) ListAuthorizationRulesResponder(resp *http.Response) (result SharedAccessAuthorizationRuleListResult, err error) { +func (client NamespacesClient) ListResponder(resp *http.Response) (result NamespaceListResult, err error) { err = autorest.Respond( resp, client.ByInspecting(), @@ -518,81 +649,94 @@ func (client NamespacesClient) ListAuthorizationRulesResponder(resp *http.Respon return } -// ListAuthorizationRulesNextResults retrieves the next set of results, if any. -func (client NamespacesClient) ListAuthorizationRulesNextResults(lastResults SharedAccessAuthorizationRuleListResult) (result SharedAccessAuthorizationRuleListResult, err error) { - req, err := lastResults.SharedAccessAuthorizationRuleListResultPreparer() +// ListNextResults retrieves the next set of results, if any. +func (client NamespacesClient) ListNextResults(lastResults NamespaceListResult) (result NamespaceListResult, err error) { + req, err := lastResults.NamespaceListResultPreparer() if err != nil { - return result, autorest.NewErrorWithError(err, "eventhub.NamespacesClient", "ListAuthorizationRules", nil, "Failure preparing next results request") + return result, autorest.NewErrorWithError(err, "eventhub.NamespacesClient", "List", nil, "Failure preparing next results request") } if req == nil { return } - resp, err := client.ListAuthorizationRulesSender(req) + resp, err := client.ListSender(req) if err != nil { result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "eventhub.NamespacesClient", "ListAuthorizationRules", resp, "Failure sending next results request") + return result, autorest.NewErrorWithError(err, "eventhub.NamespacesClient", "List", resp, "Failure sending next results request") } - result, err = client.ListAuthorizationRulesResponder(resp) + result, err = client.ListResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "eventhub.NamespacesClient", "ListAuthorizationRules", resp, "Failure responding to next results request") + err = autorest.NewErrorWithError(err, "eventhub.NamespacesClient", "List", resp, "Failure responding to next results request") } return } -// ListByResourceGroup lists the available namespaces within a resource group. +// ListAuthorizationRules gets a list of authorization rules for a namespace. // -// resourceGroupName is the name of the resource group. -func (client NamespacesClient) ListByResourceGroup(resourceGroupName string) (result NamespaceListResult, err error) { - req, err := client.ListByResourceGroupPreparer(resourceGroupName) +// resourceGroupName is name of the Resource group within the Azure +// subscription. namespaceName is the namespace name +func (client NamespacesClient) ListAuthorizationRules(resourceGroupName string, namespaceName string) (result SharedAccessAuthorizationRuleListResult, err error) { + if err := validation.Validate([]validation.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: namespaceName, + Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "eventhub.NamespacesClient", "ListAuthorizationRules") + } + + req, err := client.ListAuthorizationRulesPreparer(resourceGroupName, namespaceName) if err != nil { - return result, autorest.NewErrorWithError(err, "eventhub.NamespacesClient", "ListByResourceGroup", nil, "Failure preparing request") + return result, autorest.NewErrorWithError(err, "eventhub.NamespacesClient", "ListAuthorizationRules", nil, "Failure preparing request") } - resp, err := client.ListByResourceGroupSender(req) + resp, err := client.ListAuthorizationRulesSender(req) if err != nil { result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "eventhub.NamespacesClient", "ListByResourceGroup", resp, "Failure sending request") + return result, autorest.NewErrorWithError(err, "eventhub.NamespacesClient", "ListAuthorizationRules", resp, "Failure sending request") } - result, err = client.ListByResourceGroupResponder(resp) + result, err = client.ListAuthorizationRulesResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "eventhub.NamespacesClient", "ListByResourceGroup", resp, "Failure responding to request") + err = autorest.NewErrorWithError(err, "eventhub.NamespacesClient", "ListAuthorizationRules", resp, "Failure responding to request") } return } -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client NamespacesClient) ListByResourceGroupPreparer(resourceGroupName string) (*http.Request, error) { +// ListAuthorizationRulesPreparer prepares the ListAuthorizationRules request. +func (client NamespacesClient) ListAuthorizationRulesPreparer(resourceGroupName string, namespaceName string) (*http.Request, error) { pathParameters := map[string]interface{}{ + "namespaceName": autorest.Encode("path", namespaceName), "resourceGroupName": autorest.Encode("path", resourceGroupName), "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2015-08-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/AuthorizationRules", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare(&http.Request{}) } -// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the +// ListAuthorizationRulesSender sends the ListAuthorizationRules request. The method will close the // http.Response Body if it receives an error. -func (client NamespacesClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { +func (client NamespacesClient) ListAuthorizationRulesSender(req *http.Request) (*http.Response, error) { return autorest.SendWithSender(client, req) } -// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always +// ListAuthorizationRulesResponder handles the response to the ListAuthorizationRules request. The method always // closes the http.Response Body. -func (client NamespacesClient) ListByResourceGroupResponder(resp *http.Response) (result NamespaceListResult, err error) { +func (client NamespacesClient) ListAuthorizationRulesResponder(resp *http.Response) (result SharedAccessAuthorizationRuleListResult, err error) { err = autorest.Respond( resp, client.ByInspecting(), @@ -603,79 +747,90 @@ func (client NamespacesClient) ListByResourceGroupResponder(resp *http.Response) return } -// ListByResourceGroupNextResults retrieves the next set of results, if any. -func (client NamespacesClient) ListByResourceGroupNextResults(lastResults NamespaceListResult) (result NamespaceListResult, err error) { - req, err := lastResults.NamespaceListResultPreparer() +// ListAuthorizationRulesNextResults retrieves the next set of results, if any. +func (client NamespacesClient) ListAuthorizationRulesNextResults(lastResults SharedAccessAuthorizationRuleListResult) (result SharedAccessAuthorizationRuleListResult, err error) { + req, err := lastResults.SharedAccessAuthorizationRuleListResultPreparer() if err != nil { - return result, autorest.NewErrorWithError(err, "eventhub.NamespacesClient", "ListByResourceGroup", nil, "Failure preparing next results request") + return result, autorest.NewErrorWithError(err, "eventhub.NamespacesClient", "ListAuthorizationRules", nil, "Failure preparing next results request") } if req == nil { return } - resp, err := client.ListByResourceGroupSender(req) + resp, err := client.ListAuthorizationRulesSender(req) if err != nil { result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "eventhub.NamespacesClient", "ListByResourceGroup", resp, "Failure sending next results request") + return result, autorest.NewErrorWithError(err, "eventhub.NamespacesClient", "ListAuthorizationRules", resp, "Failure sending next results request") } - result, err = client.ListByResourceGroupResponder(resp) + result, err = client.ListAuthorizationRulesResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "eventhub.NamespacesClient", "ListByResourceGroup", resp, "Failure responding to next results request") + err = autorest.NewErrorWithError(err, "eventhub.NamespacesClient", "ListAuthorizationRules", resp, "Failure responding to next results request") } return } -// ListBySubscription lists all the available namespaces within a -// subscription, irrespective of the resource groups. -func (client NamespacesClient) ListBySubscription() (result NamespaceListResult, err error) { - req, err := client.ListBySubscriptionPreparer() +// ListByResourceGroup lists the available namespaces within a resource group. +// +// resourceGroupName is name of the Resource group within the Azure +// subscription. +func (client NamespacesClient) ListByResourceGroup(resourceGroupName string) (result NamespaceListResult, err error) { + if err := validation.Validate([]validation.Validation{ + {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.NewErrorWithValidationError(err, "eventhub.NamespacesClient", "ListByResourceGroup") + } + + req, err := client.ListByResourceGroupPreparer(resourceGroupName) if err != nil { - return result, autorest.NewErrorWithError(err, "eventhub.NamespacesClient", "ListBySubscription", nil, "Failure preparing request") + return result, autorest.NewErrorWithError(err, "eventhub.NamespacesClient", "ListByResourceGroup", nil, "Failure preparing request") } - resp, err := client.ListBySubscriptionSender(req) + resp, err := client.ListByResourceGroupSender(req) if err != nil { result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "eventhub.NamespacesClient", "ListBySubscription", resp, "Failure sending request") + return result, autorest.NewErrorWithError(err, "eventhub.NamespacesClient", "ListByResourceGroup", resp, "Failure sending request") } - result, err = client.ListBySubscriptionResponder(resp) + result, err = client.ListByResourceGroupResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "eventhub.NamespacesClient", "ListBySubscription", resp, "Failure responding to request") + err = autorest.NewErrorWithError(err, "eventhub.NamespacesClient", "ListByResourceGroup", resp, "Failure responding to request") } return } -// ListBySubscriptionPreparer prepares the ListBySubscription request. -func (client NamespacesClient) ListBySubscriptionPreparer() (*http.Request, error) { +// ListByResourceGroupPreparer prepares the ListByResourceGroup request. +func (client NamespacesClient) ListByResourceGroupPreparer(resourceGroupName string) (*http.Request, error) { pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2015-08-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.EventHub/namespaces", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare(&http.Request{}) } -// ListBySubscriptionSender sends the ListBySubscription request. The method will close the +// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the // http.Response Body if it receives an error. -func (client NamespacesClient) ListBySubscriptionSender(req *http.Request) (*http.Response, error) { +func (client NamespacesClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { return autorest.SendWithSender(client, req) } -// ListBySubscriptionResponder handles the response to the ListBySubscription request. The method always +// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always // closes the http.Response Body. -func (client NamespacesClient) ListBySubscriptionResponder(resp *http.Response) (result NamespaceListResult, err error) { +func (client NamespacesClient) ListByResourceGroupResponder(resp *http.Response) (result NamespaceListResult, err error) { err = autorest.Respond( resp, client.ByInspecting(), @@ -686,25 +841,25 @@ func (client NamespacesClient) ListBySubscriptionResponder(resp *http.Response) return } -// ListBySubscriptionNextResults retrieves the next set of results, if any. -func (client NamespacesClient) ListBySubscriptionNextResults(lastResults NamespaceListResult) (result NamespaceListResult, err error) { +// ListByResourceGroupNextResults retrieves the next set of results, if any. +func (client NamespacesClient) ListByResourceGroupNextResults(lastResults NamespaceListResult) (result NamespaceListResult, err error) { req, err := lastResults.NamespaceListResultPreparer() if err != nil { - return result, autorest.NewErrorWithError(err, "eventhub.NamespacesClient", "ListBySubscription", nil, "Failure preparing next results request") + return result, autorest.NewErrorWithError(err, "eventhub.NamespacesClient", "ListByResourceGroup", nil, "Failure preparing next results request") } if req == nil { return } - resp, err := client.ListBySubscriptionSender(req) + resp, err := client.ListByResourceGroupSender(req) if err != nil { result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "eventhub.NamespacesClient", "ListBySubscription", resp, "Failure sending next results request") + return result, autorest.NewErrorWithError(err, "eventhub.NamespacesClient", "ListByResourceGroup", resp, "Failure sending next results request") } - result, err = client.ListBySubscriptionResponder(resp) + result, err = client.ListByResourceGroupResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "eventhub.NamespacesClient", "ListBySubscription", resp, "Failure responding to next results request") + err = autorest.NewErrorWithError(err, "eventhub.NamespacesClient", "ListByResourceGroup", resp, "Failure responding to next results request") } return @@ -713,10 +868,23 @@ func (client NamespacesClient) ListBySubscriptionNextResults(lastResults Namespa // ListKeys gets the primary and secondary connection strings for the // namespace. // -// resourceGroupName is the name of the resource group in which the namespace -// lives. namespaceName is the namespace name. authorizationRuleName is the -// authorization rule name. +// resourceGroupName is name of the Resource group within the Azure +// subscription. namespaceName is the namespace name authorizationRuleName is +// the authorizationrule name. func (client NamespacesClient) ListKeys(resourceGroupName string, namespaceName string, authorizationRuleName string) (result ResourceListKeys, err error) { + if err := validation.Validate([]validation.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: namespaceName, + Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, + {TargetValue: authorizationRuleName, + Constraints: []validation.Constraint{{Target: "authorizationRuleName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "authorizationRuleName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "eventhub.NamespacesClient", "ListKeys") + } + req, err := client.ListKeysPreparer(resourceGroupName, namespaceName, authorizationRuleName) if err != nil { return result, autorest.NewErrorWithError(err, "eventhub.NamespacesClient", "ListKeys", nil, "Failure preparing request") @@ -745,8 +913,9 @@ func (client NamespacesClient) ListKeysPreparer(resourceGroupName string, namesp "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2015-08-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -779,11 +948,24 @@ func (client NamespacesClient) ListKeysResponder(resp *http.Response) (result Re // RegenerateKeys regenerates the primary or secondary connection strings for // the specified namespace. // -// resourceGroupName is the name of the resource group in which the namespace -// lives. namespaceName is the namespace name. authorizationRuleName is the -// authorization rule name. parameters is parameters required to regenerate +// resourceGroupName is name of the Resource group within the Azure +// subscription. namespaceName is the namespace name authorizationRuleName is +// the authorizationrule name. parameters is parameters required to regenerate // the connection string. func (client NamespacesClient) RegenerateKeys(resourceGroupName string, namespaceName string, authorizationRuleName string, parameters RegenerateKeysParameters) (result ResourceListKeys, err error) { + if err := validation.Validate([]validation.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: namespaceName, + Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, + {TargetValue: authorizationRuleName, + Constraints: []validation.Constraint{{Target: "authorizationRuleName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "authorizationRuleName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "eventhub.NamespacesClient", "RegenerateKeys") + } + req, err := client.RegenerateKeysPreparer(resourceGroupName, namespaceName, authorizationRuleName, parameters) if err != nil { return result, autorest.NewErrorWithError(err, "eventhub.NamespacesClient", "RegenerateKeys", nil, "Failure preparing request") @@ -812,8 +994,9 @@ func (client NamespacesClient) RegenerateKeysPreparer(resourceGroupName string, "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2015-08-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -844,3 +1027,81 @@ func (client NamespacesClient) RegenerateKeysResponder(resp *http.Response) (res result.Response = autorest.Response{Response: resp} return } + +// Update creates or updates a namespace. Once created, this namespace's +// resource manifest is immutable. This operation is idempotent. +// +// resourceGroupName is name of the Resource group within the Azure +// subscription. namespaceName is the namespace name parameters is parameters +// for updating a namespace resource. +func (client NamespacesClient) Update(resourceGroupName string, namespaceName string, parameters NamespaceUpdateParameter) (result Namespace, err error) { + if err := validation.Validate([]validation.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: namespaceName, + Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "eventhub.NamespacesClient", "Update") + } + + req, err := client.UpdatePreparer(resourceGroupName, namespaceName, parameters) + if err != nil { + return result, autorest.NewErrorWithError(err, "eventhub.NamespacesClient", "Update", nil, "Failure preparing request") + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "eventhub.NamespacesClient", "Update", resp, "Failure sending request") + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "eventhub.NamespacesClient", "Update", resp, "Failure responding to request") + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client NamespacesClient) UpdatePreparer(resourceGroupName string, namespaceName string, parameters NamespaceUpdateParameter) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "namespaceName": autorest.Encode("path", namespaceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client NamespacesClient) UpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client NamespacesClient) UpdateResponder(resp *http.Response) (result Namespace, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/arm/eventhub/operations.go b/arm/eventhub/operations.go new file mode 100755 index 000000000000..04a01708005c --- /dev/null +++ b/arm/eventhub/operations.go @@ -0,0 +1,120 @@ +package eventhub + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// 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/azure" + "net/http" +) + +// OperationsClient is the azure Event Hubs client +type OperationsClient struct { + ManagementClient +} + +// 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. +func NewOperationsClientWithBaseURI(baseURI string, subscriptionID string) OperationsClient { + return OperationsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List lists all of the available event hub REST API operations. +func (client OperationsClient) List() (result OperationListResult, err error) { + req, err := client.ListPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "eventhub.OperationsClient", "List", nil, "Failure preparing request") + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "eventhub.OperationsClient", "List", resp, "Failure sending request") + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "eventhub.OperationsClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client OperationsClient) ListPreparer() (*http.Request, error) { + const APIVersion = "2015-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPath("/providers/Microsoft.EventHub/operations"), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// 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 autorest.SendWithSender(client, req) +} + +// 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, + client.ByInspecting(), + 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(lastResults OperationListResult) (result OperationListResult, err error) { + req, err := lastResults.OperationListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "eventhub.OperationsClient", "List", 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, "eventhub.OperationsClient", "List", resp, "Failure sending next results request") + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "eventhub.OperationsClient", "List", resp, "Failure responding to next results request") + } + + return +} diff --git a/arm/eventhub/version.go b/arm/eventhub/version.go old mode 100644 new mode 100755 index 780c4c75430a..16c7ea2328e1 --- a/arm/eventhub/version.go +++ b/arm/eventhub/version.go @@ -18,43 +18,12 @@ package eventhub // Changes may cause incorrect behavior and will be lost if the code is // regenerated. -import ( - "bytes" - "fmt" - "strings" -) - -const ( - major = "8" - minor = "1" - patch = "0" - tag = "beta" - userAgentFormat = "Azure-SDK-For-Go/%s arm-%s/%s" -) - -// cached results of UserAgent and Version to prevent repeated operations. -var ( - userAgent string - version string -) - // UserAgent returns the UserAgent string to use when sending http.Requests. func UserAgent() string { - if userAgent == "" { - userAgent = fmt.Sprintf(userAgentFormat, Version(), "eventhub", "2015-08-01") - } - return userAgent + return "Azure-SDK-For-Go/v9.0.0-beta arm-eventhub/2015-08-01" } // Version returns the semantic version (see http://semver.org) of the client. func Version() string { - if version == "" { - versionBuilder := bytes.NewBufferString(fmt.Sprintf("%s.%s.%s", major, minor, patch)) - if tag != "" { - versionBuilder.WriteRune('-') - versionBuilder.WriteString(strings.TrimPrefix(tag, "-")) - } - version = string(versionBuilder.Bytes()) - } - return version + return "v9.0.0-beta" } diff --git a/arm/iothub/client.go b/arm/iothub/client.go old mode 100644 new mode 100755 index cd1084419f6e..b54c132eeeee --- a/arm/iothub/client.go +++ b/arm/iothub/client.go @@ -27,9 +27,6 @@ import ( ) const ( - // APIVersion is the version of the Iothub - APIVersion = "2016-02-03" - // DefaultBaseURI is the default URI used for the service Iothub DefaultBaseURI = "https://management.azure.com" ) @@ -38,7 +35,6 @@ const ( type ManagementClient struct { autorest.Client BaseURI string - APIVersion string SubscriptionID string } @@ -52,7 +48,6 @@ func NewWithBaseURI(baseURI string, subscriptionID string) ManagementClient { return ManagementClient{ Client: autorest.NewClientWithUserAgent(UserAgent()), BaseURI: baseURI, - APIVersion: APIVersion, SubscriptionID: subscriptionID, } } diff --git a/arm/iothub/models.go b/arm/iothub/models.go old mode 100644 new mode 100755 diff --git a/arm/iothub/resource.go b/arm/iothub/resource.go old mode 100644 new mode 100755 index 1362112719f8..37406dc8b459 --- a/arm/iothub/resource.go +++ b/arm/iothub/resource.go @@ -78,8 +78,9 @@ func (client ResourceClient) CheckNameAvailabilityPreparer(operationInputs Opera "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-02-03" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -148,8 +149,9 @@ func (client ResourceClient) CreateEventHubConsumerGroupPreparer(resourceGroupNa "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-02-03" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -240,8 +242,9 @@ func (client ResourceClient) CreateOrUpdatePreparer(resourceGroupName string, re "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-02-03" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -308,8 +311,9 @@ func (client ResourceClient) DeletePreparer(resourceGroupName string, resourceNa "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-02-03" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -377,8 +381,9 @@ func (client ResourceClient) DeleteEventHubConsumerGroupPreparer(resourceGroupNa "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-02-03" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -449,8 +454,9 @@ func (client ResourceClient) ExportDevicesPreparer(resourceGroupName string, res "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-02-03" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -514,8 +520,9 @@ func (client ResourceClient) GetPreparer(resourceGroupName string, resourceName "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-02-03" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -582,8 +589,9 @@ func (client ResourceClient) GetEventHubConsumerGroupPreparer(resourceGroupName "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-02-03" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -647,8 +655,9 @@ func (client ResourceClient) GetJobPreparer(resourceGroupName string, resourceNa "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-02-03" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -714,8 +723,9 @@ func (client ResourceClient) GetKeysForKeyNamePreparer(resourceGroupName string, "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-02-03" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -777,8 +787,9 @@ func (client ResourceClient) GetQuotaMetricsPreparer(resourceGroupName string, r "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-02-03" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -864,8 +875,9 @@ func (client ResourceClient) GetStatsPreparer(resourceGroupName string, resource "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-02-03" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -927,8 +939,9 @@ func (client ResourceClient) GetValidSkusPreparer(resourceGroupName string, reso "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-02-03" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -1024,8 +1037,9 @@ func (client ResourceClient) ImportDevicesPreparer(resourceGroupName string, res "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-02-03" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -1088,8 +1102,9 @@ func (client ResourceClient) ListByResourceGroupPreparer(resourceGroupName strin "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-02-03" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -1170,8 +1185,9 @@ func (client ResourceClient) ListBySubscriptionPreparer() (*http.Request, error) "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-02-03" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -1260,8 +1276,9 @@ func (client ResourceClient) ListEventHubConsumerGroupsPreparer(resourceGroupNam "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-02-03" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -1349,8 +1366,9 @@ func (client ResourceClient) ListJobsPreparer(resourceGroupName string, resource "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-02-03" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -1437,8 +1455,9 @@ func (client ResourceClient) ListKeysPreparer(resourceGroupName string, resource "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-02-03" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( diff --git a/arm/iothub/version.go b/arm/iothub/version.go old mode 100644 new mode 100755 index c4569388132e..a9ba3732bae2 --- a/arm/iothub/version.go +++ b/arm/iothub/version.go @@ -18,43 +18,12 @@ package iothub // Changes may cause incorrect behavior and will be lost if the code is // regenerated. -import ( - "bytes" - "fmt" - "strings" -) - -const ( - major = "8" - minor = "1" - patch = "0" - tag = "beta" - userAgentFormat = "Azure-SDK-For-Go/%s arm-%s/%s" -) - -// cached results of UserAgent and Version to prevent repeated operations. -var ( - userAgent string - version string -) - // UserAgent returns the UserAgent string to use when sending http.Requests. func UserAgent() string { - if userAgent == "" { - userAgent = fmt.Sprintf(userAgentFormat, Version(), "iothub", "2016-02-03") - } - return userAgent + return "Azure-SDK-For-Go/v9.0.0-beta arm-iothub/2016-02-03" } // Version returns the semantic version (see http://semver.org) of the client. func Version() string { - if version == "" { - versionBuilder := bytes.NewBufferString(fmt.Sprintf("%s.%s.%s", major, minor, patch)) - if tag != "" { - versionBuilder.WriteRune('-') - versionBuilder.WriteString(strings.TrimPrefix(tag, "-")) - } - version = string(versionBuilder.Bytes()) - } - return version + return "v9.0.0-beta" } diff --git a/arm/keyvault/client.go b/arm/keyvault/client.go old mode 100644 new mode 100755 index f6f46b86748a..7bca66be4cf8 --- a/arm/keyvault/client.go +++ b/arm/keyvault/client.go @@ -28,9 +28,6 @@ import ( ) const ( - // APIVersion is the version of the Keyvault - APIVersion = "2015-06-01" - // DefaultBaseURI is the default URI used for the service Keyvault DefaultBaseURI = "https://management.azure.com" ) @@ -39,7 +36,6 @@ const ( type ManagementClient struct { autorest.Client BaseURI string - APIVersion string SubscriptionID string } @@ -53,7 +49,6 @@ func NewWithBaseURI(baseURI string, subscriptionID string) ManagementClient { return ManagementClient{ Client: autorest.NewClientWithUserAgent(UserAgent()), BaseURI: baseURI, - APIVersion: APIVersion, SubscriptionID: subscriptionID, } } diff --git a/arm/keyvault/models.go b/arm/keyvault/models.go old mode 100644 new mode 100755 diff --git a/arm/keyvault/vaults.go b/arm/keyvault/vaults.go old mode 100644 new mode 100755 index 8266b44ac6d0..47cfb26e72b9 --- a/arm/keyvault/vaults.go +++ b/arm/keyvault/vaults.go @@ -89,8 +89,9 @@ func (client VaultsClient) CreateOrUpdatePreparer(resourceGroupName string, vaul "vaultName": autorest.Encode("path", vaultName), } + const APIVersion = "2015-06-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -154,8 +155,9 @@ func (client VaultsClient) DeletePreparer(resourceGroupName string, vaultName st "vaultName": autorest.Encode("path", vaultName), } + const APIVersion = "2015-06-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -216,8 +218,9 @@ func (client VaultsClient) GetPreparer(resourceGroupName string, vaultName strin "vaultName": autorest.Encode("path", vaultName), } + const APIVersion = "2015-06-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -278,9 +281,10 @@ func (client VaultsClient) ListPreparer(filter string, top *int32) (*http.Reques "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2015-11-01" queryParameters := map[string]interface{}{ "$filter": autorest.Encode("query", filter), - "api-version": client.APIVersion, + "api-version": APIVersion, } if top != nil { queryParameters["$top"] = autorest.Encode("query", *top) @@ -369,8 +373,9 @@ func (client VaultsClient) ListByResourceGroupPreparer(resourceGroupName string, "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2015-06-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } if top != nil { queryParameters["$top"] = autorest.Encode("query", *top) diff --git a/arm/keyvault/version.go b/arm/keyvault/version.go old mode 100644 new mode 100755 index c23629339d36..921872a3f4ba --- a/arm/keyvault/version.go +++ b/arm/keyvault/version.go @@ -18,43 +18,12 @@ package keyvault // Changes may cause incorrect behavior and will be lost if the code is // regenerated. -import ( - "bytes" - "fmt" - "strings" -) - -const ( - major = "8" - minor = "1" - patch = "0" - tag = "beta" - userAgentFormat = "Azure-SDK-For-Go/%s arm-%s/%s" -) - -// cached results of UserAgent and Version to prevent repeated operations. -var ( - userAgent string - version string -) - // UserAgent returns the UserAgent string to use when sending http.Requests. func UserAgent() string { - if userAgent == "" { - userAgent = fmt.Sprintf(userAgentFormat, Version(), "keyvault", "2015-06-01") - } - return userAgent + return "Azure-SDK-For-Go/v9.0.0-beta arm-keyvault/2015-06-01" } // Version returns the semantic version (see http://semver.org) of the client. func Version() string { - if version == "" { - versionBuilder := bytes.NewBufferString(fmt.Sprintf("%s.%s.%s", major, minor, patch)) - if tag != "" { - versionBuilder.WriteRune('-') - versionBuilder.WriteString(strings.TrimPrefix(tag, "-")) - } - version = string(versionBuilder.Bytes()) - } - return version + return "v9.0.0-beta" } diff --git a/arm/logic/agreements.go b/arm/logic/agreements.go new file mode 100755 index 000000000000..c67fbbce2529 --- /dev/null +++ b/arm/logic/agreements.go @@ -0,0 +1,771 @@ +package logic + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// 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/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// AgreementsClient is the rEST API for Azure Logic Apps. +type AgreementsClient struct { + ManagementClient +} + +// NewAgreementsClient creates an instance of the AgreementsClient client. +func NewAgreementsClient(subscriptionID string) AgreementsClient { + return NewAgreementsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewAgreementsClientWithBaseURI creates an instance of the AgreementsClient +// client. +func NewAgreementsClientWithBaseURI(baseURI string, subscriptionID string) AgreementsClient { + return AgreementsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates or updates an integration account agreement. +// +// resourceGroupName is the resource group name. integrationAccountName is the +// integration account name. agreementName is the integration account agreement +// name. agreement is the integration account agreement. +func (client AgreementsClient) CreateOrUpdate(resourceGroupName string, integrationAccountName string, agreementName string, agreement IntegrationAccountAgreement) (result IntegrationAccountAgreement, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: agreement, + Constraints: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.HostPartner", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.GuestPartner", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.HostIdentity", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.HostIdentity.Qualifier", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.HostIdentity.Value", Name: validation.Null, Rule: true, Chain: nil}, + }}, + {Target: "agreement.IntegrationAccountAgreementProperties.GuestIdentity", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.GuestIdentity.Qualifier", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.GuestIdentity.Value", Name: validation.Null, Rule: true, Chain: nil}, + }}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.ReceiveAgreement", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.ReceiveAgreement.SenderBusinessIdentity", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.ReceiveAgreement.SenderBusinessIdentity.Qualifier", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.ReceiveAgreement.SenderBusinessIdentity.Value", Name: validation.Null, Rule: true, Chain: nil}, + }}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.ReceiveAgreement.ReceiverBusinessIdentity", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.ReceiveAgreement.ReceiverBusinessIdentity.Qualifier", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.ReceiveAgreement.ReceiverBusinessIdentity.Value", Name: validation.Null, Rule: true, Chain: nil}, + }}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.ReceiveAgreement.ProtocolSettings", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.ReceiveAgreement.ProtocolSettings.MessageConnectionSettings", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.ReceiveAgreement.ProtocolSettings.MessageConnectionSettings.IgnoreCertificateNameMismatch", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.ReceiveAgreement.ProtocolSettings.MessageConnectionSettings.SupportHTTPStatusCodeContinue", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.ReceiveAgreement.ProtocolSettings.MessageConnectionSettings.KeepHTTPConnectionAlive", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.ReceiveAgreement.ProtocolSettings.MessageConnectionSettings.UnfoldHTTPHeaders", Name: validation.Null, Rule: true, Chain: nil}, + }}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.ReceiveAgreement.ProtocolSettings.AcknowledgementConnectionSettings", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.ReceiveAgreement.ProtocolSettings.AcknowledgementConnectionSettings.IgnoreCertificateNameMismatch", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.ReceiveAgreement.ProtocolSettings.AcknowledgementConnectionSettings.SupportHTTPStatusCodeContinue", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.ReceiveAgreement.ProtocolSettings.AcknowledgementConnectionSettings.KeepHTTPConnectionAlive", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.ReceiveAgreement.ProtocolSettings.AcknowledgementConnectionSettings.UnfoldHTTPHeaders", Name: validation.Null, Rule: true, Chain: nil}, + }}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.ReceiveAgreement.ProtocolSettings.MdnSettings", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.ReceiveAgreement.ProtocolSettings.MdnSettings.NeedMdn", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.ReceiveAgreement.ProtocolSettings.MdnSettings.SignMdn", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.ReceiveAgreement.ProtocolSettings.MdnSettings.SendMdnAsynchronously", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.ReceiveAgreement.ProtocolSettings.MdnSettings.SignOutboundMdnIfOptional", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.ReceiveAgreement.ProtocolSettings.MdnSettings.SendInboundMdnToMessageBox", Name: validation.Null, Rule: true, Chain: nil}, + }}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.ReceiveAgreement.ProtocolSettings.SecuritySettings", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.ReceiveAgreement.ProtocolSettings.SecuritySettings.OverrideGroupSigningCertificate", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.ReceiveAgreement.ProtocolSettings.SecuritySettings.EnableNrrForInboundEncodedMessages", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.ReceiveAgreement.ProtocolSettings.SecuritySettings.EnableNrrForInboundDecodedMessages", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.ReceiveAgreement.ProtocolSettings.SecuritySettings.EnableNrrForOutboundMdn", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.ReceiveAgreement.ProtocolSettings.SecuritySettings.EnableNrrForOutboundEncodedMessages", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.ReceiveAgreement.ProtocolSettings.SecuritySettings.EnableNrrForOutboundDecodedMessages", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.ReceiveAgreement.ProtocolSettings.SecuritySettings.EnableNrrForInboundMdn", Name: validation.Null, Rule: true, Chain: nil}, + }}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.ReceiveAgreement.ProtocolSettings.ValidationSettings", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.ReceiveAgreement.ProtocolSettings.ValidationSettings.OverrideMessageProperties", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.ReceiveAgreement.ProtocolSettings.ValidationSettings.EncryptMessage", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.ReceiveAgreement.ProtocolSettings.ValidationSettings.SignMessage", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.ReceiveAgreement.ProtocolSettings.ValidationSettings.CompressMessage", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.ReceiveAgreement.ProtocolSettings.ValidationSettings.CheckDuplicateMessage", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.ReceiveAgreement.ProtocolSettings.ValidationSettings.InterchangeDuplicatesValidityDays", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.ReceiveAgreement.ProtocolSettings.ValidationSettings.CheckCertificateRevocationListOnSend", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.ReceiveAgreement.ProtocolSettings.ValidationSettings.CheckCertificateRevocationListOnReceive", Name: validation.Null, Rule: true, Chain: nil}, + }}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.ReceiveAgreement.ProtocolSettings.EnvelopeSettings", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.ReceiveAgreement.ProtocolSettings.EnvelopeSettings.MessageContentType", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.ReceiveAgreement.ProtocolSettings.EnvelopeSettings.TransmitFileNameInMimeHeader", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.ReceiveAgreement.ProtocolSettings.EnvelopeSettings.FileNameTemplate", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.ReceiveAgreement.ProtocolSettings.EnvelopeSettings.SuspendMessageOnFileNameGenerationError", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.ReceiveAgreement.ProtocolSettings.EnvelopeSettings.AutogenerateFileName", Name: validation.Null, Rule: true, Chain: nil}, + }}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.ReceiveAgreement.ProtocolSettings.ErrorSettings", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.ReceiveAgreement.ProtocolSettings.ErrorSettings.SuspendDuplicateMessage", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.ReceiveAgreement.ProtocolSettings.ErrorSettings.ResendIfMdnNotReceived", Name: validation.Null, Rule: true, Chain: nil}, + }}, + }}, + }}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.SendAgreement", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.SendAgreement.SenderBusinessIdentity", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.SendAgreement.SenderBusinessIdentity.Qualifier", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.SendAgreement.SenderBusinessIdentity.Value", Name: validation.Null, Rule: true, Chain: nil}, + }}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.SendAgreement.ReceiverBusinessIdentity", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.SendAgreement.ReceiverBusinessIdentity.Qualifier", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.SendAgreement.ReceiverBusinessIdentity.Value", Name: validation.Null, Rule: true, Chain: nil}, + }}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.SendAgreement.ProtocolSettings", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.SendAgreement.ProtocolSettings.MessageConnectionSettings", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.SendAgreement.ProtocolSettings.MessageConnectionSettings.IgnoreCertificateNameMismatch", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.SendAgreement.ProtocolSettings.MessageConnectionSettings.SupportHTTPStatusCodeContinue", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.SendAgreement.ProtocolSettings.MessageConnectionSettings.KeepHTTPConnectionAlive", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.SendAgreement.ProtocolSettings.MessageConnectionSettings.UnfoldHTTPHeaders", Name: validation.Null, Rule: true, Chain: nil}, + }}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.SendAgreement.ProtocolSettings.AcknowledgementConnectionSettings", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.SendAgreement.ProtocolSettings.AcknowledgementConnectionSettings.IgnoreCertificateNameMismatch", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.SendAgreement.ProtocolSettings.AcknowledgementConnectionSettings.SupportHTTPStatusCodeContinue", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.SendAgreement.ProtocolSettings.AcknowledgementConnectionSettings.KeepHTTPConnectionAlive", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.SendAgreement.ProtocolSettings.AcknowledgementConnectionSettings.UnfoldHTTPHeaders", Name: validation.Null, Rule: true, Chain: nil}, + }}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.SendAgreement.ProtocolSettings.MdnSettings", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.SendAgreement.ProtocolSettings.MdnSettings.NeedMdn", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.SendAgreement.ProtocolSettings.MdnSettings.SignMdn", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.SendAgreement.ProtocolSettings.MdnSettings.SendMdnAsynchronously", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.SendAgreement.ProtocolSettings.MdnSettings.SignOutboundMdnIfOptional", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.SendAgreement.ProtocolSettings.MdnSettings.SendInboundMdnToMessageBox", Name: validation.Null, Rule: true, Chain: nil}, + }}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.SendAgreement.ProtocolSettings.SecuritySettings", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.SendAgreement.ProtocolSettings.SecuritySettings.OverrideGroupSigningCertificate", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.SendAgreement.ProtocolSettings.SecuritySettings.EnableNrrForInboundEncodedMessages", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.SendAgreement.ProtocolSettings.SecuritySettings.EnableNrrForInboundDecodedMessages", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.SendAgreement.ProtocolSettings.SecuritySettings.EnableNrrForOutboundMdn", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.SendAgreement.ProtocolSettings.SecuritySettings.EnableNrrForOutboundEncodedMessages", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.SendAgreement.ProtocolSettings.SecuritySettings.EnableNrrForOutboundDecodedMessages", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.SendAgreement.ProtocolSettings.SecuritySettings.EnableNrrForInboundMdn", Name: validation.Null, Rule: true, Chain: nil}, + }}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.SendAgreement.ProtocolSettings.ValidationSettings", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.SendAgreement.ProtocolSettings.ValidationSettings.OverrideMessageProperties", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.SendAgreement.ProtocolSettings.ValidationSettings.EncryptMessage", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.SendAgreement.ProtocolSettings.ValidationSettings.SignMessage", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.SendAgreement.ProtocolSettings.ValidationSettings.CompressMessage", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.SendAgreement.ProtocolSettings.ValidationSettings.CheckDuplicateMessage", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.SendAgreement.ProtocolSettings.ValidationSettings.InterchangeDuplicatesValidityDays", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.SendAgreement.ProtocolSettings.ValidationSettings.CheckCertificateRevocationListOnSend", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.SendAgreement.ProtocolSettings.ValidationSettings.CheckCertificateRevocationListOnReceive", Name: validation.Null, Rule: true, Chain: nil}, + }}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.SendAgreement.ProtocolSettings.EnvelopeSettings", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.SendAgreement.ProtocolSettings.EnvelopeSettings.MessageContentType", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.SendAgreement.ProtocolSettings.EnvelopeSettings.TransmitFileNameInMimeHeader", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.SendAgreement.ProtocolSettings.EnvelopeSettings.FileNameTemplate", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.SendAgreement.ProtocolSettings.EnvelopeSettings.SuspendMessageOnFileNameGenerationError", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.SendAgreement.ProtocolSettings.EnvelopeSettings.AutogenerateFileName", Name: validation.Null, Rule: true, Chain: nil}, + }}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.SendAgreement.ProtocolSettings.ErrorSettings", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.SendAgreement.ProtocolSettings.ErrorSettings.SuspendDuplicateMessage", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.SendAgreement.ProtocolSettings.ErrorSettings.ResendIfMdnNotReceived", Name: validation.Null, Rule: true, Chain: nil}, + }}, + }}, + }}, + }}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.SenderBusinessIdentity", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.SenderBusinessIdentity.Qualifier", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.SenderBusinessIdentity.Value", Name: validation.Null, Rule: true, Chain: nil}, + }}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ReceiverBusinessIdentity", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ReceiverBusinessIdentity.Qualifier", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ReceiverBusinessIdentity.Value", Name: validation.Null, Rule: true, Chain: nil}, + }}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.ValidationSettings", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.ValidationSettings.ValidateCharacterSet", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.ValidationSettings.CheckDuplicateInterchangeControlNumber", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.ValidationSettings.InterchangeControlNumberValidityDays", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.ValidationSettings.CheckDuplicateGroupControlNumber", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.ValidationSettings.CheckDuplicateTransactionSetControlNumber", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.ValidationSettings.ValidateEdiTypes", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.ValidationSettings.ValidateXsdTypes", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.ValidationSettings.AllowLeadingAndTrailingSpacesAndZeroes", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.ValidationSettings.TrimLeadingAndTrailingSpacesAndZeroes", Name: validation.Null, Rule: true, Chain: nil}, + }}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.FramingSettings", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.FramingSettings.DataElementSeparator", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.FramingSettings.ComponentSeparator", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.FramingSettings.ReplaceSeparatorsInPayload", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.FramingSettings.ReplaceCharacter", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.FramingSettings.SegmentTerminator", Name: validation.Null, Rule: true, Chain: nil}, + }}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.EnvelopeSettings", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.EnvelopeSettings.ControlStandardsID", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.EnvelopeSettings.UseControlStandardsIDAsRepetitionCharacter", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.EnvelopeSettings.SenderApplicationID", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.EnvelopeSettings.ReceiverApplicationID", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.EnvelopeSettings.ControlVersionNumber", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.EnvelopeSettings.InterchangeControlNumberLowerBound", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.EnvelopeSettings.InterchangeControlNumberUpperBound", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.EnvelopeSettings.RolloverInterchangeControlNumber", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.EnvelopeSettings.EnableDefaultGroupHeaders", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.EnvelopeSettings.GroupControlNumberLowerBound", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.EnvelopeSettings.GroupControlNumberUpperBound", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.EnvelopeSettings.RolloverGroupControlNumber", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.EnvelopeSettings.GroupHeaderAgencyCode", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.EnvelopeSettings.GroupHeaderVersion", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.EnvelopeSettings.TransactionSetControlNumberLowerBound", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.EnvelopeSettings.TransactionSetControlNumberUpperBound", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.EnvelopeSettings.RolloverTransactionSetControlNumber", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.EnvelopeSettings.OverwriteExistingTransactionSetControlNumber", Name: validation.Null, Rule: true, Chain: nil}, + }}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.AcknowledgementSettings", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.AcknowledgementSettings.NeedTechnicalAcknowledgement", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.AcknowledgementSettings.BatchTechnicalAcknowledgements", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.AcknowledgementSettings.NeedFunctionalAcknowledgement", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.AcknowledgementSettings.BatchFunctionalAcknowledgements", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.AcknowledgementSettings.NeedImplementationAcknowledgement", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.AcknowledgementSettings.BatchImplementationAcknowledgements", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.AcknowledgementSettings.NeedLoopForValidMessages", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.AcknowledgementSettings.SendSynchronousAcknowledgement", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.AcknowledgementSettings.AcknowledgementControlNumberLowerBound", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.AcknowledgementSettings.AcknowledgementControlNumberUpperBound", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.AcknowledgementSettings.RolloverAcknowledgementControlNumber", Name: validation.Null, Rule: true, Chain: nil}, + }}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.MessageFilter", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.SecuritySettings", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.SecuritySettings.AuthorizationQualifier", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.SecuritySettings.SecurityQualifier", Name: validation.Null, Rule: true, Chain: nil}, + }}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.ProcessingSettings", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.ProcessingSettings.MaskSecurityInfo", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.ProcessingSettings.ConvertImpliedDecimal", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.ProcessingSettings.PreserveInterchange", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.ProcessingSettings.SuspendInterchangeOnError", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.ProcessingSettings.CreateEmptyXMLTagsForTrailingSeparators", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.ProcessingSettings.UseDotAsDecimalSeparator", Name: validation.Null, Rule: true, Chain: nil}, + }}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.SchemaReferences", Name: validation.Null, Rule: true, Chain: nil}, + }}, + }}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.SenderBusinessIdentity", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.SenderBusinessIdentity.Qualifier", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.SenderBusinessIdentity.Value", Name: validation.Null, Rule: true, Chain: nil}, + }}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ReceiverBusinessIdentity", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ReceiverBusinessIdentity.Qualifier", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ReceiverBusinessIdentity.Value", Name: validation.Null, Rule: true, Chain: nil}, + }}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.ValidationSettings", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.ValidationSettings.ValidateCharacterSet", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.ValidationSettings.CheckDuplicateInterchangeControlNumber", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.ValidationSettings.InterchangeControlNumberValidityDays", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.ValidationSettings.CheckDuplicateGroupControlNumber", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.ValidationSettings.CheckDuplicateTransactionSetControlNumber", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.ValidationSettings.ValidateEdiTypes", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.ValidationSettings.ValidateXsdTypes", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.ValidationSettings.AllowLeadingAndTrailingSpacesAndZeroes", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.ValidationSettings.TrimLeadingAndTrailingSpacesAndZeroes", Name: validation.Null, Rule: true, Chain: nil}, + }}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.FramingSettings", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.FramingSettings.DataElementSeparator", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.FramingSettings.ComponentSeparator", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.FramingSettings.ReplaceSeparatorsInPayload", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.FramingSettings.ReplaceCharacter", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.FramingSettings.SegmentTerminator", Name: validation.Null, Rule: true, Chain: nil}, + }}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.EnvelopeSettings", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.EnvelopeSettings.ControlStandardsID", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.EnvelopeSettings.UseControlStandardsIDAsRepetitionCharacter", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.EnvelopeSettings.SenderApplicationID", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.EnvelopeSettings.ReceiverApplicationID", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.EnvelopeSettings.ControlVersionNumber", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.EnvelopeSettings.InterchangeControlNumberLowerBound", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.EnvelopeSettings.InterchangeControlNumberUpperBound", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.EnvelopeSettings.RolloverInterchangeControlNumber", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.EnvelopeSettings.EnableDefaultGroupHeaders", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.EnvelopeSettings.GroupControlNumberLowerBound", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.EnvelopeSettings.GroupControlNumberUpperBound", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.EnvelopeSettings.RolloverGroupControlNumber", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.EnvelopeSettings.GroupHeaderAgencyCode", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.EnvelopeSettings.GroupHeaderVersion", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.EnvelopeSettings.TransactionSetControlNumberLowerBound", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.EnvelopeSettings.TransactionSetControlNumberUpperBound", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.EnvelopeSettings.RolloverTransactionSetControlNumber", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.EnvelopeSettings.OverwriteExistingTransactionSetControlNumber", Name: validation.Null, Rule: true, Chain: nil}, + }}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.AcknowledgementSettings", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.AcknowledgementSettings.NeedTechnicalAcknowledgement", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.AcknowledgementSettings.BatchTechnicalAcknowledgements", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.AcknowledgementSettings.NeedFunctionalAcknowledgement", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.AcknowledgementSettings.BatchFunctionalAcknowledgements", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.AcknowledgementSettings.NeedImplementationAcknowledgement", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.AcknowledgementSettings.BatchImplementationAcknowledgements", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.AcknowledgementSettings.NeedLoopForValidMessages", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.AcknowledgementSettings.SendSynchronousAcknowledgement", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.AcknowledgementSettings.AcknowledgementControlNumberLowerBound", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.AcknowledgementSettings.AcknowledgementControlNumberUpperBound", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.AcknowledgementSettings.RolloverAcknowledgementControlNumber", Name: validation.Null, Rule: true, Chain: nil}, + }}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.MessageFilter", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.SecuritySettings", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.SecuritySettings.AuthorizationQualifier", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.SecuritySettings.SecurityQualifier", Name: validation.Null, Rule: true, Chain: nil}, + }}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.ProcessingSettings", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.ProcessingSettings.MaskSecurityInfo", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.ProcessingSettings.ConvertImpliedDecimal", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.ProcessingSettings.PreserveInterchange", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.ProcessingSettings.SuspendInterchangeOnError", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.ProcessingSettings.CreateEmptyXMLTagsForTrailingSeparators", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.ProcessingSettings.UseDotAsDecimalSeparator", Name: validation.Null, Rule: true, Chain: nil}, + }}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.SchemaReferences", Name: validation.Null, Rule: true, Chain: nil}, + }}, + }}, + }}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.SenderBusinessIdentity", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.SenderBusinessIdentity.Qualifier", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.SenderBusinessIdentity.Value", Name: validation.Null, Rule: true, Chain: nil}, + }}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.ReceiverBusinessIdentity", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.ReceiverBusinessIdentity.Qualifier", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.ReceiverBusinessIdentity.Value", Name: validation.Null, Rule: true, Chain: nil}, + }}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.ProtocolSettings", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.ProtocolSettings.ValidationSettings", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.ProtocolSettings.ValidationSettings.ValidateCharacterSet", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.ProtocolSettings.ValidationSettings.CheckDuplicateInterchangeControlNumber", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.ProtocolSettings.ValidationSettings.InterchangeControlNumberValidityDays", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.ProtocolSettings.ValidationSettings.CheckDuplicateGroupControlNumber", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.ProtocolSettings.ValidationSettings.CheckDuplicateTransactionSetControlNumber", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.ProtocolSettings.ValidationSettings.ValidateEdiTypes", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.ProtocolSettings.ValidationSettings.ValidateXsdTypes", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.ProtocolSettings.ValidationSettings.AllowLeadingAndTrailingSpacesAndZeroes", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.ProtocolSettings.ValidationSettings.TrimLeadingAndTrailingSpacesAndZeroes", Name: validation.Null, Rule: true, Chain: nil}, + }}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.ProtocolSettings.FramingSettings", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.ProtocolSettings.FramingSettings.ProtocolVersion", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.ProtocolSettings.FramingSettings.DataElementSeparator", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.ProtocolSettings.FramingSettings.ComponentSeparator", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.ProtocolSettings.FramingSettings.SegmentTerminator", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.ProtocolSettings.FramingSettings.ReleaseIndicator", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.ProtocolSettings.FramingSettings.RepetitionSeparator", Name: validation.Null, Rule: true, Chain: nil}, + }}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.ProtocolSettings.EnvelopeSettings", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.ProtocolSettings.EnvelopeSettings.ApplyDelimiterStringAdvice", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.ProtocolSettings.EnvelopeSettings.CreateGroupingSegments", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.ProtocolSettings.EnvelopeSettings.EnableDefaultGroupHeaders", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.ProtocolSettings.EnvelopeSettings.InterchangeControlNumberLowerBound", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.ProtocolSettings.EnvelopeSettings.InterchangeControlNumberUpperBound", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.ProtocolSettings.EnvelopeSettings.RolloverInterchangeControlNumber", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.ProtocolSettings.EnvelopeSettings.GroupControlNumberLowerBound", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.ProtocolSettings.EnvelopeSettings.GroupControlNumberUpperBound", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.ProtocolSettings.EnvelopeSettings.RolloverGroupControlNumber", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.ProtocolSettings.EnvelopeSettings.OverwriteExistingTransactionSetControlNumber", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.ProtocolSettings.EnvelopeSettings.TransactionSetControlNumberLowerBound", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.ProtocolSettings.EnvelopeSettings.TransactionSetControlNumberUpperBound", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.ProtocolSettings.EnvelopeSettings.RolloverTransactionSetControlNumber", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.ProtocolSettings.EnvelopeSettings.IsTestInterchange", Name: validation.Null, Rule: true, Chain: nil}, + }}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.ProtocolSettings.AcknowledgementSettings", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.ProtocolSettings.AcknowledgementSettings.NeedTechnicalAcknowledgement", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.ProtocolSettings.AcknowledgementSettings.BatchTechnicalAcknowledgements", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.ProtocolSettings.AcknowledgementSettings.NeedFunctionalAcknowledgement", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.ProtocolSettings.AcknowledgementSettings.BatchFunctionalAcknowledgements", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.ProtocolSettings.AcknowledgementSettings.NeedLoopForValidMessages", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.ProtocolSettings.AcknowledgementSettings.SendSynchronousAcknowledgement", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.ProtocolSettings.AcknowledgementSettings.AcknowledgementControlNumberLowerBound", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.ProtocolSettings.AcknowledgementSettings.AcknowledgementControlNumberUpperBound", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.ProtocolSettings.AcknowledgementSettings.RolloverAcknowledgementControlNumber", Name: validation.Null, Rule: true, Chain: nil}, + }}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.ProtocolSettings.MessageFilter", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.ProtocolSettings.ProcessingSettings", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.ProtocolSettings.ProcessingSettings.MaskSecurityInfo", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.ProtocolSettings.ProcessingSettings.PreserveInterchange", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.ProtocolSettings.ProcessingSettings.SuspendInterchangeOnError", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.ProtocolSettings.ProcessingSettings.CreateEmptyXMLTagsForTrailingSeparators", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.ProtocolSettings.ProcessingSettings.UseDotAsDecimalSeparator", Name: validation.Null, Rule: true, Chain: nil}, + }}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.ProtocolSettings.SchemaReferences", Name: validation.Null, Rule: true, Chain: nil}, + }}, + }}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.SenderBusinessIdentity", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.SenderBusinessIdentity.Qualifier", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.SenderBusinessIdentity.Value", Name: validation.Null, Rule: true, Chain: nil}, + }}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.ReceiverBusinessIdentity", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.ReceiverBusinessIdentity.Qualifier", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.ReceiverBusinessIdentity.Value", Name: validation.Null, Rule: true, Chain: nil}, + }}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.ProtocolSettings", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.ProtocolSettings.ValidationSettings", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.ProtocolSettings.ValidationSettings.ValidateCharacterSet", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.ProtocolSettings.ValidationSettings.CheckDuplicateInterchangeControlNumber", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.ProtocolSettings.ValidationSettings.InterchangeControlNumberValidityDays", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.ProtocolSettings.ValidationSettings.CheckDuplicateGroupControlNumber", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.ProtocolSettings.ValidationSettings.CheckDuplicateTransactionSetControlNumber", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.ProtocolSettings.ValidationSettings.ValidateEdiTypes", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.ProtocolSettings.ValidationSettings.ValidateXsdTypes", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.ProtocolSettings.ValidationSettings.AllowLeadingAndTrailingSpacesAndZeroes", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.ProtocolSettings.ValidationSettings.TrimLeadingAndTrailingSpacesAndZeroes", Name: validation.Null, Rule: true, Chain: nil}, + }}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.ProtocolSettings.FramingSettings", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.ProtocolSettings.FramingSettings.ProtocolVersion", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.ProtocolSettings.FramingSettings.DataElementSeparator", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.ProtocolSettings.FramingSettings.ComponentSeparator", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.ProtocolSettings.FramingSettings.SegmentTerminator", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.ProtocolSettings.FramingSettings.ReleaseIndicator", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.ProtocolSettings.FramingSettings.RepetitionSeparator", Name: validation.Null, Rule: true, Chain: nil}, + }}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.ProtocolSettings.EnvelopeSettings", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.ProtocolSettings.EnvelopeSettings.ApplyDelimiterStringAdvice", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.ProtocolSettings.EnvelopeSettings.CreateGroupingSegments", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.ProtocolSettings.EnvelopeSettings.EnableDefaultGroupHeaders", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.ProtocolSettings.EnvelopeSettings.InterchangeControlNumberLowerBound", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.ProtocolSettings.EnvelopeSettings.InterchangeControlNumberUpperBound", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.ProtocolSettings.EnvelopeSettings.RolloverInterchangeControlNumber", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.ProtocolSettings.EnvelopeSettings.GroupControlNumberLowerBound", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.ProtocolSettings.EnvelopeSettings.GroupControlNumberUpperBound", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.ProtocolSettings.EnvelopeSettings.RolloverGroupControlNumber", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.ProtocolSettings.EnvelopeSettings.OverwriteExistingTransactionSetControlNumber", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.ProtocolSettings.EnvelopeSettings.TransactionSetControlNumberLowerBound", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.ProtocolSettings.EnvelopeSettings.TransactionSetControlNumberUpperBound", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.ProtocolSettings.EnvelopeSettings.RolloverTransactionSetControlNumber", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.ProtocolSettings.EnvelopeSettings.IsTestInterchange", Name: validation.Null, Rule: true, Chain: nil}, + }}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.ProtocolSettings.AcknowledgementSettings", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.ProtocolSettings.AcknowledgementSettings.NeedTechnicalAcknowledgement", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.ProtocolSettings.AcknowledgementSettings.BatchTechnicalAcknowledgements", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.ProtocolSettings.AcknowledgementSettings.NeedFunctionalAcknowledgement", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.ProtocolSettings.AcknowledgementSettings.BatchFunctionalAcknowledgements", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.ProtocolSettings.AcknowledgementSettings.NeedLoopForValidMessages", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.ProtocolSettings.AcknowledgementSettings.SendSynchronousAcknowledgement", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.ProtocolSettings.AcknowledgementSettings.AcknowledgementControlNumberLowerBound", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.ProtocolSettings.AcknowledgementSettings.AcknowledgementControlNumberUpperBound", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.ProtocolSettings.AcknowledgementSettings.RolloverAcknowledgementControlNumber", Name: validation.Null, Rule: true, Chain: nil}, + }}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.ProtocolSettings.MessageFilter", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.ProtocolSettings.ProcessingSettings", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.ProtocolSettings.ProcessingSettings.MaskSecurityInfo", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.ProtocolSettings.ProcessingSettings.PreserveInterchange", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.ProtocolSettings.ProcessingSettings.SuspendInterchangeOnError", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.ProtocolSettings.ProcessingSettings.CreateEmptyXMLTagsForTrailingSeparators", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.ProtocolSettings.ProcessingSettings.UseDotAsDecimalSeparator", Name: validation.Null, Rule: true, Chain: nil}, + }}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.ProtocolSettings.SchemaReferences", Name: validation.Null, Rule: true, Chain: nil}, + }}, + }}, + }}, + }}, + }}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "logic.AgreementsClient", "CreateOrUpdate") + } + + req, err := client.CreateOrUpdatePreparer(resourceGroupName, integrationAccountName, agreementName, agreement) + if err != nil { + return result, autorest.NewErrorWithError(err, "logic.AgreementsClient", "CreateOrUpdate", nil, "Failure preparing request") + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "logic.AgreementsClient", "CreateOrUpdate", resp, "Failure sending request") + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "logic.AgreementsClient", "CreateOrUpdate", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client AgreementsClient) CreateOrUpdatePreparer(resourceGroupName string, integrationAccountName string, agreementName string, agreement IntegrationAccountAgreement) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "agreementName": autorest.Encode("path", agreementName), + "integrationAccountName": autorest.Encode("path", integrationAccountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/integrationAccounts/{integrationAccountName}/agreements/{agreementName}", pathParameters), + autorest.WithJSON(agreement), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client AgreementsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client AgreementsClient) CreateOrUpdateResponder(resp *http.Response) (result IntegrationAccountAgreement, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes an integration account agreement. +// +// resourceGroupName is the resource group name. integrationAccountName is the +// integration account name. agreementName is the integration account agreement +// name. +func (client AgreementsClient) Delete(resourceGroupName string, integrationAccountName string, agreementName string) (result autorest.Response, err error) { + req, err := client.DeletePreparer(resourceGroupName, integrationAccountName, agreementName) + if err != nil { + return result, autorest.NewErrorWithError(err, "logic.AgreementsClient", "Delete", nil, "Failure preparing request") + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + return result, autorest.NewErrorWithError(err, "logic.AgreementsClient", "Delete", resp, "Failure sending request") + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "logic.AgreementsClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client AgreementsClient) DeletePreparer(resourceGroupName string, integrationAccountName string, agreementName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "agreementName": autorest.Encode("path", agreementName), + "integrationAccountName": autorest.Encode("path", integrationAccountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-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.Logic/integrationAccounts/{integrationAccountName}/agreements/{agreementName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client AgreementsClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client AgreementsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets an integration account agreement. +// +// resourceGroupName is the resource group name. integrationAccountName is the +// integration account name. agreementName is the integration account agreement +// name. +func (client AgreementsClient) Get(resourceGroupName string, integrationAccountName string, agreementName string) (result IntegrationAccountAgreement, err error) { + req, err := client.GetPreparer(resourceGroupName, integrationAccountName, agreementName) + if err != nil { + return result, autorest.NewErrorWithError(err, "logic.AgreementsClient", "Get", nil, "Failure preparing request") + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "logic.AgreementsClient", "Get", resp, "Failure sending request") + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "logic.AgreementsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client AgreementsClient) GetPreparer(resourceGroupName string, integrationAccountName string, agreementName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "agreementName": autorest.Encode("path", agreementName), + "integrationAccountName": autorest.Encode("path", integrationAccountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-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.Logic/integrationAccounts/{integrationAccountName}/agreements/{agreementName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client AgreementsClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client AgreementsClient) GetResponder(resp *http.Response) (result IntegrationAccountAgreement, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByIntegrationAccounts gets a list of integration account agreements. +// +// resourceGroupName is the resource group name. integrationAccountName is the +// integration account name. top is the number of items to be included in the +// result. filter is the filter to apply on the operation. +func (client AgreementsClient) ListByIntegrationAccounts(resourceGroupName string, integrationAccountName string, top *int32, filter string) (result IntegrationAccountAgreementListResult, err error) { + req, err := client.ListByIntegrationAccountsPreparer(resourceGroupName, integrationAccountName, top, filter) + if err != nil { + return result, autorest.NewErrorWithError(err, "logic.AgreementsClient", "ListByIntegrationAccounts", nil, "Failure preparing request") + } + + resp, err := client.ListByIntegrationAccountsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "logic.AgreementsClient", "ListByIntegrationAccounts", resp, "Failure sending request") + } + + result, err = client.ListByIntegrationAccountsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "logic.AgreementsClient", "ListByIntegrationAccounts", resp, "Failure responding to request") + } + + return +} + +// ListByIntegrationAccountsPreparer prepares the ListByIntegrationAccounts request. +func (client AgreementsClient) ListByIntegrationAccountsPreparer(resourceGroupName string, integrationAccountName string, top *int32, filter string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "integrationAccountName": autorest.Encode("path", integrationAccountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + 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.Logic/integrationAccounts/{integrationAccountName}/agreements", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListByIntegrationAccountsSender sends the ListByIntegrationAccounts request. The method will close the +// http.Response Body if it receives an error. +func (client AgreementsClient) ListByIntegrationAccountsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListByIntegrationAccountsResponder handles the response to the ListByIntegrationAccounts request. The method always +// closes the http.Response Body. +func (client AgreementsClient) ListByIntegrationAccountsResponder(resp *http.Response) (result IntegrationAccountAgreementListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByIntegrationAccountsNextResults retrieves the next set of results, if any. +func (client AgreementsClient) ListByIntegrationAccountsNextResults(lastResults IntegrationAccountAgreementListResult) (result IntegrationAccountAgreementListResult, err error) { + req, err := lastResults.IntegrationAccountAgreementListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "logic.AgreementsClient", "ListByIntegrationAccounts", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListByIntegrationAccountsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "logic.AgreementsClient", "ListByIntegrationAccounts", resp, "Failure sending next results request") + } + + result, err = client.ListByIntegrationAccountsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "logic.AgreementsClient", "ListByIntegrationAccounts", resp, "Failure responding to next results request") + } + + return +} diff --git a/arm/logic/certificates.go b/arm/logic/certificates.go new file mode 100755 index 000000000000..9acaeb7173dd --- /dev/null +++ b/arm/logic/certificates.go @@ -0,0 +1,344 @@ +package logic + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// 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/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// CertificatesClient is the rEST API for Azure Logic Apps. +type CertificatesClient struct { + ManagementClient +} + +// NewCertificatesClient creates an instance of the CertificatesClient client. +func NewCertificatesClient(subscriptionID string) CertificatesClient { + return NewCertificatesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewCertificatesClientWithBaseURI creates an instance of the +// CertificatesClient client. +func NewCertificatesClientWithBaseURI(baseURI string, subscriptionID string) CertificatesClient { + return CertificatesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates or updates an integration account certificate. +// +// resourceGroupName is the resource group name. integrationAccountName is the +// integration account name. certificateName is the integration account +// certificate name. certificate is the integration account certificate. +func (client CertificatesClient) CreateOrUpdate(resourceGroupName string, integrationAccountName string, certificateName string, certificate IntegrationAccountCertificate) (result IntegrationAccountCertificate, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: certificate, + Constraints: []validation.Constraint{{Target: "certificate.IntegrationAccountCertificateProperties", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "certificate.IntegrationAccountCertificateProperties.Key", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "certificate.IntegrationAccountCertificateProperties.Key.KeyVault", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "certificate.IntegrationAccountCertificateProperties.Key.KeyName", Name: validation.Null, Rule: true, Chain: nil}, + }}, + }}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "logic.CertificatesClient", "CreateOrUpdate") + } + + req, err := client.CreateOrUpdatePreparer(resourceGroupName, integrationAccountName, certificateName, certificate) + if err != nil { + return result, autorest.NewErrorWithError(err, "logic.CertificatesClient", "CreateOrUpdate", nil, "Failure preparing request") + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "logic.CertificatesClient", "CreateOrUpdate", resp, "Failure sending request") + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "logic.CertificatesClient", "CreateOrUpdate", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client CertificatesClient) CreateOrUpdatePreparer(resourceGroupName string, integrationAccountName string, certificateName string, certificate IntegrationAccountCertificate) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "certificateName": autorest.Encode("path", certificateName), + "integrationAccountName": autorest.Encode("path", integrationAccountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/integrationAccounts/{integrationAccountName}/certificates/{certificateName}", pathParameters), + autorest.WithJSON(certificate), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client CertificatesClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client CertificatesClient) CreateOrUpdateResponder(resp *http.Response) (result IntegrationAccountCertificate, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes an integration account certificate. +// +// resourceGroupName is the resource group name. integrationAccountName is the +// integration account name. certificateName is the integration account +// certificate name. +func (client CertificatesClient) Delete(resourceGroupName string, integrationAccountName string, certificateName string) (result autorest.Response, err error) { + req, err := client.DeletePreparer(resourceGroupName, integrationAccountName, certificateName) + if err != nil { + return result, autorest.NewErrorWithError(err, "logic.CertificatesClient", "Delete", nil, "Failure preparing request") + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + return result, autorest.NewErrorWithError(err, "logic.CertificatesClient", "Delete", resp, "Failure sending request") + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "logic.CertificatesClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client CertificatesClient) DeletePreparer(resourceGroupName string, integrationAccountName string, certificateName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "certificateName": autorest.Encode("path", certificateName), + "integrationAccountName": autorest.Encode("path", integrationAccountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-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.Logic/integrationAccounts/{integrationAccountName}/certificates/{certificateName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client CertificatesClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client CertificatesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets an integration account certificate. +// +// resourceGroupName is the resource group name. integrationAccountName is the +// integration account name. certificateName is the integration account +// certificate name. +func (client CertificatesClient) Get(resourceGroupName string, integrationAccountName string, certificateName string) (result IntegrationAccountCertificate, err error) { + req, err := client.GetPreparer(resourceGroupName, integrationAccountName, certificateName) + if err != nil { + return result, autorest.NewErrorWithError(err, "logic.CertificatesClient", "Get", nil, "Failure preparing request") + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "logic.CertificatesClient", "Get", resp, "Failure sending request") + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "logic.CertificatesClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client CertificatesClient) GetPreparer(resourceGroupName string, integrationAccountName string, certificateName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "certificateName": autorest.Encode("path", certificateName), + "integrationAccountName": autorest.Encode("path", integrationAccountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-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.Logic/integrationAccounts/{integrationAccountName}/certificates/{certificateName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client CertificatesClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client CertificatesClient) GetResponder(resp *http.Response) (result IntegrationAccountCertificate, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByIntegrationAccounts gets a list of integration account certificates. +// +// resourceGroupName is the resource group name. integrationAccountName is the +// integration account name. top is the number of items to be included in the +// result. +func (client CertificatesClient) ListByIntegrationAccounts(resourceGroupName string, integrationAccountName string, top *int32) (result IntegrationAccountCertificateListResult, err error) { + req, err := client.ListByIntegrationAccountsPreparer(resourceGroupName, integrationAccountName, top) + if err != nil { + return result, autorest.NewErrorWithError(err, "logic.CertificatesClient", "ListByIntegrationAccounts", nil, "Failure preparing request") + } + + resp, err := client.ListByIntegrationAccountsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "logic.CertificatesClient", "ListByIntegrationAccounts", resp, "Failure sending request") + } + + result, err = client.ListByIntegrationAccountsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "logic.CertificatesClient", "ListByIntegrationAccounts", resp, "Failure responding to request") + } + + return +} + +// ListByIntegrationAccountsPreparer prepares the ListByIntegrationAccounts request. +func (client CertificatesClient) ListByIntegrationAccountsPreparer(resourceGroupName string, integrationAccountName string, top *int32) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "integrationAccountName": autorest.Encode("path", integrationAccountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + 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.Logic/integrationAccounts/{integrationAccountName}/certificates", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListByIntegrationAccountsSender sends the ListByIntegrationAccounts request. The method will close the +// http.Response Body if it receives an error. +func (client CertificatesClient) ListByIntegrationAccountsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListByIntegrationAccountsResponder handles the response to the ListByIntegrationAccounts request. The method always +// closes the http.Response Body. +func (client CertificatesClient) ListByIntegrationAccountsResponder(resp *http.Response) (result IntegrationAccountCertificateListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByIntegrationAccountsNextResults retrieves the next set of results, if any. +func (client CertificatesClient) ListByIntegrationAccountsNextResults(lastResults IntegrationAccountCertificateListResult) (result IntegrationAccountCertificateListResult, err error) { + req, err := lastResults.IntegrationAccountCertificateListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "logic.CertificatesClient", "ListByIntegrationAccounts", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListByIntegrationAccountsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "logic.CertificatesClient", "ListByIntegrationAccounts", resp, "Failure sending next results request") + } + + result, err = client.ListByIntegrationAccountsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "logic.CertificatesClient", "ListByIntegrationAccounts", resp, "Failure responding to next results request") + } + + return +} diff --git a/arm/logic/client.go b/arm/logic/client.go old mode 100644 new mode 100755 index e7f66131bec7..0238088fdbd4 --- a/arm/logic/client.go +++ b/arm/logic/client.go @@ -17,18 +17,17 @@ package logic // See the License for the specific language governing permissions and // limitations under the License. // -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.0 +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 // 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/azure" + "net/http" ) const ( - // APIVersion is the version of the Logic - APIVersion = "2016-06-01" - // DefaultBaseURI is the default URI used for the service Logic DefaultBaseURI = "https://management.azure.com" ) @@ -37,7 +36,6 @@ const ( type ManagementClient struct { autorest.Client BaseURI string - APIVersion string SubscriptionID string } @@ -51,7 +49,85 @@ func NewWithBaseURI(baseURI string, subscriptionID string) ManagementClient { return ManagementClient{ Client: autorest.NewClientWithUserAgent(UserAgent()), BaseURI: baseURI, - APIVersion: APIVersion, SubscriptionID: subscriptionID, } } + +// ListOperations lists all of the available Logic REST API operations. +func (client ManagementClient) ListOperations() (result OperationListResult, err error) { + req, err := client.ListOperationsPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "logic.ManagementClient", "ListOperations", nil, "Failure preparing request") + } + + resp, err := client.ListOperationsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "logic.ManagementClient", "ListOperations", resp, "Failure sending request") + } + + result, err = client.ListOperationsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "logic.ManagementClient", "ListOperations", resp, "Failure responding to request") + } + + return +} + +// ListOperationsPreparer prepares the ListOperations request. +func (client ManagementClient) ListOperationsPreparer() (*http.Request, error) { + const APIVersion = "2016-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPath("/providers/Microsoft.Logic/operations"), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListOperationsSender sends the ListOperations request. The method will close the +// http.Response Body if it receives an error. +func (client ManagementClient) ListOperationsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListOperationsResponder handles the response to the ListOperations request. The method always +// closes the http.Response Body. +func (client ManagementClient) ListOperationsResponder(resp *http.Response) (result OperationListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListOperationsNextResults retrieves the next set of results, if any. +func (client ManagementClient) ListOperationsNextResults(lastResults OperationListResult) (result OperationListResult, err error) { + req, err := lastResults.OperationListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "logic.ManagementClient", "ListOperations", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListOperationsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "logic.ManagementClient", "ListOperations", resp, "Failure sending next results request") + } + + result, err = client.ListOperationsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "logic.ManagementClient", "ListOperations", resp, "Failure responding to next results request") + } + + return +} diff --git a/arm/logic/integrationaccounts.go b/arm/logic/integrationaccounts.go new file mode 100755 index 000000000000..723744cbf75b --- /dev/null +++ b/arm/logic/integrationaccounts.go @@ -0,0 +1,545 @@ +package logic + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// 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/azure" + "net/http" +) + +// IntegrationAccountsClient is the rEST API for Azure Logic Apps. +type IntegrationAccountsClient struct { + ManagementClient +} + +// NewIntegrationAccountsClient creates an instance of the +// IntegrationAccountsClient client. +func NewIntegrationAccountsClient(subscriptionID string) IntegrationAccountsClient { + return NewIntegrationAccountsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewIntegrationAccountsClientWithBaseURI creates an instance of the +// IntegrationAccountsClient client. +func NewIntegrationAccountsClientWithBaseURI(baseURI string, subscriptionID string) IntegrationAccountsClient { + return IntegrationAccountsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates or updates an integration account. +// +// resourceGroupName is the resource group name. integrationAccountName is the +// integration account name. integrationAccount is the integration account. +func (client IntegrationAccountsClient) CreateOrUpdate(resourceGroupName string, integrationAccountName string, integrationAccount IntegrationAccount) (result IntegrationAccount, err error) { + req, err := client.CreateOrUpdatePreparer(resourceGroupName, integrationAccountName, integrationAccount) + if err != nil { + return result, autorest.NewErrorWithError(err, "logic.IntegrationAccountsClient", "CreateOrUpdate", nil, "Failure preparing request") + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "logic.IntegrationAccountsClient", "CreateOrUpdate", resp, "Failure sending request") + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "logic.IntegrationAccountsClient", "CreateOrUpdate", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client IntegrationAccountsClient) CreateOrUpdatePreparer(resourceGroupName string, integrationAccountName string, integrationAccount IntegrationAccount) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "integrationAccountName": autorest.Encode("path", integrationAccountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/integrationAccounts/{integrationAccountName}", pathParameters), + autorest.WithJSON(integrationAccount), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client IntegrationAccountsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client IntegrationAccountsClient) CreateOrUpdateResponder(resp *http.Response) (result IntegrationAccount, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes an integration account. +// +// resourceGroupName is the resource group name. integrationAccountName is the +// integration account name. +func (client IntegrationAccountsClient) Delete(resourceGroupName string, integrationAccountName string) (result autorest.Response, err error) { + req, err := client.DeletePreparer(resourceGroupName, integrationAccountName) + if err != nil { + return result, autorest.NewErrorWithError(err, "logic.IntegrationAccountsClient", "Delete", nil, "Failure preparing request") + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + return result, autorest.NewErrorWithError(err, "logic.IntegrationAccountsClient", "Delete", resp, "Failure sending request") + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "logic.IntegrationAccountsClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client IntegrationAccountsClient) DeletePreparer(resourceGroupName string, integrationAccountName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "integrationAccountName": autorest.Encode("path", integrationAccountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-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.Logic/integrationAccounts/{integrationAccountName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client IntegrationAccountsClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client IntegrationAccountsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets an integration account. +// +// resourceGroupName is the resource group name. integrationAccountName is the +// integration account name. +func (client IntegrationAccountsClient) Get(resourceGroupName string, integrationAccountName string) (result IntegrationAccount, err error) { + req, err := client.GetPreparer(resourceGroupName, integrationAccountName) + if err != nil { + return result, autorest.NewErrorWithError(err, "logic.IntegrationAccountsClient", "Get", nil, "Failure preparing request") + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "logic.IntegrationAccountsClient", "Get", resp, "Failure sending request") + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "logic.IntegrationAccountsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client IntegrationAccountsClient) GetPreparer(resourceGroupName string, integrationAccountName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "integrationAccountName": autorest.Encode("path", integrationAccountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-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.Logic/integrationAccounts/{integrationAccountName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client IntegrationAccountsClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client IntegrationAccountsClient) GetResponder(resp *http.Response) (result IntegrationAccount, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetCallbackURL gets the integration account callback URL. +// +// resourceGroupName is the resource group name. integrationAccountName is the +// integration account name. parameters is the callback URL parameters. +func (client IntegrationAccountsClient) GetCallbackURL(resourceGroupName string, integrationAccountName string, parameters GetCallbackURLParameters) (result CallbackURL, err error) { + req, err := client.GetCallbackURLPreparer(resourceGroupName, integrationAccountName, parameters) + if err != nil { + return result, autorest.NewErrorWithError(err, "logic.IntegrationAccountsClient", "GetCallbackURL", nil, "Failure preparing request") + } + + resp, err := client.GetCallbackURLSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "logic.IntegrationAccountsClient", "GetCallbackURL", resp, "Failure sending request") + } + + result, err = client.GetCallbackURLResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "logic.IntegrationAccountsClient", "GetCallbackURL", resp, "Failure responding to request") + } + + return +} + +// GetCallbackURLPreparer prepares the GetCallbackURL request. +func (client IntegrationAccountsClient) GetCallbackURLPreparer(resourceGroupName string, integrationAccountName string, parameters GetCallbackURLParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "integrationAccountName": autorest.Encode("path", integrationAccountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/integrationAccounts/{integrationAccountName}/listCallbackUrl", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetCallbackURLSender sends the GetCallbackURL request. The method will close the +// http.Response Body if it receives an error. +func (client IntegrationAccountsClient) GetCallbackURLSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetCallbackURLResponder handles the response to the GetCallbackURL request. The method always +// closes the http.Response Body. +func (client IntegrationAccountsClient) GetCallbackURLResponder(resp *http.Response) (result CallbackURL, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByResourceGroup gets a list of integration accounts by resource group. +// +// resourceGroupName is the resource group name. top is the number of items to +// be included in the result. +func (client IntegrationAccountsClient) ListByResourceGroup(resourceGroupName string, top *int32) (result IntegrationAccountListResult, err error) { + req, err := client.ListByResourceGroupPreparer(resourceGroupName, top) + if err != nil { + return result, autorest.NewErrorWithError(err, "logic.IntegrationAccountsClient", "ListByResourceGroup", nil, "Failure preparing request") + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "logic.IntegrationAccountsClient", "ListByResourceGroup", resp, "Failure sending request") + } + + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "logic.IntegrationAccountsClient", "ListByResourceGroup", resp, "Failure responding to request") + } + + return +} + +// ListByResourceGroupPreparer prepares the ListByResourceGroup request. +func (client IntegrationAccountsClient) ListByResourceGroupPreparer(resourceGroupName string, top *int32) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + 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.Logic/integrationAccounts", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the +// http.Response Body if it receives an error. +func (client IntegrationAccountsClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (client IntegrationAccountsClient) ListByResourceGroupResponder(resp *http.Response) (result IntegrationAccountListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + 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 IntegrationAccountsClient) ListByResourceGroupNextResults(lastResults IntegrationAccountListResult) (result IntegrationAccountListResult, err error) { + req, err := lastResults.IntegrationAccountListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "logic.IntegrationAccountsClient", "ListByResourceGroup", 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, "logic.IntegrationAccountsClient", "ListByResourceGroup", resp, "Failure sending next results request") + } + + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "logic.IntegrationAccountsClient", "ListByResourceGroup", resp, "Failure responding to next results request") + } + + return +} + +// ListBySubscription gets a list of integration accounts by subscription. +// +// top is the number of items to be included in the result. +func (client IntegrationAccountsClient) ListBySubscription(top *int32) (result IntegrationAccountListResult, err error) { + req, err := client.ListBySubscriptionPreparer(top) + if err != nil { + return result, autorest.NewErrorWithError(err, "logic.IntegrationAccountsClient", "ListBySubscription", nil, "Failure preparing request") + } + + resp, err := client.ListBySubscriptionSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "logic.IntegrationAccountsClient", "ListBySubscription", resp, "Failure sending request") + } + + result, err = client.ListBySubscriptionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "logic.IntegrationAccountsClient", "ListBySubscription", resp, "Failure responding to request") + } + + return +} + +// ListBySubscriptionPreparer prepares the ListBySubscription request. +func (client IntegrationAccountsClient) ListBySubscriptionPreparer(top *int32) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Logic/integrationAccounts", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListBySubscriptionSender sends the ListBySubscription request. The method will close the +// http.Response Body if it receives an error. +func (client IntegrationAccountsClient) ListBySubscriptionSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListBySubscriptionResponder handles the response to the ListBySubscription request. The method always +// closes the http.Response Body. +func (client IntegrationAccountsClient) ListBySubscriptionResponder(resp *http.Response) (result IntegrationAccountListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + 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 IntegrationAccountsClient) ListBySubscriptionNextResults(lastResults IntegrationAccountListResult) (result IntegrationAccountListResult, err error) { + req, err := lastResults.IntegrationAccountListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "logic.IntegrationAccountsClient", "ListBySubscription", 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, "logic.IntegrationAccountsClient", "ListBySubscription", resp, "Failure sending next results request") + } + + result, err = client.ListBySubscriptionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "logic.IntegrationAccountsClient", "ListBySubscription", resp, "Failure responding to next results request") + } + + return +} + +// Update updates an integration account. +// +// resourceGroupName is the resource group name. integrationAccountName is the +// integration account name. integrationAccount is the integration account. +func (client IntegrationAccountsClient) Update(resourceGroupName string, integrationAccountName string, integrationAccount IntegrationAccount) (result IntegrationAccount, err error) { + req, err := client.UpdatePreparer(resourceGroupName, integrationAccountName, integrationAccount) + if err != nil { + return result, autorest.NewErrorWithError(err, "logic.IntegrationAccountsClient", "Update", nil, "Failure preparing request") + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "logic.IntegrationAccountsClient", "Update", resp, "Failure sending request") + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "logic.IntegrationAccountsClient", "Update", resp, "Failure responding to request") + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client IntegrationAccountsClient) UpdatePreparer(resourceGroupName string, integrationAccountName string, integrationAccount IntegrationAccount) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "integrationAccountName": autorest.Encode("path", integrationAccountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/integrationAccounts/{integrationAccountName}", pathParameters), + autorest.WithJSON(integrationAccount), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client IntegrationAccountsClient) UpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client IntegrationAccountsClient) UpdateResponder(resp *http.Response) (result IntegrationAccount, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/arm/logic/maps.go b/arm/logic/maps.go new file mode 100755 index 000000000000..14b8cd094707 --- /dev/null +++ b/arm/logic/maps.go @@ -0,0 +1,339 @@ +package logic + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// 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/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// MapsClient is the rEST API for Azure Logic Apps. +type MapsClient struct { + ManagementClient +} + +// NewMapsClient creates an instance of the MapsClient client. +func NewMapsClient(subscriptionID string) MapsClient { + return NewMapsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewMapsClientWithBaseURI creates an instance of the MapsClient client. +func NewMapsClientWithBaseURI(baseURI string, subscriptionID string) MapsClient { + return MapsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates or updates an integration account map. +// +// resourceGroupName is the resource group name. integrationAccountName is the +// integration account name. mapName is the integration account map name. +// mapParameter is the integration account map. +func (client MapsClient) CreateOrUpdate(resourceGroupName string, integrationAccountName string, mapName string, mapParameter IntegrationAccountMap) (result IntegrationAccountMap, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: mapParameter, + Constraints: []validation.Constraint{{Target: "mapParameter.IntegrationAccountMapProperties", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "logic.MapsClient", "CreateOrUpdate") + } + + req, err := client.CreateOrUpdatePreparer(resourceGroupName, integrationAccountName, mapName, mapParameter) + if err != nil { + return result, autorest.NewErrorWithError(err, "logic.MapsClient", "CreateOrUpdate", nil, "Failure preparing request") + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "logic.MapsClient", "CreateOrUpdate", resp, "Failure sending request") + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "logic.MapsClient", "CreateOrUpdate", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client MapsClient) CreateOrUpdatePreparer(resourceGroupName string, integrationAccountName string, mapName string, mapParameter IntegrationAccountMap) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "integrationAccountName": autorest.Encode("path", integrationAccountName), + "mapName": autorest.Encode("path", mapName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/integrationAccounts/{integrationAccountName}/maps/{mapName}", pathParameters), + autorest.WithJSON(mapParameter), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client MapsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client MapsClient) CreateOrUpdateResponder(resp *http.Response) (result IntegrationAccountMap, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes an integration account map. +// +// resourceGroupName is the resource group name. integrationAccountName is the +// integration account name. mapName is the integration account map name. +func (client MapsClient) Delete(resourceGroupName string, integrationAccountName string, mapName string) (result autorest.Response, err error) { + req, err := client.DeletePreparer(resourceGroupName, integrationAccountName, mapName) + if err != nil { + return result, autorest.NewErrorWithError(err, "logic.MapsClient", "Delete", nil, "Failure preparing request") + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + return result, autorest.NewErrorWithError(err, "logic.MapsClient", "Delete", resp, "Failure sending request") + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "logic.MapsClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client MapsClient) DeletePreparer(resourceGroupName string, integrationAccountName string, mapName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "integrationAccountName": autorest.Encode("path", integrationAccountName), + "mapName": autorest.Encode("path", mapName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-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.Logic/integrationAccounts/{integrationAccountName}/maps/{mapName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client MapsClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client MapsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets an integration account map. +// +// resourceGroupName is the resource group name. integrationAccountName is the +// integration account name. mapName is the integration account map name. +func (client MapsClient) Get(resourceGroupName string, integrationAccountName string, mapName string) (result IntegrationAccountMap, err error) { + req, err := client.GetPreparer(resourceGroupName, integrationAccountName, mapName) + if err != nil { + return result, autorest.NewErrorWithError(err, "logic.MapsClient", "Get", nil, "Failure preparing request") + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "logic.MapsClient", "Get", resp, "Failure sending request") + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "logic.MapsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client MapsClient) GetPreparer(resourceGroupName string, integrationAccountName string, mapName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "integrationAccountName": autorest.Encode("path", integrationAccountName), + "mapName": autorest.Encode("path", mapName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-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.Logic/integrationAccounts/{integrationAccountName}/maps/{mapName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client MapsClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client MapsClient) GetResponder(resp *http.Response) (result IntegrationAccountMap, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByIntegrationAccounts gets a list of integration account maps. +// +// resourceGroupName is the resource group name. integrationAccountName is the +// integration account name. top is the number of items to be included in the +// result. filter is the filter to apply on the operation. +func (client MapsClient) ListByIntegrationAccounts(resourceGroupName string, integrationAccountName string, top *int32, filter string) (result IntegrationAccountMapListResult, err error) { + req, err := client.ListByIntegrationAccountsPreparer(resourceGroupName, integrationAccountName, top, filter) + if err != nil { + return result, autorest.NewErrorWithError(err, "logic.MapsClient", "ListByIntegrationAccounts", nil, "Failure preparing request") + } + + resp, err := client.ListByIntegrationAccountsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "logic.MapsClient", "ListByIntegrationAccounts", resp, "Failure sending request") + } + + result, err = client.ListByIntegrationAccountsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "logic.MapsClient", "ListByIntegrationAccounts", resp, "Failure responding to request") + } + + return +} + +// ListByIntegrationAccountsPreparer prepares the ListByIntegrationAccounts request. +func (client MapsClient) ListByIntegrationAccountsPreparer(resourceGroupName string, integrationAccountName string, top *int32, filter string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "integrationAccountName": autorest.Encode("path", integrationAccountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + 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.Logic/integrationAccounts/{integrationAccountName}/maps", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListByIntegrationAccountsSender sends the ListByIntegrationAccounts request. The method will close the +// http.Response Body if it receives an error. +func (client MapsClient) ListByIntegrationAccountsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListByIntegrationAccountsResponder handles the response to the ListByIntegrationAccounts request. The method always +// closes the http.Response Body. +func (client MapsClient) ListByIntegrationAccountsResponder(resp *http.Response) (result IntegrationAccountMapListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByIntegrationAccountsNextResults retrieves the next set of results, if any. +func (client MapsClient) ListByIntegrationAccountsNextResults(lastResults IntegrationAccountMapListResult) (result IntegrationAccountMapListResult, err error) { + req, err := lastResults.IntegrationAccountMapListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "logic.MapsClient", "ListByIntegrationAccounts", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListByIntegrationAccountsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "logic.MapsClient", "ListByIntegrationAccounts", resp, "Failure sending next results request") + } + + result, err = client.ListByIntegrationAccountsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "logic.MapsClient", "ListByIntegrationAccounts", resp, "Failure responding to next results request") + } + + return +} diff --git a/arm/logic/models.go b/arm/logic/models.go old mode 100644 new mode 100755 index d634b9db41b6..96a91346a16f --- a/arm/logic/models.go +++ b/arm/logic/models.go @@ -14,7 +14,7 @@ package logic // See the License for the specific language governing permissions and // limitations under the License. // -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.0 +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 // Changes may cause incorrect behavior and will be lost if the code is // regenerated. @@ -25,6 +25,20 @@ import ( "net/http" ) +// AgreementType enumerates the values for agreement type. +type AgreementType string + +const ( + // AS2 specifies the as2 state for agreement type. + AS2 AgreementType = "AS2" + // Edifact specifies the edifact state for agreement type. + Edifact AgreementType = "Edifact" + // NotSpecified specifies the not specified state for agreement type. + NotSpecified AgreementType = "NotSpecified" + // X12 specifies the x12 state for agreement type. + X12 AgreementType = "X12" +) + // DayOfWeek enumerates the values for day of week. type DayOfWeek string @@ -72,16 +86,179 @@ const ( DaysOfWeekWednesday DaysOfWeek = "Wednesday" ) +// EdifactCharacterSet enumerates the values for edifact character set. +type EdifactCharacterSet string + +const ( + // EdifactCharacterSetKECA specifies the edifact character set keca state + // for edifact character set. + EdifactCharacterSetKECA EdifactCharacterSet = "KECA" + // EdifactCharacterSetNotSpecified specifies the edifact character set not + // specified state for edifact character set. + EdifactCharacterSetNotSpecified EdifactCharacterSet = "NotSpecified" + // EdifactCharacterSetUNOA specifies the edifact character set unoa state + // for edifact character set. + EdifactCharacterSetUNOA EdifactCharacterSet = "UNOA" + // EdifactCharacterSetUNOB specifies the edifact character set unob state + // for edifact character set. + EdifactCharacterSetUNOB EdifactCharacterSet = "UNOB" + // EdifactCharacterSetUNOC specifies the edifact character set unoc state + // for edifact character set. + EdifactCharacterSetUNOC EdifactCharacterSet = "UNOC" + // EdifactCharacterSetUNOD specifies the edifact character set unod state + // for edifact character set. + EdifactCharacterSetUNOD EdifactCharacterSet = "UNOD" + // EdifactCharacterSetUNOE specifies the edifact character set unoe state + // for edifact character set. + EdifactCharacterSetUNOE EdifactCharacterSet = "UNOE" + // EdifactCharacterSetUNOF specifies the edifact character set unof state + // for edifact character set. + EdifactCharacterSetUNOF EdifactCharacterSet = "UNOF" + // EdifactCharacterSetUNOG specifies the edifact character set unog state + // for edifact character set. + EdifactCharacterSetUNOG EdifactCharacterSet = "UNOG" + // EdifactCharacterSetUNOH specifies the edifact character set unoh state + // for edifact character set. + EdifactCharacterSetUNOH EdifactCharacterSet = "UNOH" + // EdifactCharacterSetUNOI specifies the edifact character set unoi state + // for edifact character set. + EdifactCharacterSetUNOI EdifactCharacterSet = "UNOI" + // EdifactCharacterSetUNOJ specifies the edifact character set unoj state + // for edifact character set. + EdifactCharacterSetUNOJ EdifactCharacterSet = "UNOJ" + // EdifactCharacterSetUNOK specifies the edifact character set unok state + // for edifact character set. + EdifactCharacterSetUNOK EdifactCharacterSet = "UNOK" + // EdifactCharacterSetUNOX specifies the edifact character set unox state + // for edifact character set. + EdifactCharacterSetUNOX EdifactCharacterSet = "UNOX" + // EdifactCharacterSetUNOY specifies the edifact character set unoy state + // for edifact character set. + EdifactCharacterSetUNOY EdifactCharacterSet = "UNOY" +) + +// EdifactDecimalIndicator enumerates the values for edifact decimal indicator. +type EdifactDecimalIndicator string + +const ( + // EdifactDecimalIndicatorComma specifies the edifact decimal indicator + // comma state for edifact decimal indicator. + EdifactDecimalIndicatorComma EdifactDecimalIndicator = "Comma" + // EdifactDecimalIndicatorDecimal specifies the edifact decimal indicator + // decimal state for edifact decimal indicator. + EdifactDecimalIndicatorDecimal EdifactDecimalIndicator = "Decimal" + // EdifactDecimalIndicatorNotSpecified specifies the edifact decimal + // indicator not specified state for edifact decimal indicator. + EdifactDecimalIndicatorNotSpecified EdifactDecimalIndicator = "NotSpecified" +) + +// EncryptionAlgorithm enumerates the values for encryption algorithm. +type EncryptionAlgorithm string + +const ( + // EncryptionAlgorithmAES128 specifies the encryption algorithm aes128 + // state for encryption algorithm. + EncryptionAlgorithmAES128 EncryptionAlgorithm = "AES128" + // EncryptionAlgorithmAES192 specifies the encryption algorithm aes192 + // state for encryption algorithm. + EncryptionAlgorithmAES192 EncryptionAlgorithm = "AES192" + // EncryptionAlgorithmAES256 specifies the encryption algorithm aes256 + // state for encryption algorithm. + EncryptionAlgorithmAES256 EncryptionAlgorithm = "AES256" + // EncryptionAlgorithmDES3 specifies the encryption algorithm des3 state + // for encryption algorithm. + EncryptionAlgorithmDES3 EncryptionAlgorithm = "DES3" + // EncryptionAlgorithmNone specifies the encryption algorithm none state + // for encryption algorithm. + EncryptionAlgorithmNone EncryptionAlgorithm = "None" + // EncryptionAlgorithmNotSpecified specifies the encryption algorithm not + // specified state for encryption algorithm. + EncryptionAlgorithmNotSpecified EncryptionAlgorithm = "NotSpecified" + // EncryptionAlgorithmRC2 specifies the encryption algorithm rc2 state for + // encryption algorithm. + EncryptionAlgorithmRC2 EncryptionAlgorithm = "RC2" +) + +// HashingAlgorithm enumerates the values for hashing algorithm. +type HashingAlgorithm string + +const ( + // HashingAlgorithmMD5 specifies the hashing algorithm md5 state for + // hashing algorithm. + HashingAlgorithmMD5 HashingAlgorithm = "MD5" + // HashingAlgorithmNone specifies the hashing algorithm none state for + // hashing algorithm. + HashingAlgorithmNone HashingAlgorithm = "None" + // HashingAlgorithmNotSpecified specifies the hashing algorithm not + // specified state for hashing algorithm. + HashingAlgorithmNotSpecified HashingAlgorithm = "NotSpecified" + // HashingAlgorithmSHA1 specifies the hashing algorithm sha1 state for + // hashing algorithm. + HashingAlgorithmSHA1 HashingAlgorithm = "SHA1" + // HashingAlgorithmSHA2256 specifies the hashing algorithm sha2256 state + // for hashing algorithm. + HashingAlgorithmSHA2256 HashingAlgorithm = "SHA2256" + // HashingAlgorithmSHA2384 specifies the hashing algorithm sha2384 state + // for hashing algorithm. + HashingAlgorithmSHA2384 HashingAlgorithm = "SHA2384" + // HashingAlgorithmSHA2512 specifies the hashing algorithm sha2512 state + // for hashing algorithm. + HashingAlgorithmSHA2512 HashingAlgorithm = "SHA2512" +) + +// IntegrationAccountSkuName enumerates the values for integration account sku +// name. +type IntegrationAccountSkuName string + +const ( + // IntegrationAccountSkuNameFree specifies the integration account sku name + // free state for integration account sku name. + IntegrationAccountSkuNameFree IntegrationAccountSkuName = "Free" + // IntegrationAccountSkuNameNotSpecified specifies the integration account + // sku name not specified state for integration account sku name. + IntegrationAccountSkuNameNotSpecified IntegrationAccountSkuName = "NotSpecified" + // IntegrationAccountSkuNameStandard specifies the integration account sku + // name standard state for integration account sku name. + IntegrationAccountSkuNameStandard IntegrationAccountSkuName = "Standard" +) + // KeyType enumerates the values for key type. type KeyType string const ( - // NotSpecified specifies the not specified state for key type. - NotSpecified KeyType = "NotSpecified" - // Primary specifies the primary state for key type. - Primary KeyType = "Primary" - // Secondary specifies the secondary state for key type. - Secondary KeyType = "Secondary" + // KeyTypeNotSpecified specifies the key type not specified state for key + // type. + KeyTypeNotSpecified KeyType = "NotSpecified" + // KeyTypePrimary specifies the key type primary state for key type. + KeyTypePrimary KeyType = "Primary" + // KeyTypeSecondary specifies the key type secondary state for key type. + KeyTypeSecondary KeyType = "Secondary" +) + +// MapType enumerates the values for map type. +type MapType string + +const ( + // MapTypeNotSpecified specifies the map type not specified state for map + // type. + MapTypeNotSpecified MapType = "NotSpecified" + // MapTypeXslt specifies the map type xslt state for map type. + MapTypeXslt MapType = "Xslt" +) + +// MessageFilterType enumerates the values for message filter type. +type MessageFilterType string + +const ( + // MessageFilterTypeExclude specifies the message filter type exclude state + // for message filter type. + MessageFilterTypeExclude MessageFilterType = "Exclude" + // MessageFilterTypeInclude specifies the message filter type include state + // for message filter type. + MessageFilterTypeInclude MessageFilterType = "Include" + // MessageFilterTypeNotSpecified specifies the message filter type not + // specified state for message filter type. + MessageFilterTypeNotSpecified MessageFilterType = "NotSpecified" ) // ParameterType enumerates the values for parameter type. @@ -117,6 +294,17 @@ const ( ParameterTypeString ParameterType = "String" ) +// PartnerType enumerates the values for partner type. +type PartnerType string + +const ( + // PartnerTypeB2B specifies the partner type b2b state for partner type. + PartnerTypeB2B PartnerType = "B2B" + // PartnerTypeNotSpecified specifies the partner type not specified state + // for partner type. + PartnerTypeNotSpecified PartnerType = "NotSpecified" +) + // RecurrenceFrequency enumerates the values for recurrence frequency. type RecurrenceFrequency string @@ -147,6 +335,38 @@ const ( RecurrenceFrequencyYear RecurrenceFrequency = "Year" ) +// SchemaType enumerates the values for schema type. +type SchemaType string + +const ( + // SchemaTypeNotSpecified specifies the schema type not specified state for + // schema type. + SchemaTypeNotSpecified SchemaType = "NotSpecified" + // SchemaTypeXML specifies the schema type xml state for schema type. + SchemaTypeXML SchemaType = "Xml" +) + +// SegmentTerminatorSuffix enumerates the values for segment terminator suffix. +type SegmentTerminatorSuffix string + +const ( + // SegmentTerminatorSuffixCR specifies the segment terminator suffix cr + // state for segment terminator suffix. + SegmentTerminatorSuffixCR SegmentTerminatorSuffix = "CR" + // SegmentTerminatorSuffixCRLF specifies the segment terminator suffix crlf + // state for segment terminator suffix. + SegmentTerminatorSuffixCRLF SegmentTerminatorSuffix = "CRLF" + // SegmentTerminatorSuffixLF specifies the segment terminator suffix lf + // state for segment terminator suffix. + SegmentTerminatorSuffixLF SegmentTerminatorSuffix = "LF" + // SegmentTerminatorSuffixNone specifies the segment terminator suffix none + // state for segment terminator suffix. + SegmentTerminatorSuffixNone SegmentTerminatorSuffix = "None" + // SegmentTerminatorSuffixNotSpecified specifies the segment terminator + // suffix not specified state for segment terminator suffix. + SegmentTerminatorSuffixNotSpecified SegmentTerminatorSuffix = "NotSpecified" +) + // SkuName enumerates the values for sku name. type SkuName string @@ -166,6 +386,42 @@ const ( SkuNameStandard SkuName = "Standard" ) +// TrailingSeparatorPolicy enumerates the values for trailing separator policy. +type TrailingSeparatorPolicy string + +const ( + // TrailingSeparatorPolicyMandatory specifies the trailing separator policy + // mandatory state for trailing separator policy. + TrailingSeparatorPolicyMandatory TrailingSeparatorPolicy = "Mandatory" + // TrailingSeparatorPolicyNotAllowed specifies the trailing separator + // policy not allowed state for trailing separator policy. + TrailingSeparatorPolicyNotAllowed TrailingSeparatorPolicy = "NotAllowed" + // TrailingSeparatorPolicyNotSpecified specifies the trailing separator + // policy not specified state for trailing separator policy. + TrailingSeparatorPolicyNotSpecified TrailingSeparatorPolicy = "NotSpecified" + // TrailingSeparatorPolicyOptional specifies the trailing separator policy + // optional state for trailing separator policy. + TrailingSeparatorPolicyOptional TrailingSeparatorPolicy = "Optional" +) + +// UsageIndicator enumerates the values for usage indicator. +type UsageIndicator string + +const ( + // UsageIndicatorInformation specifies the usage indicator information + // state for usage indicator. + UsageIndicatorInformation UsageIndicator = "Information" + // UsageIndicatorNotSpecified specifies the usage indicator not specified + // state for usage indicator. + UsageIndicatorNotSpecified UsageIndicator = "NotSpecified" + // UsageIndicatorProduction specifies the usage indicator production state + // for usage indicator. + UsageIndicatorProduction UsageIndicator = "Production" + // UsageIndicatorTest specifies the usage indicator test state for usage + // indicator. + UsageIndicatorTest UsageIndicator = "Test" +) + // WorkflowProvisioningState enumerates the values for workflow provisioning // state. type WorkflowProvisioningState string @@ -372,13 +628,187 @@ const ( WorkflowTriggerProvisioningStateUpdating WorkflowTriggerProvisioningState = "Updating" ) -// ContentHash is +// X12CharacterSet enumerates the values for x12 character set. +type X12CharacterSet string + +const ( + // X12CharacterSetBasic specifies the x12 character set basic state for x12 + // character set. + X12CharacterSetBasic X12CharacterSet = "Basic" + // X12CharacterSetExtended specifies the x12 character set extended state + // for x12 character set. + X12CharacterSetExtended X12CharacterSet = "Extended" + // X12CharacterSetNotSpecified specifies the x12 character set not + // specified state for x12 character set. + X12CharacterSetNotSpecified X12CharacterSet = "NotSpecified" + // X12CharacterSetUTF8 specifies the x12 character set utf8 state for x12 + // character set. + X12CharacterSetUTF8 X12CharacterSet = "UTF8" +) + +// X12DateFormat enumerates the values for x12 date format. +type X12DateFormat string + +const ( + // X12DateFormatCCYYMMDD specifies the x12 date format ccyymmdd state for + // x12 date format. + X12DateFormatCCYYMMDD X12DateFormat = "CCYYMMDD" + // X12DateFormatNotSpecified specifies the x12 date format not specified + // state for x12 date format. + X12DateFormatNotSpecified X12DateFormat = "NotSpecified" + // X12DateFormatYYMMDD specifies the x12 date format yymmdd state for x12 + // date format. + X12DateFormatYYMMDD X12DateFormat = "YYMMDD" +) + +// X12TimeFormat enumerates the values for x12 time format. +type X12TimeFormat string + +const ( + // X12TimeFormatHHMM specifies the x12 time format hhmm state for x12 time + // format. + X12TimeFormatHHMM X12TimeFormat = "HHMM" + // X12TimeFormatHHMMSS specifies the x12 time format hhmmss state for x12 + // time format. + X12TimeFormatHHMMSS X12TimeFormat = "HHMMSS" + // X12TimeFormatHHMMSSd specifies the x12 time format hhmms sd state for + // x12 time format. + X12TimeFormatHHMMSSd X12TimeFormat = "HHMMSSd" + // X12TimeFormatHHMMSSdd specifies the x12 time format hhmms sdd state for + // x12 time format. + X12TimeFormatHHMMSSdd X12TimeFormat = "HHMMSSdd" + // X12TimeFormatNotSpecified specifies the x12 time format not specified + // state for x12 time format. + X12TimeFormatNotSpecified X12TimeFormat = "NotSpecified" +) + +// AgreementContent is the integration account agreement content. +type AgreementContent struct { + AS2 *AS2AgreementContent `json:"aS2,omitempty"` + X12 *X12AgreementContent `json:"x12,omitempty"` + Edifact *EdifactAgreementContent `json:"edifact,omitempty"` +} + +// AS2AcknowledgementConnectionSettings is the AS2 agreement acknowledegment +// connection settings. +type AS2AcknowledgementConnectionSettings struct { + IgnoreCertificateNameMismatch *bool `json:"ignoreCertificateNameMismatch,omitempty"` + SupportHTTPStatusCodeContinue *bool `json:"supportHttpStatusCodeContinue,omitempty"` + KeepHTTPConnectionAlive *bool `json:"keepHttpConnectionAlive,omitempty"` + UnfoldHTTPHeaders *bool `json:"unfoldHttpHeaders,omitempty"` +} + +// AS2AgreementContent is the integration account AS2 agreement content. +type AS2AgreementContent struct { + ReceiveAgreement *AS2OneWayAgreement `json:"receiveAgreement,omitempty"` + SendAgreement *AS2OneWayAgreement `json:"sendAgreement,omitempty"` +} + +// AS2EnvelopeSettings is the AS2 agreement envelope settings. +type AS2EnvelopeSettings struct { + MessageContentType *string `json:"messageContentType,omitempty"` + TransmitFileNameInMimeHeader *bool `json:"transmitFileNameInMimeHeader,omitempty"` + FileNameTemplate *string `json:"fileNameTemplate,omitempty"` + SuspendMessageOnFileNameGenerationError *bool `json:"suspendMessageOnFileNameGenerationError,omitempty"` + AutogenerateFileName *bool `json:"autogenerateFileName,omitempty"` +} + +// AS2ErrorSettings is the AS2 agreement error settings. +type AS2ErrorSettings struct { + SuspendDuplicateMessage *bool `json:"suspendDuplicateMessage,omitempty"` + ResendIfMdnNotReceived *bool `json:"resendIfMdnNotReceived,omitempty"` +} + +// AS2MdnSettings is the AS2 agreement mdn settings. +type AS2MdnSettings struct { + NeedMdn *bool `json:"needMdn,omitempty"` + SignMdn *bool `json:"signMdn,omitempty"` + SendMdnAsynchronously *bool `json:"sendMdnAsynchronously,omitempty"` + ReceiptDeliveryURL *string `json:"receiptDeliveryUrl,omitempty"` + DispositionNotificationTo *string `json:"dispositionNotificationTo,omitempty"` + SignOutboundMdnIfOptional *bool `json:"signOutboundMdnIfOptional,omitempty"` + MdnText *string `json:"mdnText,omitempty"` + SendInboundMdnToMessageBox *bool `json:"sendInboundMdnToMessageBox,omitempty"` + MicHashingAlgorithm HashingAlgorithm `json:"micHashingAlgorithm,omitempty"` +} + +// AS2MessageConnectionSettings is the AS2 agreement message connection +// settings. +type AS2MessageConnectionSettings struct { + IgnoreCertificateNameMismatch *bool `json:"ignoreCertificateNameMismatch,omitempty"` + SupportHTTPStatusCodeContinue *bool `json:"supportHttpStatusCodeContinue,omitempty"` + KeepHTTPConnectionAlive *bool `json:"keepHttpConnectionAlive,omitempty"` + UnfoldHTTPHeaders *bool `json:"unfoldHttpHeaders,omitempty"` +} + +// AS2OneWayAgreement is the integration account AS2 oneway agreement. +type AS2OneWayAgreement struct { + SenderBusinessIdentity *BusinessIdentity `json:"senderBusinessIdentity,omitempty"` + ReceiverBusinessIdentity *BusinessIdentity `json:"receiverBusinessIdentity,omitempty"` + ProtocolSettings *AS2ProtocolSettings `json:"protocolSettings,omitempty"` +} + +// AS2ProtocolSettings is the AS2 agreement protocol settings. +type AS2ProtocolSettings struct { + MessageConnectionSettings *AS2MessageConnectionSettings `json:"messageConnectionSettings,omitempty"` + AcknowledgementConnectionSettings *AS2AcknowledgementConnectionSettings `json:"acknowledgementConnectionSettings,omitempty"` + MdnSettings *AS2MdnSettings `json:"mdnSettings,omitempty"` + SecuritySettings *AS2SecuritySettings `json:"securitySettings,omitempty"` + ValidationSettings *AS2ValidationSettings `json:"validationSettings,omitempty"` + EnvelopeSettings *AS2EnvelopeSettings `json:"envelopeSettings,omitempty"` + ErrorSettings *AS2ErrorSettings `json:"errorSettings,omitempty"` +} + +// AS2SecuritySettings is the AS2 agreement security settings. +type AS2SecuritySettings struct { + OverrideGroupSigningCertificate *bool `json:"overrideGroupSigningCertificate,omitempty"` + SigningCertificateName *string `json:"signingCertificateName,omitempty"` + EncryptionCertificateName *string `json:"encryptionCertificateName,omitempty"` + EnableNrrForInboundEncodedMessages *bool `json:"enableNrrForInboundEncodedMessages,omitempty"` + EnableNrrForInboundDecodedMessages *bool `json:"enableNrrForInboundDecodedMessages,omitempty"` + EnableNrrForOutboundMdn *bool `json:"enableNrrForOutboundMdn,omitempty"` + EnableNrrForOutboundEncodedMessages *bool `json:"enableNrrForOutboundEncodedMessages,omitempty"` + EnableNrrForOutboundDecodedMessages *bool `json:"enableNrrForOutboundDecodedMessages,omitempty"` + EnableNrrForInboundMdn *bool `json:"enableNrrForInboundMdn,omitempty"` +} + +// AS2ValidationSettings is the AS2 agreement validation settings. +type AS2ValidationSettings struct { + OverrideMessageProperties *bool `json:"overrideMessageProperties,omitempty"` + EncryptMessage *bool `json:"encryptMessage,omitempty"` + SignMessage *bool `json:"signMessage,omitempty"` + CompressMessage *bool `json:"compressMessage,omitempty"` + CheckDuplicateMessage *bool `json:"checkDuplicateMessage,omitempty"` + InterchangeDuplicatesValidityDays *int32 `json:"interchangeDuplicatesValidityDays,omitempty"` + CheckCertificateRevocationListOnSend *bool `json:"checkCertificateRevocationListOnSend,omitempty"` + CheckCertificateRevocationListOnReceive *bool `json:"checkCertificateRevocationListOnReceive,omitempty"` + EncryptionAlgorithm EncryptionAlgorithm `json:"encryptionAlgorithm,omitempty"` +} + +// B2BPartnerContent is the B2B partner content. +type B2BPartnerContent struct { + BusinessIdentities *[]BusinessIdentity `json:"businessIdentities,omitempty"` +} + +// BusinessIdentity is the integration account partner's business identity. +type BusinessIdentity struct { + Qualifier *string `json:"qualifier,omitempty"` + Value *string `json:"value,omitempty"` +} + +// CallbackURL is the callback url. +type CallbackURL struct { + autorest.Response `json:"-"` + Value *string `json:"value,omitempty"` +} + +// ContentHash is the content hash. type ContentHash struct { Algorithm *string `json:"algorithm,omitempty"` Value *string `json:"value,omitempty"` } -// ContentLink is +// ContentLink is the content link. type ContentLink struct { URI *string `json:"uri,omitempty"` ContentVersion *string `json:"contentVersion,omitempty"` @@ -387,17 +817,609 @@ type ContentLink struct { Metadata *map[string]interface{} `json:"metadata,omitempty"` } -// Correlation is +// Correlation is the correlation property. type Correlation struct { ClientTrackingID *string `json:"clientTrackingId,omitempty"` } -// GenerateUpgradedDefinitionParameters is +// EdifactAcknowledgementSettings is the Edifact agreement acknowledgement +// settings. +type EdifactAcknowledgementSettings struct { + NeedTechnicalAcknowledgement *bool `json:"needTechnicalAcknowledgement,omitempty"` + BatchTechnicalAcknowledgements *bool `json:"batchTechnicalAcknowledgements,omitempty"` + NeedFunctionalAcknowledgement *bool `json:"needFunctionalAcknowledgement,omitempty"` + BatchFunctionalAcknowledgements *bool `json:"batchFunctionalAcknowledgements,omitempty"` + NeedLoopForValidMessages *bool `json:"needLoopForValidMessages,omitempty"` + SendSynchronousAcknowledgement *bool `json:"sendSynchronousAcknowledgement,omitempty"` + AcknowledgementControlNumberPrefix *string `json:"acknowledgementControlNumberPrefix,omitempty"` + AcknowledgementControlNumberSuffix *string `json:"acknowledgementControlNumberSuffix,omitempty"` + AcknowledgementControlNumberLowerBound *int32 `json:"acknowledgementControlNumberLowerBound,omitempty"` + AcknowledgementControlNumberUpperBound *int32 `json:"acknowledgementControlNumberUpperBound,omitempty"` + RolloverAcknowledgementControlNumber *bool `json:"rolloverAcknowledgementControlNumber,omitempty"` +} + +// EdifactAgreementContent is the Edifact agreement content. +type EdifactAgreementContent struct { + ReceiveAgreement *EdifactOneWayAgreement `json:"receiveAgreement,omitempty"` + SendAgreement *EdifactOneWayAgreement `json:"sendAgreement,omitempty"` +} + +// EdifactDelimiterOverride is the Edifact delimiter override settings. +type EdifactDelimiterOverride struct { + MessageID *string `json:"messageId,omitempty"` + MessageVersion *string `json:"messageVersion,omitempty"` + MessageRelease *string `json:"messageRelease,omitempty"` + DataElementSeparator *int32 `json:"dataElementSeparator,omitempty"` + ComponentSeparator *int32 `json:"componentSeparator,omitempty"` + SegmentTerminator *int32 `json:"segmentTerminator,omitempty"` + RepetitionSeparator *int32 `json:"repetitionSeparator,omitempty"` + SegmentTerminatorSuffix SegmentTerminatorSuffix `json:"segmentTerminatorSuffix,omitempty"` + DecimalPointIndicator EdifactDecimalIndicator `json:"decimalPointIndicator,omitempty"` + ReleaseIndicator *int32 `json:"releaseIndicator,omitempty"` + MessageAssociationAssignedCode *string `json:"messageAssociationAssignedCode,omitempty"` + TargetNamespace *string `json:"targetNamespace,omitempty"` +} + +// EdifactEnvelopeOverride is the Edifact enevlope override settings. +type EdifactEnvelopeOverride struct { + MessageID *string `json:"messageId,omitempty"` + MessageVersion *string `json:"messageVersion,omitempty"` + MessageRelease *string `json:"messageRelease,omitempty"` + MessageAssociationAssignedCode *string `json:"messageAssociationAssignedCode,omitempty"` + TargetNamespace *string `json:"targetNamespace,omitempty"` + FunctionalGroupID *string `json:"functionalGroupId,omitempty"` + SenderApplicationQualifier *string `json:"senderApplicationQualifier,omitempty"` + SenderApplicationID *string `json:"senderApplicationId,omitempty"` + ReceiverApplicationQualifier *string `json:"receiverApplicationQualifier,omitempty"` + ReceiverApplicationID *string `json:"receiverApplicationId,omitempty"` + ControllingAgencyCode *string `json:"controllingAgencyCode,omitempty"` + GroupHeaderMessageVersion *string `json:"groupHeaderMessageVersion,omitempty"` + GroupHeaderMessageRelease *string `json:"groupHeaderMessageRelease,omitempty"` + AssociationAssignedCode *string `json:"associationAssignedCode,omitempty"` + ApplicationPassword *string `json:"applicationPassword,omitempty"` +} + +// EdifactEnvelopeSettings is the Edifact agreement envelope settings. +type EdifactEnvelopeSettings struct { + GroupAssociationAssignedCode *string `json:"groupAssociationAssignedCode,omitempty"` + CommunicationAgreementID *string `json:"communicationAgreementId,omitempty"` + ApplyDelimiterStringAdvice *bool `json:"applyDelimiterStringAdvice,omitempty"` + CreateGroupingSegments *bool `json:"createGroupingSegments,omitempty"` + EnableDefaultGroupHeaders *bool `json:"enableDefaultGroupHeaders,omitempty"` + RecipientReferencePasswordValue *string `json:"recipientReferencePasswordValue,omitempty"` + RecipientReferencePasswordQualifier *string `json:"recipientReferencePasswordQualifier,omitempty"` + ApplicationReferenceID *string `json:"applicationReferenceId,omitempty"` + ProcessingPriorityCode *string `json:"processingPriorityCode,omitempty"` + InterchangeControlNumberLowerBound *int64 `json:"interchangeControlNumberLowerBound,omitempty"` + InterchangeControlNumberUpperBound *int64 `json:"interchangeControlNumberUpperBound,omitempty"` + RolloverInterchangeControlNumber *bool `json:"rolloverInterchangeControlNumber,omitempty"` + InterchangeControlNumberPrefix *string `json:"interchangeControlNumberPrefix,omitempty"` + InterchangeControlNumberSuffix *string `json:"interchangeControlNumberSuffix,omitempty"` + SenderReverseRoutingAddress *string `json:"senderReverseRoutingAddress,omitempty"` + ReceiverReverseRoutingAddress *string `json:"receiverReverseRoutingAddress,omitempty"` + FunctionalGroupID *string `json:"functionalGroupId,omitempty"` + GroupControllingAgencyCode *string `json:"groupControllingAgencyCode,omitempty"` + GroupMessageVersion *string `json:"groupMessageVersion,omitempty"` + GroupMessageRelease *string `json:"groupMessageRelease,omitempty"` + GroupControlNumberLowerBound *int64 `json:"groupControlNumberLowerBound,omitempty"` + GroupControlNumberUpperBound *int64 `json:"groupControlNumberUpperBound,omitempty"` + RolloverGroupControlNumber *bool `json:"rolloverGroupControlNumber,omitempty"` + GroupControlNumberPrefix *string `json:"groupControlNumberPrefix,omitempty"` + GroupControlNumberSuffix *string `json:"groupControlNumberSuffix,omitempty"` + GroupApplicationReceiverQualifier *string `json:"groupApplicationReceiverQualifier,omitempty"` + GroupApplicationReceiverID *string `json:"groupApplicationReceiverId,omitempty"` + GroupApplicationSenderQualifier *string `json:"groupApplicationSenderQualifier,omitempty"` + GroupApplicationSenderID *string `json:"groupApplicationSenderId,omitempty"` + GroupApplicationPassword *string `json:"groupApplicationPassword,omitempty"` + OverwriteExistingTransactionSetControlNumber *bool `json:"overwriteExistingTransactionSetControlNumber,omitempty"` + TransactionSetControlNumberPrefix *string `json:"transactionSetControlNumberPrefix,omitempty"` + TransactionSetControlNumberSuffix *string `json:"transactionSetControlNumberSuffix,omitempty"` + TransactionSetControlNumberLowerBound *int64 `json:"transactionSetControlNumberLowerBound,omitempty"` + TransactionSetControlNumberUpperBound *int64 `json:"transactionSetControlNumberUpperBound,omitempty"` + RolloverTransactionSetControlNumber *bool `json:"rolloverTransactionSetControlNumber,omitempty"` + IsTestInterchange *bool `json:"isTestInterchange,omitempty"` + SenderInternalIdentification *string `json:"senderInternalIdentification,omitempty"` + SenderInternalSubIdentification *string `json:"senderInternalSubIdentification,omitempty"` + ReceiverInternalIdentification *string `json:"receiverInternalIdentification,omitempty"` + ReceiverInternalSubIdentification *string `json:"receiverInternalSubIdentification,omitempty"` +} + +// EdifactFramingSettings is the Edifact agreement framing settings. +type EdifactFramingSettings struct { + ServiceCodeListDirectoryVersion *string `json:"serviceCodeListDirectoryVersion,omitempty"` + CharacterEncoding *string `json:"characterEncoding,omitempty"` + ProtocolVersion *int32 `json:"protocolVersion,omitempty"` + DataElementSeparator *int32 `json:"dataElementSeparator,omitempty"` + ComponentSeparator *int32 `json:"componentSeparator,omitempty"` + SegmentTerminator *int32 `json:"segmentTerminator,omitempty"` + ReleaseIndicator *int32 `json:"releaseIndicator,omitempty"` + RepetitionSeparator *int32 `json:"repetitionSeparator,omitempty"` + CharacterSet EdifactCharacterSet `json:"characterSet,omitempty"` + DecimalPointIndicator EdifactDecimalIndicator `json:"decimalPointIndicator,omitempty"` + SegmentTerminatorSuffix SegmentTerminatorSuffix `json:"segmentTerminatorSuffix,omitempty"` +} + +// EdifactMessageFilter is the Edifact message filter for odata query. +type EdifactMessageFilter struct { + MessageFilterType MessageFilterType `json:"messageFilterType,omitempty"` +} + +// EdifactMessageIdentifier is the Edifact message identifier. +type EdifactMessageIdentifier struct { + MessageID *string `json:"messageId,omitempty"` +} + +// EdifactOneWayAgreement is the Edifact one way agreement. +type EdifactOneWayAgreement struct { + SenderBusinessIdentity *BusinessIdentity `json:"senderBusinessIdentity,omitempty"` + ReceiverBusinessIdentity *BusinessIdentity `json:"receiverBusinessIdentity,omitempty"` + ProtocolSettings *EdifactProtocolSettings `json:"protocolSettings,omitempty"` +} + +// EdifactProcessingSettings is the Edifact agreement protocol settings. +type EdifactProcessingSettings struct { + MaskSecurityInfo *bool `json:"maskSecurityInfo,omitempty"` + PreserveInterchange *bool `json:"preserveInterchange,omitempty"` + SuspendInterchangeOnError *bool `json:"suspendInterchangeOnError,omitempty"` + CreateEmptyXMLTagsForTrailingSeparators *bool `json:"createEmptyXmlTagsForTrailingSeparators,omitempty"` + UseDotAsDecimalSeparator *bool `json:"useDotAsDecimalSeparator,omitempty"` +} + +// EdifactProtocolSettings is the Edifact agreement protocol settings. +type EdifactProtocolSettings struct { + ValidationSettings *EdifactValidationSettings `json:"validationSettings,omitempty"` + FramingSettings *EdifactFramingSettings `json:"framingSettings,omitempty"` + EnvelopeSettings *EdifactEnvelopeSettings `json:"envelopeSettings,omitempty"` + AcknowledgementSettings *EdifactAcknowledgementSettings `json:"acknowledgementSettings,omitempty"` + MessageFilter *EdifactMessageFilter `json:"messageFilter,omitempty"` + ProcessingSettings *EdifactProcessingSettings `json:"processingSettings,omitempty"` + EnvelopeOverrides *[]EdifactEnvelopeOverride `json:"envelopeOverrides,omitempty"` + MessageFilterList *[]EdifactMessageIdentifier `json:"messageFilterList,omitempty"` + SchemaReferences *[]EdifactSchemaReference `json:"schemaReferences,omitempty"` + ValidationOverrides *[]EdifactValidationOverride `json:"validationOverrides,omitempty"` + EdifactDelimiterOverrides *[]EdifactDelimiterOverride `json:"edifactDelimiterOverrides,omitempty"` +} + +// EdifactSchemaReference is the Edifact schema reference. +type EdifactSchemaReference struct { + MessageID *string `json:"messageId,omitempty"` + MessageVersion *string `json:"messageVersion,omitempty"` + MessageRelease *string `json:"messageRelease,omitempty"` + SenderApplicationID *string `json:"senderApplicationId,omitempty"` + SenderApplicationQualifier *string `json:"senderApplicationQualifier,omitempty"` + AssociationAssignedCode *string `json:"associationAssignedCode,omitempty"` + SchemaName *string `json:"schemaName,omitempty"` +} + +// EdifactValidationOverride is the Edifact validation override settings. +type EdifactValidationOverride struct { + MessageID *string `json:"messageId,omitempty"` + EnforceCharacterSet *bool `json:"enforceCharacterSet,omitempty"` + ValidateEdiTypes *bool `json:"validateEdiTypes,omitempty"` + ValidateXsdTypes *bool `json:"validateXsdTypes,omitempty"` + AllowLeadingAndTrailingSpacesAndZeroes *bool `json:"allowLeadingAndTrailingSpacesAndZeroes,omitempty"` + TrailingSeparatorPolicy TrailingSeparatorPolicy `json:"trailingSeparatorPolicy,omitempty"` + TrimLeadingAndTrailingSpacesAndZeroes *bool `json:"trimLeadingAndTrailingSpacesAndZeroes,omitempty"` +} + +// EdifactValidationSettings is the Edifact agreement validation settings. +type EdifactValidationSettings struct { + ValidateCharacterSet *bool `json:"validateCharacterSet,omitempty"` + CheckDuplicateInterchangeControlNumber *bool `json:"checkDuplicateInterchangeControlNumber,omitempty"` + InterchangeControlNumberValidityDays *int32 `json:"interchangeControlNumberValidityDays,omitempty"` + CheckDuplicateGroupControlNumber *bool `json:"checkDuplicateGroupControlNumber,omitempty"` + CheckDuplicateTransactionSetControlNumber *bool `json:"checkDuplicateTransactionSetControlNumber,omitempty"` + ValidateEdiTypes *bool `json:"validateEdiTypes,omitempty"` + ValidateXsdTypes *bool `json:"validateXsdTypes,omitempty"` + AllowLeadingAndTrailingSpacesAndZeroes *bool `json:"allowLeadingAndTrailingSpacesAndZeroes,omitempty"` + TrimLeadingAndTrailingSpacesAndZeroes *bool `json:"trimLeadingAndTrailingSpacesAndZeroes,omitempty"` + TrailingSeparatorPolicy TrailingSeparatorPolicy `json:"trailingSeparatorPolicy,omitempty"` +} + +// ErrorProperties is error properties indicate why the Logic service was not +// able to process the incoming request. The reason is provided in the error +// message. +type ErrorProperties struct { + Code *string `json:"code,omitempty"` + Message *string `json:"message,omitempty"` +} + +// ErrorResponse is error reponse indicates Logic service is not able to +// process the incoming request. The error property contains the error details. +type ErrorResponse struct { + Error *ErrorProperties `json:"error,omitempty"` +} + +// GenerateUpgradedDefinitionParameters is the parameters to generate upgraded +// definition. type GenerateUpgradedDefinitionParameters struct { TargetSchemaVersion *string `json:"targetSchemaVersion,omitempty"` } -// RecurrenceSchedule is +// GetCallbackURLParameters is the callback url parameters. +type GetCallbackURLParameters struct { + NotAfter *date.Time `json:"notAfter,omitempty"` + KeyType KeyType `json:"keyType,omitempty"` +} + +// IntegrationAccount is the integration account. +type IntegrationAccount struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Location *string `json:"location,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + Properties *map[string]interface{} `json:"properties,omitempty"` + Sku *IntegrationAccountSku `json:"sku,omitempty"` +} + +// IntegrationAccountAgreement is the integration account agreement. +type IntegrationAccountAgreement struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Location *string `json:"location,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + *IntegrationAccountAgreementProperties `json:"properties,omitempty"` +} + +// IntegrationAccountAgreementFilter is the integration account agreement +// filter for odata query. +type IntegrationAccountAgreementFilter struct { + AgreementType AgreementType `json:"agreementType,omitempty"` +} + +// IntegrationAccountAgreementListResult is the list of integration account +// agreements. +type IntegrationAccountAgreementListResult struct { + autorest.Response `json:"-"` + Value *[]IntegrationAccountAgreement `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// IntegrationAccountAgreementListResultPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client IntegrationAccountAgreementListResult) IntegrationAccountAgreementListResultPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// IntegrationAccountAgreementProperties is the integration account agreement +// properties. +type IntegrationAccountAgreementProperties struct { + CreatedTime *date.Time `json:"createdTime,omitempty"` + ChangedTime *date.Time `json:"changedTime,omitempty"` + Metadata *map[string]interface{} `json:"metadata,omitempty"` + AgreementType AgreementType `json:"agreementType,omitempty"` + HostPartner *string `json:"hostPartner,omitempty"` + GuestPartner *string `json:"guestPartner,omitempty"` + HostIdentity *BusinessIdentity `json:"hostIdentity,omitempty"` + GuestIdentity *BusinessIdentity `json:"guestIdentity,omitempty"` + Content *AgreementContent `json:"content,omitempty"` +} + +// IntegrationAccountCertificate is the integration account certificate. +type IntegrationAccountCertificate struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Location *string `json:"location,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + *IntegrationAccountCertificateProperties `json:"properties,omitempty"` +} + +// IntegrationAccountCertificateListResult is the list of integration account +// certificates. +type IntegrationAccountCertificateListResult struct { + autorest.Response `json:"-"` + Value *[]IntegrationAccountCertificate `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// IntegrationAccountCertificateListResultPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client IntegrationAccountCertificateListResult) IntegrationAccountCertificateListResultPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// IntegrationAccountCertificateProperties is the integration account +// certificate properties. +type IntegrationAccountCertificateProperties struct { + CreatedTime *date.Time `json:"createdTime,omitempty"` + ChangedTime *date.Time `json:"changedTime,omitempty"` + Metadata *map[string]interface{} `json:"metadata,omitempty"` + Key *KeyVaultKeyReference `json:"key,omitempty"` + PublicCertificate *string `json:"publicCertificate,omitempty"` +} + +// IntegrationAccountListResult is the list of integration accounts. +type IntegrationAccountListResult struct { + autorest.Response `json:"-"` + Value *[]IntegrationAccount `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// IntegrationAccountListResultPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client IntegrationAccountListResult) IntegrationAccountListResultPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// IntegrationAccountMap is the integration account map. +type IntegrationAccountMap struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Location *string `json:"location,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + *IntegrationAccountMapProperties `json:"properties,omitempty"` +} + +// IntegrationAccountMapFilter is the integration account map filter for odata +// query. +type IntegrationAccountMapFilter struct { + MapType MapType `json:"mapType,omitempty"` +} + +// IntegrationAccountMapListResult is the list of integration account maps. +type IntegrationAccountMapListResult struct { + autorest.Response `json:"-"` + Value *[]IntegrationAccountMap `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// IntegrationAccountMapListResultPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client IntegrationAccountMapListResult) IntegrationAccountMapListResultPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// IntegrationAccountMapProperties is the integration account map. +type IntegrationAccountMapProperties struct { + MapType MapType `json:"mapType,omitempty"` + ParametersSchema *IntegrationAccountMapPropertiesParametersSchema `json:"parametersSchema,omitempty"` + CreatedTime *date.Time `json:"createdTime,omitempty"` + ChangedTime *date.Time `json:"changedTime,omitempty"` + Content *string `json:"content,omitempty"` + ContentType *string `json:"contentType,omitempty"` + ContentLink *ContentLink `json:"contentLink,omitempty"` + Metadata *map[string]interface{} `json:"metadata,omitempty"` +} + +// IntegrationAccountMapPropertiesParametersSchema is the parameters schema of +// integration account map. +type IntegrationAccountMapPropertiesParametersSchema struct { + Ref *string `json:"ref,omitempty"` +} + +// IntegrationAccountPartner is the integration account partner. +type IntegrationAccountPartner struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Location *string `json:"location,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + *IntegrationAccountPartnerProperties `json:"properties,omitempty"` +} + +// IntegrationAccountPartnerFilter is the integration account partner filter +// for odata query. +type IntegrationAccountPartnerFilter struct { + PartnerType PartnerType `json:"partnerType,omitempty"` +} + +// IntegrationAccountPartnerListResult is the list of integration account +// partners. +type IntegrationAccountPartnerListResult struct { + autorest.Response `json:"-"` + Value *[]IntegrationAccountPartner `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// IntegrationAccountPartnerListResultPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client IntegrationAccountPartnerListResult) IntegrationAccountPartnerListResultPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// IntegrationAccountPartnerProperties is the integration account partner +// properties. +type IntegrationAccountPartnerProperties struct { + PartnerType PartnerType `json:"partnerType,omitempty"` + CreatedTime *date.Time `json:"createdTime,omitempty"` + ChangedTime *date.Time `json:"changedTime,omitempty"` + Metadata *map[string]interface{} `json:"metadata,omitempty"` + Content *PartnerContent `json:"content,omitempty"` +} + +// IntegrationAccountSchema is the integration account schema. +type IntegrationAccountSchema struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Location *string `json:"location,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + *IntegrationAccountSchemaProperties `json:"properties,omitempty"` +} + +// IntegrationAccountSchemaFilter is the integration account schema filter for +// odata query. +type IntegrationAccountSchemaFilter struct { + SchemaType SchemaType `json:"schemaType,omitempty"` +} + +// IntegrationAccountSchemaListResult is the list of integration account +// schemas. +type IntegrationAccountSchemaListResult struct { + autorest.Response `json:"-"` + Value *[]IntegrationAccountSchema `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// IntegrationAccountSchemaListResultPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client IntegrationAccountSchemaListResult) IntegrationAccountSchemaListResultPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// IntegrationAccountSchemaProperties is the integration account schema +// properties. +type IntegrationAccountSchemaProperties struct { + SchemaType SchemaType `json:"schemaType,omitempty"` + TargetNamespace *string `json:"targetNamespace,omitempty"` + DocumentName *string `json:"documentName,omitempty"` + FileName *string `json:"fileName,omitempty"` + CreatedTime *date.Time `json:"createdTime,omitempty"` + ChangedTime *date.Time `json:"changedTime,omitempty"` + Metadata *map[string]interface{} `json:"metadata,omitempty"` + Content *string `json:"content,omitempty"` + ContentType *string `json:"contentType,omitempty"` + ContentLink *ContentLink `json:"contentLink,omitempty"` +} + +// IntegrationAccountSession is the integration account session. +type IntegrationAccountSession struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Location *string `json:"location,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + *IntegrationAccountSessionProperties `json:"properties,omitempty"` +} + +// IntegrationAccountSessionFilter is the integration account session filter. +type IntegrationAccountSessionFilter struct { + ChangedTime *date.Time `json:"changedTime,omitempty"` +} + +// IntegrationAccountSessionListResult is the list of integration account +// sessions. +type IntegrationAccountSessionListResult struct { + autorest.Response `json:"-"` + Value *[]IntegrationAccountSession `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// IntegrationAccountSessionListResultPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client IntegrationAccountSessionListResult) IntegrationAccountSessionListResultPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// IntegrationAccountSessionProperties is the integration account session +// properties. +type IntegrationAccountSessionProperties struct { + CreatedTime *date.Time `json:"createdTime,omitempty"` + ChangedTime *date.Time `json:"changedTime,omitempty"` + Content *map[string]interface{} `json:"content,omitempty"` +} + +// IntegrationAccountSku is the integration account sku. +type IntegrationAccountSku struct { + Name IntegrationAccountSkuName `json:"name,omitempty"` +} + +// KeyVaultKeyReference is the reference to the key vault key. +type KeyVaultKeyReference struct { + KeyVault *KeyVaultKeyReferenceKeyVault `json:"keyVault,omitempty"` + KeyName *string `json:"keyName,omitempty"` + KeyVersion *string `json:"keyVersion,omitempty"` +} + +// KeyVaultKeyReferenceKeyVault is the key vault reference. +type KeyVaultKeyReferenceKeyVault struct { + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` +} + +// Operation is logic REST API operation +type Operation struct { + Name *string `json:"name,omitempty"` + Display *OperationDisplay `json:"display,omitempty"` +} + +// OperationDisplay is the object that represents the operation. +type OperationDisplay struct { + Provider *string `json:"provider,omitempty"` + Resource *string `json:"resource,omitempty"` + Operation *string `json:"operation,omitempty"` +} + +// OperationListResult is result of the request to list Logic 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 *[]Operation `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// OperationListResultPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client OperationListResult) OperationListResultPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// PartnerContent is the integration account partner content. +type PartnerContent struct { + B2b *B2BPartnerContent `json:"b2b,omitempty"` +} + +// RecurrenceSchedule is the recurrence schedule. type RecurrenceSchedule struct { Minutes *[]int32 `json:"minutes,omitempty"` Hours *[]int32 `json:"hours,omitempty"` @@ -406,13 +1428,13 @@ type RecurrenceSchedule struct { MonthlyOccurrences *[]RecurrenceScheduleOccurrence `json:"monthlyOccurrences,omitempty"` } -// RecurrenceScheduleOccurrence is +// RecurrenceScheduleOccurrence is the recurrence schedule occurence. type RecurrenceScheduleOccurrence struct { Day DayOfWeek `json:"day,omitempty"` Occurrence *int32 `json:"occurrence,omitempty"` } -// Resource is +// Resource is the base resource type. type Resource struct { ID *string `json:"id,omitempty"` Name *string `json:"name,omitempty"` @@ -421,7 +1443,7 @@ type Resource struct { Tags *map[string]*string `json:"tags,omitempty"` } -// ResourceReference is +// ResourceReference is the resource reference. type ResourceReference struct { ID *string `json:"id,omitempty"` Name *string `json:"name,omitempty"` @@ -434,18 +1456,18 @@ type SetObject struct { Value *map[string]interface{} `json:"value,omitempty"` } -// Sku is +// Sku is the sku type. type Sku struct { Name SkuName `json:"name,omitempty"` Plan *ResourceReference `json:"plan,omitempty"` } -// SubResource is +// SubResource is the sub resource type. type SubResource struct { ID *string `json:"id,omitempty"` } -// Workflow is +// Workflow is the workflow type. type Workflow struct { autorest.Response `json:"-"` ID *string `json:"id,omitempty"` @@ -456,12 +1478,12 @@ type Workflow struct { *WorkflowProperties `json:"properties,omitempty"` } -// WorkflowFilter is +// WorkflowFilter is the workflow filter. type WorkflowFilter struct { State WorkflowState `json:"state,omitempty"` } -// WorkflowListResult is +// WorkflowListResult is the list of workflows. type WorkflowListResult struct { autorest.Response `json:"-"` Value *[]Workflow `json:"value,omitempty"` @@ -480,7 +1502,7 @@ func (client WorkflowListResult) WorkflowListResultPreparer() (*http.Request, er autorest.WithBaseURL(to.String(client.NextLink))) } -// WorkflowOutputParameter is +// WorkflowOutputParameter is the workflow output parameter. type WorkflowOutputParameter struct { Type ParameterType `json:"type,omitempty"` Value *map[string]interface{} `json:"value,omitempty"` @@ -489,7 +1511,7 @@ type WorkflowOutputParameter struct { Error *map[string]interface{} `json:"error,omitempty"` } -// WorkflowParameter is +// WorkflowParameter is the workflow parameters. type WorkflowParameter struct { Type ParameterType `json:"type,omitempty"` Value *map[string]interface{} `json:"value,omitempty"` @@ -497,7 +1519,7 @@ type WorkflowParameter struct { Description *string `json:"description,omitempty"` } -// WorkflowProperties is +// WorkflowProperties is the workflow properties. type WorkflowProperties struct { ProvisioningState WorkflowProvisioningState `json:"provisioningState,omitempty"` CreatedTime *date.Time `json:"createdTime,omitempty"` @@ -511,7 +1533,7 @@ type WorkflowProperties struct { Parameters *map[string]*WorkflowParameter `json:"parameters,omitempty"` } -// WorkflowRun is +// WorkflowRun is the workflow run. type WorkflowRun struct { autorest.Response `json:"-"` ID *string `json:"id,omitempty"` @@ -520,7 +1542,7 @@ type WorkflowRun struct { Type *string `json:"type,omitempty"` } -// WorkflowRunAction is +// WorkflowRunAction is the workflow run action. type WorkflowRunAction struct { autorest.Response `json:"-"` ID *string `json:"id,omitempty"` @@ -529,12 +1551,12 @@ type WorkflowRunAction struct { Type *string `json:"type,omitempty"` } -// WorkflowRunActionFilter is +// WorkflowRunActionFilter is the workflow run action filter. type WorkflowRunActionFilter struct { Status WorkflowStatus `json:"status,omitempty"` } -// WorkflowRunActionListResult is +// WorkflowRunActionListResult is the list of workflow run actions. type WorkflowRunActionListResult struct { autorest.Response `json:"-"` Value *[]WorkflowRunAction `json:"value,omitempty"` @@ -553,7 +1575,7 @@ func (client WorkflowRunActionListResult) WorkflowRunActionListResultPreparer() autorest.WithBaseURL(to.String(client.NextLink))) } -// WorkflowRunActionProperties is +// WorkflowRunActionProperties is the workflow run action properties. type WorkflowRunActionProperties struct { StartTime *date.Time `json:"startTime,omitempty"` EndTime *date.Time `json:"endTime,omitempty"` @@ -567,12 +1589,12 @@ type WorkflowRunActionProperties struct { TrackedProperties *map[string]interface{} `json:"trackedProperties,omitempty"` } -// WorkflowRunFilter is +// WorkflowRunFilter is the workflow run filter. type WorkflowRunFilter struct { Status WorkflowStatus `json:"status,omitempty"` } -// WorkflowRunListResult is +// WorkflowRunListResult is the list of workflow runs. type WorkflowRunListResult struct { autorest.Response `json:"-"` Value *[]WorkflowRun `json:"value,omitempty"` @@ -591,7 +1613,7 @@ func (client WorkflowRunListResult) WorkflowRunListResultPreparer() (*http.Reque autorest.WithBaseURL(to.String(client.NextLink))) } -// WorkflowRunProperties is +// WorkflowRunProperties is the workflow run properties. type WorkflowRunProperties struct { StartTime *date.Time `json:"startTime,omitempty"` EndTime *date.Time `json:"endTime,omitempty"` @@ -606,7 +1628,7 @@ type WorkflowRunProperties struct { Response *WorkflowRunTrigger `json:"response,omitempty"` } -// WorkflowRunTrigger is +// WorkflowRunTrigger is the workflow run trigger. type WorkflowRunTrigger struct { Name *string `json:"name,omitempty"` Inputs *map[string]interface{} `json:"inputs,omitempty"` @@ -623,7 +1645,7 @@ type WorkflowRunTrigger struct { TrackedProperties *map[string]interface{} `json:"trackedProperties,omitempty"` } -// WorkflowTrigger is +// WorkflowTrigger is the workflow trigger. type WorkflowTrigger struct { autorest.Response `json:"-"` ID *string `json:"id,omitempty"` @@ -632,18 +1654,18 @@ type WorkflowTrigger struct { Type *string `json:"type,omitempty"` } -// WorkflowTriggerCallbackURL is +// WorkflowTriggerCallbackURL is the workflow trigger callback URL. type WorkflowTriggerCallbackURL struct { autorest.Response `json:"-"` Value *string `json:"value,omitempty"` } -// WorkflowTriggerFilter is +// WorkflowTriggerFilter is the workflow trigger filter. type WorkflowTriggerFilter struct { State WorkflowState `json:"state,omitempty"` } -// WorkflowTriggerHistory is +// WorkflowTriggerHistory is the workflow trigger history. type WorkflowTriggerHistory struct { autorest.Response `json:"-"` ID *string `json:"id,omitempty"` @@ -652,12 +1674,12 @@ type WorkflowTriggerHistory struct { Type *string `json:"type,omitempty"` } -// WorkflowTriggerHistoryFilter is +// WorkflowTriggerHistoryFilter is the workflow trigger history filter. type WorkflowTriggerHistoryFilter struct { Status WorkflowStatus `json:"status,omitempty"` } -// WorkflowTriggerHistoryListResult is +// WorkflowTriggerHistoryListResult is the list of workflow trigger histories. type WorkflowTriggerHistoryListResult struct { autorest.Response `json:"-"` Value *[]WorkflowTriggerHistory `json:"value,omitempty"` @@ -676,7 +1698,7 @@ func (client WorkflowTriggerHistoryListResult) WorkflowTriggerHistoryListResultP autorest.WithBaseURL(to.String(client.NextLink))) } -// WorkflowTriggerHistoryProperties is +// WorkflowTriggerHistoryProperties is the workflow trigger history properties. type WorkflowTriggerHistoryProperties struct { StartTime *date.Time `json:"startTime,omitempty"` EndTime *date.Time `json:"endTime,omitempty"` @@ -691,7 +1713,7 @@ type WorkflowTriggerHistoryProperties struct { Run *ResourceReference `json:"run,omitempty"` } -// WorkflowTriggerListResult is +// WorkflowTriggerListResult is the list of workflow triggers. type WorkflowTriggerListResult struct { autorest.Response `json:"-"` Value *[]WorkflowTrigger `json:"value,omitempty"` @@ -710,7 +1732,7 @@ func (client WorkflowTriggerListResult) WorkflowTriggerListResultPreparer() (*ht autorest.WithBaseURL(to.String(client.NextLink))) } -// WorkflowTriggerProperties is +// WorkflowTriggerProperties is the workflow trigger properties. type WorkflowTriggerProperties struct { ProvisioningState WorkflowTriggerProvisioningState `json:"provisioningState,omitempty"` CreatedTime *date.Time `json:"createdTime,omitempty"` @@ -723,7 +1745,7 @@ type WorkflowTriggerProperties struct { Workflow *ResourceReference `json:"workflow,omitempty"` } -// WorkflowTriggerRecurrence is +// WorkflowTriggerRecurrence is the workflow trigger recurrence. type WorkflowTriggerRecurrence struct { Frequency RecurrenceFrequency `json:"frequency,omitempty"` Interval *int32 `json:"interval,omitempty"` @@ -733,7 +1755,7 @@ type WorkflowTriggerRecurrence struct { Schedule *RecurrenceSchedule `json:"schedule,omitempty"` } -// WorkflowVersion is +// WorkflowVersion is the workflow version. type WorkflowVersion struct { autorest.Response `json:"-"` ID *string `json:"id,omitempty"` @@ -744,7 +1766,7 @@ type WorkflowVersion struct { *WorkflowVersionProperties `json:"properties,omitempty"` } -// WorkflowVersionListResult is +// WorkflowVersionListResult is the list of workflow versions. type WorkflowVersionListResult struct { autorest.Response `json:"-"` Value *[]WorkflowVersion `json:"value,omitempty"` @@ -763,7 +1785,7 @@ func (client WorkflowVersionListResult) WorkflowVersionListResultPreparer() (*ht autorest.WithBaseURL(to.String(client.NextLink))) } -// WorkflowVersionProperties is +// WorkflowVersionProperties is the workflow version properties. type WorkflowVersionProperties struct { CreatedTime *date.Time `json:"createdTime,omitempty"` ChangedTime *date.Time `json:"changedTime,omitempty"` @@ -775,3 +1797,178 @@ type WorkflowVersionProperties struct { Definition *map[string]interface{} `json:"definition,omitempty"` Parameters *map[string]*WorkflowParameter `json:"parameters,omitempty"` } + +// X12AcknowledgementSettings is the X12 agreement acknowledgement settings. +type X12AcknowledgementSettings struct { + NeedTechnicalAcknowledgement *bool `json:"needTechnicalAcknowledgement,omitempty"` + BatchTechnicalAcknowledgements *bool `json:"batchTechnicalAcknowledgements,omitempty"` + NeedFunctionalAcknowledgement *bool `json:"needFunctionalAcknowledgement,omitempty"` + FunctionalAcknowledgementVersion *string `json:"functionalAcknowledgementVersion,omitempty"` + BatchFunctionalAcknowledgements *bool `json:"batchFunctionalAcknowledgements,omitempty"` + NeedImplementationAcknowledgement *bool `json:"needImplementationAcknowledgement,omitempty"` + ImplementationAcknowledgementVersion *string `json:"implementationAcknowledgementVersion,omitempty"` + BatchImplementationAcknowledgements *bool `json:"batchImplementationAcknowledgements,omitempty"` + NeedLoopForValidMessages *bool `json:"needLoopForValidMessages,omitempty"` + SendSynchronousAcknowledgement *bool `json:"sendSynchronousAcknowledgement,omitempty"` + AcknowledgementControlNumberPrefix *string `json:"acknowledgementControlNumberPrefix,omitempty"` + AcknowledgementControlNumberSuffix *string `json:"acknowledgementControlNumberSuffix,omitempty"` + AcknowledgementControlNumberLowerBound *int32 `json:"acknowledgementControlNumberLowerBound,omitempty"` + AcknowledgementControlNumberUpperBound *int32 `json:"acknowledgementControlNumberUpperBound,omitempty"` + RolloverAcknowledgementControlNumber *bool `json:"rolloverAcknowledgementControlNumber,omitempty"` +} + +// X12AgreementContent is the X12 agreement content. +type X12AgreementContent struct { + ReceiveAgreement *X12OneWayAgreement `json:"receiveAgreement,omitempty"` + SendAgreement *X12OneWayAgreement `json:"sendAgreement,omitempty"` +} + +// X12DelimiterOverrides is the X12 delimiter override settings. +type X12DelimiterOverrides struct { + ProtocolVersion *string `json:"protocolVersion,omitempty"` + MessageID *string `json:"messageId,omitempty"` + DataElementSeparator *int32 `json:"dataElementSeparator,omitempty"` + ComponentSeparator *int32 `json:"componentSeparator,omitempty"` + SegmentTerminator *int32 `json:"segmentTerminator,omitempty"` + SegmentTerminatorSuffix SegmentTerminatorSuffix `json:"segmentTerminatorSuffix,omitempty"` + ReplaceCharacter *int32 `json:"replaceCharacter,omitempty"` + ReplaceSeparatorsInPayload *bool `json:"replaceSeparatorsInPayload,omitempty"` + TargetNamespace *string `json:"targetNamespace,omitempty"` +} + +// X12EnvelopeOverride is the X12 envelope override settings. +type X12EnvelopeOverride struct { + TargetNamespace *string `json:"targetNamespace,omitempty"` + ProtocolVersion *string `json:"protocolVersion,omitempty"` + MessageID *string `json:"messageId,omitempty"` + ResponsibleAgencyCode *string `json:"responsibleAgencyCode,omitempty"` + HeaderVersion *string `json:"headerVersion,omitempty"` + SenderApplicationID *string `json:"senderApplicationId,omitempty"` + ReceiverApplicationID *string `json:"receiverApplicationId,omitempty"` + FunctionalIdentifierCode *string `json:"functionalIdentifierCode,omitempty"` + DateFormat X12DateFormat `json:"dateFormat,omitempty"` + TimeFormat X12TimeFormat `json:"timeFormat,omitempty"` +} + +// X12EnvelopeSettings is the X12 agreement envelope settings. +type X12EnvelopeSettings struct { + ControlStandardsID *int32 `json:"controlStandardsId,omitempty"` + UseControlStandardsIDAsRepetitionCharacter *bool `json:"useControlStandardsIdAsRepetitionCharacter,omitempty"` + SenderApplicationID *string `json:"senderApplicationId,omitempty"` + ReceiverApplicationID *string `json:"receiverApplicationId,omitempty"` + ControlVersionNumber *string `json:"controlVersionNumber,omitempty"` + InterchangeControlNumberLowerBound *int32 `json:"interchangeControlNumberLowerBound,omitempty"` + InterchangeControlNumberUpperBound *int32 `json:"interchangeControlNumberUpperBound,omitempty"` + RolloverInterchangeControlNumber *bool `json:"rolloverInterchangeControlNumber,omitempty"` + EnableDefaultGroupHeaders *bool `json:"enableDefaultGroupHeaders,omitempty"` + FunctionalGroupID *string `json:"functionalGroupId,omitempty"` + GroupControlNumberLowerBound *int32 `json:"groupControlNumberLowerBound,omitempty"` + GroupControlNumberUpperBound *int32 `json:"groupControlNumberUpperBound,omitempty"` + RolloverGroupControlNumber *bool `json:"rolloverGroupControlNumber,omitempty"` + GroupHeaderAgencyCode *string `json:"groupHeaderAgencyCode,omitempty"` + GroupHeaderVersion *string `json:"groupHeaderVersion,omitempty"` + TransactionSetControlNumberLowerBound *int32 `json:"transactionSetControlNumberLowerBound,omitempty"` + TransactionSetControlNumberUpperBound *int32 `json:"transactionSetControlNumberUpperBound,omitempty"` + RolloverTransactionSetControlNumber *bool `json:"rolloverTransactionSetControlNumber,omitempty"` + TransactionSetControlNumberPrefix *string `json:"transactionSetControlNumberPrefix,omitempty"` + TransactionSetControlNumberSuffix *string `json:"transactionSetControlNumberSuffix,omitempty"` + OverwriteExistingTransactionSetControlNumber *bool `json:"overwriteExistingTransactionSetControlNumber,omitempty"` + GroupHeaderDateFormat X12DateFormat `json:"groupHeaderDateFormat,omitempty"` + GroupHeaderTimeFormat X12TimeFormat `json:"groupHeaderTimeFormat,omitempty"` + UsageIndicator UsageIndicator `json:"usageIndicator,omitempty"` +} + +// X12FramingSettings is the X12 agreement framing settings. +type X12FramingSettings struct { + DataElementSeparator *int32 `json:"dataElementSeparator,omitempty"` + ComponentSeparator *int32 `json:"componentSeparator,omitempty"` + ReplaceSeparatorsInPayload *bool `json:"replaceSeparatorsInPayload,omitempty"` + ReplaceCharacter *int32 `json:"replaceCharacter,omitempty"` + SegmentTerminator *int32 `json:"segmentTerminator,omitempty"` + CharacterSet X12CharacterSet `json:"characterSet,omitempty"` + SegmentTerminatorSuffix SegmentTerminatorSuffix `json:"segmentTerminatorSuffix,omitempty"` +} + +// X12MessageFilter is the X12 message filter for odata query. +type X12MessageFilter struct { + MessageFilterType MessageFilterType `json:"messageFilterType,omitempty"` +} + +// X12MessageIdentifier is the X12 message identifier. +type X12MessageIdentifier struct { + MessageID *string `json:"messageId,omitempty"` +} + +// X12OneWayAgreement is the X12 oneway agreement. +type X12OneWayAgreement struct { + SenderBusinessIdentity *BusinessIdentity `json:"senderBusinessIdentity,omitempty"` + ReceiverBusinessIdentity *BusinessIdentity `json:"receiverBusinessIdentity,omitempty"` + ProtocolSettings *X12ProtocolSettings `json:"protocolSettings,omitempty"` +} + +// X12ProcessingSettings is the X12 processing settings. +type X12ProcessingSettings struct { + MaskSecurityInfo *bool `json:"maskSecurityInfo,omitempty"` + ConvertImpliedDecimal *bool `json:"convertImpliedDecimal,omitempty"` + PreserveInterchange *bool `json:"preserveInterchange,omitempty"` + SuspendInterchangeOnError *bool `json:"suspendInterchangeOnError,omitempty"` + CreateEmptyXMLTagsForTrailingSeparators *bool `json:"createEmptyXmlTagsForTrailingSeparators,omitempty"` + UseDotAsDecimalSeparator *bool `json:"useDotAsDecimalSeparator,omitempty"` +} + +// X12ProtocolSettings is the X12 agreement protocol settings. +type X12ProtocolSettings struct { + ValidationSettings *X12ValidationSettings `json:"validationSettings,omitempty"` + FramingSettings *X12FramingSettings `json:"framingSettings,omitempty"` + EnvelopeSettings *X12EnvelopeSettings `json:"envelopeSettings,omitempty"` + AcknowledgementSettings *X12AcknowledgementSettings `json:"acknowledgementSettings,omitempty"` + MessageFilter *X12MessageFilter `json:"messageFilter,omitempty"` + SecuritySettings *X12SecuritySettings `json:"securitySettings,omitempty"` + ProcessingSettings *X12ProcessingSettings `json:"processingSettings,omitempty"` + EnvelopeOverrides *[]X12EnvelopeOverride `json:"envelopeOverrides,omitempty"` + ValidationOverrides *[]X12ValidationOverride `json:"validationOverrides,omitempty"` + MessageFilterList *[]X12MessageIdentifier `json:"messageFilterList,omitempty"` + SchemaReferences *[]X12SchemaReference `json:"schemaReferences,omitempty"` + X12DelimiterOverrides *[]X12DelimiterOverrides `json:"x12DelimiterOverrides,omitempty"` +} + +// X12SchemaReference is the X12 schema reference. +type X12SchemaReference struct { + MessageID *string `json:"messageId,omitempty"` + SenderApplicationID *string `json:"senderApplicationId,omitempty"` + SchemaVersion *string `json:"schemaVersion,omitempty"` + SchemaName *string `json:"schemaName,omitempty"` +} + +// X12SecuritySettings is the X12 agreement security settings. +type X12SecuritySettings struct { + AuthorizationQualifier *string `json:"authorizationQualifier,omitempty"` + AuthorizationValue *string `json:"authorizationValue,omitempty"` + SecurityQualifier *string `json:"securityQualifier,omitempty"` + PasswordValue *string `json:"passwordValue,omitempty"` +} + +// X12ValidationOverride is the X12 validation override settings. +type X12ValidationOverride struct { + MessageID *string `json:"messageId,omitempty"` + ValidateEdiTypes *bool `json:"validateEdiTypes,omitempty"` + ValidateXsdTypes *bool `json:"validateXsdTypes,omitempty"` + AllowLeadingAndTrailingSpacesAndZeroes *bool `json:"allowLeadingAndTrailingSpacesAndZeroes,omitempty"` + ValidateCharacterSet *bool `json:"validateCharacterSet,omitempty"` + TrimLeadingAndTrailingSpacesAndZeroes *bool `json:"trimLeadingAndTrailingSpacesAndZeroes,omitempty"` + TrailingSeparatorPolicy TrailingSeparatorPolicy `json:"trailingSeparatorPolicy,omitempty"` +} + +// X12ValidationSettings is the X12 agreement validation settings. +type X12ValidationSettings struct { + ValidateCharacterSet *bool `json:"validateCharacterSet,omitempty"` + CheckDuplicateInterchangeControlNumber *bool `json:"checkDuplicateInterchangeControlNumber,omitempty"` + InterchangeControlNumberValidityDays *int32 `json:"interchangeControlNumberValidityDays,omitempty"` + CheckDuplicateGroupControlNumber *bool `json:"checkDuplicateGroupControlNumber,omitempty"` + CheckDuplicateTransactionSetControlNumber *bool `json:"checkDuplicateTransactionSetControlNumber,omitempty"` + ValidateEdiTypes *bool `json:"validateEdiTypes,omitempty"` + ValidateXsdTypes *bool `json:"validateXsdTypes,omitempty"` + AllowLeadingAndTrailingSpacesAndZeroes *bool `json:"allowLeadingAndTrailingSpacesAndZeroes,omitempty"` + TrimLeadingAndTrailingSpacesAndZeroes *bool `json:"trimLeadingAndTrailingSpacesAndZeroes,omitempty"` + TrailingSeparatorPolicy TrailingSeparatorPolicy `json:"trailingSeparatorPolicy,omitempty"` +} diff --git a/arm/logic/partners.go b/arm/logic/partners.go new file mode 100755 index 000000000000..a617195a547d --- /dev/null +++ b/arm/logic/partners.go @@ -0,0 +1,343 @@ +package logic + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// 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/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// PartnersClient is the rEST API for Azure Logic Apps. +type PartnersClient struct { + ManagementClient +} + +// NewPartnersClient creates an instance of the PartnersClient client. +func NewPartnersClient(subscriptionID string) PartnersClient { + return NewPartnersClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewPartnersClientWithBaseURI creates an instance of the PartnersClient +// client. +func NewPartnersClientWithBaseURI(baseURI string, subscriptionID string) PartnersClient { + return PartnersClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates or updates an integration account partner. +// +// resourceGroupName is the resource group name. integrationAccountName is the +// integration account name. partnerName is the integration account partner +// name. partner is the integration account partner. +func (client PartnersClient) CreateOrUpdate(resourceGroupName string, integrationAccountName string, partnerName string, partner IntegrationAccountPartner) (result IntegrationAccountPartner, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: partner, + Constraints: []validation.Constraint{{Target: "partner.IntegrationAccountPartnerProperties", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "partner.IntegrationAccountPartnerProperties.Content", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "logic.PartnersClient", "CreateOrUpdate") + } + + req, err := client.CreateOrUpdatePreparer(resourceGroupName, integrationAccountName, partnerName, partner) + if err != nil { + return result, autorest.NewErrorWithError(err, "logic.PartnersClient", "CreateOrUpdate", nil, "Failure preparing request") + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "logic.PartnersClient", "CreateOrUpdate", resp, "Failure sending request") + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "logic.PartnersClient", "CreateOrUpdate", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client PartnersClient) CreateOrUpdatePreparer(resourceGroupName string, integrationAccountName string, partnerName string, partner IntegrationAccountPartner) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "integrationAccountName": autorest.Encode("path", integrationAccountName), + "partnerName": autorest.Encode("path", partnerName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/integrationAccounts/{integrationAccountName}/partners/{partnerName}", pathParameters), + autorest.WithJSON(partner), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client PartnersClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client PartnersClient) CreateOrUpdateResponder(resp *http.Response) (result IntegrationAccountPartner, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes an integration account partner. +// +// resourceGroupName is the resource group name. integrationAccountName is the +// integration account name. partnerName is the integration account partner +// name. +func (client PartnersClient) Delete(resourceGroupName string, integrationAccountName string, partnerName string) (result autorest.Response, err error) { + req, err := client.DeletePreparer(resourceGroupName, integrationAccountName, partnerName) + if err != nil { + return result, autorest.NewErrorWithError(err, "logic.PartnersClient", "Delete", nil, "Failure preparing request") + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + return result, autorest.NewErrorWithError(err, "logic.PartnersClient", "Delete", resp, "Failure sending request") + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "logic.PartnersClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client PartnersClient) DeletePreparer(resourceGroupName string, integrationAccountName string, partnerName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "integrationAccountName": autorest.Encode("path", integrationAccountName), + "partnerName": autorest.Encode("path", partnerName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-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.Logic/integrationAccounts/{integrationAccountName}/partners/{partnerName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client PartnersClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client PartnersClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets an integration account partner. +// +// resourceGroupName is the resource group name. integrationAccountName is the +// integration account name. partnerName is the integration account partner +// name. +func (client PartnersClient) Get(resourceGroupName string, integrationAccountName string, partnerName string) (result IntegrationAccountPartner, err error) { + req, err := client.GetPreparer(resourceGroupName, integrationAccountName, partnerName) + if err != nil { + return result, autorest.NewErrorWithError(err, "logic.PartnersClient", "Get", nil, "Failure preparing request") + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "logic.PartnersClient", "Get", resp, "Failure sending request") + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "logic.PartnersClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client PartnersClient) GetPreparer(resourceGroupName string, integrationAccountName string, partnerName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "integrationAccountName": autorest.Encode("path", integrationAccountName), + "partnerName": autorest.Encode("path", partnerName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-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.Logic/integrationAccounts/{integrationAccountName}/partners/{partnerName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client PartnersClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client PartnersClient) GetResponder(resp *http.Response) (result IntegrationAccountPartner, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByIntegrationAccounts gets a list of integration account partners. +// +// resourceGroupName is the resource group name. integrationAccountName is the +// integration account name. top is the number of items to be included in the +// result. filter is the filter to apply on the operation. +func (client PartnersClient) ListByIntegrationAccounts(resourceGroupName string, integrationAccountName string, top *int32, filter string) (result IntegrationAccountPartnerListResult, err error) { + req, err := client.ListByIntegrationAccountsPreparer(resourceGroupName, integrationAccountName, top, filter) + if err != nil { + return result, autorest.NewErrorWithError(err, "logic.PartnersClient", "ListByIntegrationAccounts", nil, "Failure preparing request") + } + + resp, err := client.ListByIntegrationAccountsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "logic.PartnersClient", "ListByIntegrationAccounts", resp, "Failure sending request") + } + + result, err = client.ListByIntegrationAccountsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "logic.PartnersClient", "ListByIntegrationAccounts", resp, "Failure responding to request") + } + + return +} + +// ListByIntegrationAccountsPreparer prepares the ListByIntegrationAccounts request. +func (client PartnersClient) ListByIntegrationAccountsPreparer(resourceGroupName string, integrationAccountName string, top *int32, filter string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "integrationAccountName": autorest.Encode("path", integrationAccountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + 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.Logic/integrationAccounts/{integrationAccountName}/partners", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListByIntegrationAccountsSender sends the ListByIntegrationAccounts request. The method will close the +// http.Response Body if it receives an error. +func (client PartnersClient) ListByIntegrationAccountsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListByIntegrationAccountsResponder handles the response to the ListByIntegrationAccounts request. The method always +// closes the http.Response Body. +func (client PartnersClient) ListByIntegrationAccountsResponder(resp *http.Response) (result IntegrationAccountPartnerListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByIntegrationAccountsNextResults retrieves the next set of results, if any. +func (client PartnersClient) ListByIntegrationAccountsNextResults(lastResults IntegrationAccountPartnerListResult) (result IntegrationAccountPartnerListResult, err error) { + req, err := lastResults.IntegrationAccountPartnerListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "logic.PartnersClient", "ListByIntegrationAccounts", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListByIntegrationAccountsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "logic.PartnersClient", "ListByIntegrationAccounts", resp, "Failure sending next results request") + } + + result, err = client.ListByIntegrationAccountsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "logic.PartnersClient", "ListByIntegrationAccounts", resp, "Failure responding to next results request") + } + + return +} diff --git a/arm/logic/schemas.go b/arm/logic/schemas.go new file mode 100755 index 000000000000..917ba92476fd --- /dev/null +++ b/arm/logic/schemas.go @@ -0,0 +1,339 @@ +package logic + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// 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/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// SchemasClient is the rEST API for Azure Logic Apps. +type SchemasClient struct { + ManagementClient +} + +// NewSchemasClient creates an instance of the SchemasClient client. +func NewSchemasClient(subscriptionID string) SchemasClient { + return NewSchemasClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewSchemasClientWithBaseURI creates an instance of the SchemasClient client. +func NewSchemasClientWithBaseURI(baseURI string, subscriptionID string) SchemasClient { + return SchemasClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates or updates an integration account schema. +// +// resourceGroupName is the resource group name. integrationAccountName is the +// integration account name. schemaName is the integration account schema name. +// schema is the integration account schema. +func (client SchemasClient) CreateOrUpdate(resourceGroupName string, integrationAccountName string, schemaName string, schema IntegrationAccountSchema) (result IntegrationAccountSchema, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: schema, + Constraints: []validation.Constraint{{Target: "schema.IntegrationAccountSchemaProperties", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "logic.SchemasClient", "CreateOrUpdate") + } + + req, err := client.CreateOrUpdatePreparer(resourceGroupName, integrationAccountName, schemaName, schema) + if err != nil { + return result, autorest.NewErrorWithError(err, "logic.SchemasClient", "CreateOrUpdate", nil, "Failure preparing request") + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "logic.SchemasClient", "CreateOrUpdate", resp, "Failure sending request") + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "logic.SchemasClient", "CreateOrUpdate", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client SchemasClient) CreateOrUpdatePreparer(resourceGroupName string, integrationAccountName string, schemaName string, schema IntegrationAccountSchema) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "integrationAccountName": autorest.Encode("path", integrationAccountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "schemaName": autorest.Encode("path", schemaName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/integrationAccounts/{integrationAccountName}/schemas/{schemaName}", pathParameters), + autorest.WithJSON(schema), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client SchemasClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client SchemasClient) CreateOrUpdateResponder(resp *http.Response) (result IntegrationAccountSchema, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes an integration account schema. +// +// resourceGroupName is the resource group name. integrationAccountName is the +// integration account name. schemaName is the integration account schema name. +func (client SchemasClient) Delete(resourceGroupName string, integrationAccountName string, schemaName string) (result autorest.Response, err error) { + req, err := client.DeletePreparer(resourceGroupName, integrationAccountName, schemaName) + if err != nil { + return result, autorest.NewErrorWithError(err, "logic.SchemasClient", "Delete", nil, "Failure preparing request") + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + return result, autorest.NewErrorWithError(err, "logic.SchemasClient", "Delete", resp, "Failure sending request") + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "logic.SchemasClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client SchemasClient) DeletePreparer(resourceGroupName string, integrationAccountName string, schemaName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "integrationAccountName": autorest.Encode("path", integrationAccountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "schemaName": autorest.Encode("path", schemaName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-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.Logic/integrationAccounts/{integrationAccountName}/schemas/{schemaName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client SchemasClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client SchemasClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets an integration account schema. +// +// resourceGroupName is the resource group name. integrationAccountName is the +// integration account name. schemaName is the integration account schema name. +func (client SchemasClient) Get(resourceGroupName string, integrationAccountName string, schemaName string) (result IntegrationAccountSchema, err error) { + req, err := client.GetPreparer(resourceGroupName, integrationAccountName, schemaName) + if err != nil { + return result, autorest.NewErrorWithError(err, "logic.SchemasClient", "Get", nil, "Failure preparing request") + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "logic.SchemasClient", "Get", resp, "Failure sending request") + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "logic.SchemasClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client SchemasClient) GetPreparer(resourceGroupName string, integrationAccountName string, schemaName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "integrationAccountName": autorest.Encode("path", integrationAccountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "schemaName": autorest.Encode("path", schemaName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-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.Logic/integrationAccounts/{integrationAccountName}/schemas/{schemaName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client SchemasClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client SchemasClient) GetResponder(resp *http.Response) (result IntegrationAccountSchema, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByIntegrationAccounts gets a list of integration account schemas. +// +// resourceGroupName is the resource group name. integrationAccountName is the +// integration account name. top is the number of items to be included in the +// result. filter is the filter to apply on the operation. +func (client SchemasClient) ListByIntegrationAccounts(resourceGroupName string, integrationAccountName string, top *int32, filter string) (result IntegrationAccountSchemaListResult, err error) { + req, err := client.ListByIntegrationAccountsPreparer(resourceGroupName, integrationAccountName, top, filter) + if err != nil { + return result, autorest.NewErrorWithError(err, "logic.SchemasClient", "ListByIntegrationAccounts", nil, "Failure preparing request") + } + + resp, err := client.ListByIntegrationAccountsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "logic.SchemasClient", "ListByIntegrationAccounts", resp, "Failure sending request") + } + + result, err = client.ListByIntegrationAccountsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "logic.SchemasClient", "ListByIntegrationAccounts", resp, "Failure responding to request") + } + + return +} + +// ListByIntegrationAccountsPreparer prepares the ListByIntegrationAccounts request. +func (client SchemasClient) ListByIntegrationAccountsPreparer(resourceGroupName string, integrationAccountName string, top *int32, filter string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "integrationAccountName": autorest.Encode("path", integrationAccountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + 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.Logic/integrationAccounts/{integrationAccountName}/schemas", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListByIntegrationAccountsSender sends the ListByIntegrationAccounts request. The method will close the +// http.Response Body if it receives an error. +func (client SchemasClient) ListByIntegrationAccountsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListByIntegrationAccountsResponder handles the response to the ListByIntegrationAccounts request. The method always +// closes the http.Response Body. +func (client SchemasClient) ListByIntegrationAccountsResponder(resp *http.Response) (result IntegrationAccountSchemaListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByIntegrationAccountsNextResults retrieves the next set of results, if any. +func (client SchemasClient) ListByIntegrationAccountsNextResults(lastResults IntegrationAccountSchemaListResult) (result IntegrationAccountSchemaListResult, err error) { + req, err := lastResults.IntegrationAccountSchemaListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "logic.SchemasClient", "ListByIntegrationAccounts", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListByIntegrationAccountsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "logic.SchemasClient", "ListByIntegrationAccounts", resp, "Failure sending next results request") + } + + result, err = client.ListByIntegrationAccountsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "logic.SchemasClient", "ListByIntegrationAccounts", resp, "Failure responding to next results request") + } + + return +} diff --git a/arm/logic/sessions.go b/arm/logic/sessions.go new file mode 100755 index 000000000000..9223150f1b86 --- /dev/null +++ b/arm/logic/sessions.go @@ -0,0 +1,342 @@ +package logic + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// 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/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// SessionsClient is the rEST API for Azure Logic Apps. +type SessionsClient struct { + ManagementClient +} + +// NewSessionsClient creates an instance of the SessionsClient client. +func NewSessionsClient(subscriptionID string) SessionsClient { + return NewSessionsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewSessionsClientWithBaseURI creates an instance of the SessionsClient +// client. +func NewSessionsClientWithBaseURI(baseURI string, subscriptionID string) SessionsClient { + return SessionsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates or updates an integration account session. +// +// resourceGroupName is the resource group name. integrationAccountName is the +// integration account name. sessionName is the integration account session +// name. session is the integration account session. +func (client SessionsClient) CreateOrUpdate(resourceGroupName string, integrationAccountName string, sessionName string, session IntegrationAccountSession) (result IntegrationAccountSession, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: session, + Constraints: []validation.Constraint{{Target: "session.IntegrationAccountSessionProperties", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "logic.SessionsClient", "CreateOrUpdate") + } + + req, err := client.CreateOrUpdatePreparer(resourceGroupName, integrationAccountName, sessionName, session) + if err != nil { + return result, autorest.NewErrorWithError(err, "logic.SessionsClient", "CreateOrUpdate", nil, "Failure preparing request") + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "logic.SessionsClient", "CreateOrUpdate", resp, "Failure sending request") + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "logic.SessionsClient", "CreateOrUpdate", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client SessionsClient) CreateOrUpdatePreparer(resourceGroupName string, integrationAccountName string, sessionName string, session IntegrationAccountSession) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "integrationAccountName": autorest.Encode("path", integrationAccountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "sessionName": autorest.Encode("path", sessionName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/integrationAccounts/{integrationAccountName}/sessions/{sessionName}", pathParameters), + autorest.WithJSON(session), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client SessionsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client SessionsClient) CreateOrUpdateResponder(resp *http.Response) (result IntegrationAccountSession, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes an integration account session. +// +// resourceGroupName is the resource group name. integrationAccountName is the +// integration account name. sessionName is the integration account session +// name. +func (client SessionsClient) Delete(resourceGroupName string, integrationAccountName string, sessionName string) (result autorest.Response, err error) { + req, err := client.DeletePreparer(resourceGroupName, integrationAccountName, sessionName) + if err != nil { + return result, autorest.NewErrorWithError(err, "logic.SessionsClient", "Delete", nil, "Failure preparing request") + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + return result, autorest.NewErrorWithError(err, "logic.SessionsClient", "Delete", resp, "Failure sending request") + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "logic.SessionsClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client SessionsClient) DeletePreparer(resourceGroupName string, integrationAccountName string, sessionName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "integrationAccountName": autorest.Encode("path", integrationAccountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "sessionName": autorest.Encode("path", sessionName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-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.Logic/integrationAccounts/{integrationAccountName}/sessions/{sessionName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client SessionsClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client SessionsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets an integration account session. +// +// resourceGroupName is the resource group name. integrationAccountName is the +// integration account name. sessionName is the integration account session +// name. +func (client SessionsClient) Get(resourceGroupName string, integrationAccountName string, sessionName string) (result IntegrationAccountSession, err error) { + req, err := client.GetPreparer(resourceGroupName, integrationAccountName, sessionName) + if err != nil { + return result, autorest.NewErrorWithError(err, "logic.SessionsClient", "Get", nil, "Failure preparing request") + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "logic.SessionsClient", "Get", resp, "Failure sending request") + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "logic.SessionsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client SessionsClient) GetPreparer(resourceGroupName string, integrationAccountName string, sessionName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "integrationAccountName": autorest.Encode("path", integrationAccountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "sessionName": autorest.Encode("path", sessionName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-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.Logic/integrationAccounts/{integrationAccountName}/sessions/{sessionName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client SessionsClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client SessionsClient) GetResponder(resp *http.Response) (result IntegrationAccountSession, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByIntegrationAccounts gets a list of integration account sessions. +// +// resourceGroupName is the resource group name. integrationAccountName is the +// integration account name. top is the number of items to be included in the +// result. filter is the filter to apply on the operation. +func (client SessionsClient) ListByIntegrationAccounts(resourceGroupName string, integrationAccountName string, top *int32, filter string) (result IntegrationAccountSessionListResult, err error) { + req, err := client.ListByIntegrationAccountsPreparer(resourceGroupName, integrationAccountName, top, filter) + if err != nil { + return result, autorest.NewErrorWithError(err, "logic.SessionsClient", "ListByIntegrationAccounts", nil, "Failure preparing request") + } + + resp, err := client.ListByIntegrationAccountsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "logic.SessionsClient", "ListByIntegrationAccounts", resp, "Failure sending request") + } + + result, err = client.ListByIntegrationAccountsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "logic.SessionsClient", "ListByIntegrationAccounts", resp, "Failure responding to request") + } + + return +} + +// ListByIntegrationAccountsPreparer prepares the ListByIntegrationAccounts request. +func (client SessionsClient) ListByIntegrationAccountsPreparer(resourceGroupName string, integrationAccountName string, top *int32, filter string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "integrationAccountName": autorest.Encode("path", integrationAccountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + 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.Logic/integrationAccounts/{integrationAccountName}/sessions", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListByIntegrationAccountsSender sends the ListByIntegrationAccounts request. The method will close the +// http.Response Body if it receives an error. +func (client SessionsClient) ListByIntegrationAccountsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListByIntegrationAccountsResponder handles the response to the ListByIntegrationAccounts request. The method always +// closes the http.Response Body. +func (client SessionsClient) ListByIntegrationAccountsResponder(resp *http.Response) (result IntegrationAccountSessionListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByIntegrationAccountsNextResults retrieves the next set of results, if any. +func (client SessionsClient) ListByIntegrationAccountsNextResults(lastResults IntegrationAccountSessionListResult) (result IntegrationAccountSessionListResult, err error) { + req, err := lastResults.IntegrationAccountSessionListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "logic.SessionsClient", "ListByIntegrationAccounts", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListByIntegrationAccountsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "logic.SessionsClient", "ListByIntegrationAccounts", resp, "Failure sending next results request") + } + + result, err = client.ListByIntegrationAccountsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "logic.SessionsClient", "ListByIntegrationAccounts", resp, "Failure responding to next results request") + } + + return +} diff --git a/arm/logic/version.go b/arm/logic/version.go old mode 100644 new mode 100755 index 2733ad1216c7..f92c18d9d4bb --- a/arm/logic/version.go +++ b/arm/logic/version.go @@ -18,43 +18,12 @@ package logic // Changes may cause incorrect behavior and will be lost if the code is // regenerated. -import ( - "bytes" - "fmt" - "strings" -) - -const ( - major = "8" - minor = "1" - patch = "0" - tag = "beta" - userAgentFormat = "Azure-SDK-For-Go/%s arm-%s/%s" -) - -// cached results of UserAgent and Version to prevent repeated operations. -var ( - userAgent string - version string -) - // UserAgent returns the UserAgent string to use when sending http.Requests. func UserAgent() string { - if userAgent == "" { - userAgent = fmt.Sprintf(userAgentFormat, Version(), "logic", "2016-06-01") - } - return userAgent + return "Azure-SDK-For-Go/v9.0.0-beta arm-logic/2016-06-01" } // Version returns the semantic version (see http://semver.org) of the client. func Version() string { - if version == "" { - versionBuilder := bytes.NewBufferString(fmt.Sprintf("%s.%s.%s", major, minor, patch)) - if tag != "" { - versionBuilder.WriteRune('-') - versionBuilder.WriteString(strings.TrimPrefix(tag, "-")) - } - version = string(versionBuilder.Bytes()) - } - return version + return "v9.0.0-beta" } diff --git a/arm/logic/workflowrunactions.go b/arm/logic/workflowrunactions.go old mode 100644 new mode 100755 index 41a2eaf22593..39b8daf10e52 --- a/arm/logic/workflowrunactions.go +++ b/arm/logic/workflowrunactions.go @@ -14,7 +14,7 @@ package logic // See the License for the specific language governing permissions and // limitations under the License. // -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.0 +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 // Changes may cause incorrect behavior and will be lost if the code is // regenerated. @@ -76,8 +76,9 @@ func (client WorkflowRunActionsClient) GetPreparer(resourceGroupName string, wor "workflowName": autorest.Encode("path", workflowName), } + const APIVersion = "2016-06-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -141,8 +142,9 @@ func (client WorkflowRunActionsClient) ListPreparer(resourceGroupName string, wo "workflowName": autorest.Encode("path", workflowName), } + const APIVersion = "2016-06-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } if top != nil { queryParameters["$top"] = autorest.Encode("query", *top) diff --git a/arm/logic/workflowruns.go b/arm/logic/workflowruns.go old mode 100644 new mode 100755 index f7ee10adb30f..f156b58b4e77 --- a/arm/logic/workflowruns.go +++ b/arm/logic/workflowruns.go @@ -14,7 +14,7 @@ package logic // See the License for the specific language governing permissions and // limitations under the License. // -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.0 +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 // Changes may cause incorrect behavior and will be lost if the code is // regenerated. @@ -73,8 +73,9 @@ func (client WorkflowRunsClient) CancelPreparer(resourceGroupName string, workfl "workflowName": autorest.Encode("path", workflowName), } + const APIVersion = "2016-06-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -136,8 +137,9 @@ func (client WorkflowRunsClient) GetPreparer(resourceGroupName string, workflowN "workflowName": autorest.Encode("path", workflowName), } + const APIVersion = "2016-06-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -200,8 +202,9 @@ func (client WorkflowRunsClient) ListPreparer(resourceGroupName string, workflow "workflowName": autorest.Encode("path", workflowName), } + const APIVersion = "2016-06-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } if top != nil { queryParameters["$top"] = autorest.Encode("query", *top) diff --git a/arm/logic/workflows.go b/arm/logic/workflows.go old mode 100644 new mode 100755 index 4ebd8e04baae..264bdf54e5ab --- a/arm/logic/workflows.go +++ b/arm/logic/workflows.go @@ -14,7 +14,7 @@ package logic // See the License for the specific language governing permissions and // limitations under the License. // -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.0 +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 // Changes may cause incorrect behavior and will be lost if the code is // regenerated. @@ -72,8 +72,9 @@ func (client WorkflowsClient) CreateOrUpdatePreparer(resourceGroupName string, w "workflowName": autorest.Encode("path", workflowName), } + const APIVersion = "2016-06-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -137,8 +138,9 @@ func (client WorkflowsClient) DeletePreparer(resourceGroupName string, workflowN "workflowName": autorest.Encode("path", workflowName), } + const APIVersion = "2016-06-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -199,8 +201,9 @@ func (client WorkflowsClient) DisablePreparer(resourceGroupName string, workflow "workflowName": autorest.Encode("path", workflowName), } + const APIVersion = "2016-06-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -261,8 +264,9 @@ func (client WorkflowsClient) EnablePreparer(resourceGroupName string, workflowN "workflowName": autorest.Encode("path", workflowName), } + const APIVersion = "2016-06-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -323,8 +327,9 @@ func (client WorkflowsClient) GenerateUpgradedDefinitionPreparer(resourceGroupNa "workflowName": autorest.Encode("path", workflowName), } + const APIVersion = "2016-06-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -388,8 +393,9 @@ func (client WorkflowsClient) GetPreparer(resourceGroupName string, workflowName "workflowName": autorest.Encode("path", workflowName), } + const APIVersion = "2016-06-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -450,8 +456,9 @@ func (client WorkflowsClient) ListByResourceGroupPreparer(resourceGroupName stri "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-06-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } if top != nil { queryParameters["$top"] = autorest.Encode("query", *top) @@ -541,8 +548,9 @@ func (client WorkflowsClient) ListBySubscriptionPreparer(top *int32, filter stri "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-06-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } if top != nil { queryParameters["$top"] = autorest.Encode("query", *top) @@ -634,8 +642,9 @@ func (client WorkflowsClient) UpdatePreparer(resourceGroupName string, workflowN "workflowName": autorest.Encode("path", workflowName), } + const APIVersion = "2016-06-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -701,8 +710,9 @@ func (client WorkflowsClient) ValidatePreparer(resourceGroupName string, locatio "workflowName": autorest.Encode("path", workflowName), } + const APIVersion = "2016-06-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( diff --git a/arm/logic/workflowtriggerhistories.go b/arm/logic/workflowtriggerhistories.go old mode 100644 new mode 100755 index f06be291c453..2bf8b452f85d --- a/arm/logic/workflowtriggerhistories.go +++ b/arm/logic/workflowtriggerhistories.go @@ -14,7 +14,7 @@ package logic // See the License for the specific language governing permissions and // limitations under the License. // -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.0 +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 // Changes may cause incorrect behavior and will be lost if the code is // regenerated. @@ -76,8 +76,9 @@ func (client WorkflowTriggerHistoriesClient) GetPreparer(resourceGroupName strin "workflowName": autorest.Encode("path", workflowName), } + const APIVersion = "2016-06-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -142,8 +143,9 @@ func (client WorkflowTriggerHistoriesClient) ListPreparer(resourceGroupName stri "workflowName": autorest.Encode("path", workflowName), } + const APIVersion = "2016-06-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } if top != nil { queryParameters["$top"] = autorest.Encode("query", *top) diff --git a/arm/logic/workflowtriggers.go b/arm/logic/workflowtriggers.go old mode 100644 new mode 100755 index 3588a9b8fd1b..ba30573a5deb --- a/arm/logic/workflowtriggers.go +++ b/arm/logic/workflowtriggers.go @@ -14,7 +14,7 @@ package logic // See the License for the specific language governing permissions and // limitations under the License. // -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.0 +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 // Changes may cause incorrect behavior and will be lost if the code is // regenerated. @@ -74,8 +74,9 @@ func (client WorkflowTriggersClient) GetPreparer(resourceGroupName string, workf "workflowName": autorest.Encode("path", workflowName), } + const APIVersion = "2016-06-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -138,8 +139,9 @@ func (client WorkflowTriggersClient) ListPreparer(resourceGroupName string, work "workflowName": autorest.Encode("path", workflowName), } + const APIVersion = "2016-06-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } if top != nil { queryParameters["$top"] = autorest.Encode("query", *top) @@ -232,8 +234,9 @@ func (client WorkflowTriggersClient) ListCallbackURLPreparer(resourceGroupName s "workflowName": autorest.Encode("path", workflowName), } + const APIVersion = "2016-06-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -296,8 +299,9 @@ func (client WorkflowTriggersClient) RunPreparer(resourceGroupName string, workf "workflowName": autorest.Encode("path", workflowName), } + const APIVersion = "2016-06-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( diff --git a/arm/logic/workflowversions.go b/arm/logic/workflowversions.go old mode 100644 new mode 100755 index afaf51599413..e0a00f3ad4d0 --- a/arm/logic/workflowversions.go +++ b/arm/logic/workflowversions.go @@ -14,7 +14,7 @@ package logic // See the License for the specific language governing permissions and // limitations under the License. // -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.0 +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 // Changes may cause incorrect behavior and will be lost if the code is // regenerated. @@ -74,8 +74,9 @@ func (client WorkflowVersionsClient) GetPreparer(resourceGroupName string, workf "workflowName": autorest.Encode("path", workflowName), } + const APIVersion = "2016-06-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -137,8 +138,9 @@ func (client WorkflowVersionsClient) ListPreparer(resourceGroupName string, work "workflowName": autorest.Encode("path", workflowName), } + const APIVersion = "2016-06-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } if top != nil { queryParameters["$top"] = autorest.Encode("query", *top) diff --git a/arm/machinelearning/webservices/client.go b/arm/machinelearning/webservices/client.go old mode 100644 new mode 100755 index 63b947081867..82272be96370 --- a/arm/machinelearning/webservices/client.go +++ b/arm/machinelearning/webservices/client.go @@ -32,9 +32,6 @@ import ( ) const ( - // APIVersion is the version of the Webservices - APIVersion = "2016-05-01-preview" - // DefaultBaseURI is the default URI used for the service Webservices DefaultBaseURI = "https://management.azure.com" ) @@ -43,7 +40,6 @@ const ( type ManagementClient struct { autorest.Client BaseURI string - APIVersion string SubscriptionID string } @@ -57,7 +53,6 @@ func NewWithBaseURI(baseURI string, subscriptionID string) ManagementClient { return ManagementClient{ Client: autorest.NewClientWithUserAgent(UserAgent()), BaseURI: baseURI, - APIVersion: APIVersion, SubscriptionID: subscriptionID, } } diff --git a/arm/machinelearning/webservices/models.go b/arm/machinelearning/webservices/models.go old mode 100644 new mode 100755 diff --git a/arm/machinelearning/webservices/version.go b/arm/machinelearning/webservices/version.go old mode 100644 new mode 100755 index 2d91b08ddbc5..d9568082adf6 --- a/arm/machinelearning/webservices/version.go +++ b/arm/machinelearning/webservices/version.go @@ -18,43 +18,12 @@ package webservices // Changes may cause incorrect behavior and will be lost if the code is // regenerated. -import ( - "bytes" - "fmt" - "strings" -) - -const ( - major = "8" - minor = "1" - patch = "0" - tag = "beta" - userAgentFormat = "Azure-SDK-For-Go/%s arm-%s/%s" -) - -// cached results of UserAgent and Version to prevent repeated operations. -var ( - userAgent string - version string -) - // UserAgent returns the UserAgent string to use when sending http.Requests. func UserAgent() string { - if userAgent == "" { - userAgent = fmt.Sprintf(userAgentFormat, Version(), "webservices", "2016-05-01-preview") - } - return userAgent + return "Azure-SDK-For-Go/v9.0.0-beta arm-webservices/2016-05-01-preview" } // Version returns the semantic version (see http://semver.org) of the client. func Version() string { - if version == "" { - versionBuilder := bytes.NewBufferString(fmt.Sprintf("%s.%s.%s", major, minor, patch)) - if tag != "" { - versionBuilder.WriteRune('-') - versionBuilder.WriteString(strings.TrimPrefix(tag, "-")) - } - version = string(versionBuilder.Bytes()) - } - return version + return "v9.0.0-beta" } diff --git a/arm/machinelearning/webservices/webservicesgroup.go b/arm/machinelearning/webservices/webservicesgroup.go old mode 100644 new mode 100755 index cbda1304fb8b..b2d575b56e15 --- a/arm/machinelearning/webservices/webservicesgroup.go +++ b/arm/machinelearning/webservices/webservicesgroup.go @@ -110,8 +110,9 @@ func (client GroupClient) CreateOrUpdatePreparer(resourceGroupName string, webSe "webServiceName": autorest.Encode("path", webServiceName), } + const APIVersion = "2016-05-01-preview" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -179,8 +180,9 @@ func (client GroupClient) GetPreparer(resourceGroupName string, webServiceName s "webServiceName": autorest.Encode("path", webServiceName), } + const APIVersion = "2016-05-01-preview" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -239,8 +241,9 @@ func (client GroupClient) ListPreparer(skiptoken string) (*http.Request, error) "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-05-01-preview" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } if len(skiptoken) > 0 { queryParameters["$skiptoken"] = autorest.Encode("query", skiptoken) @@ -328,8 +331,9 @@ func (client GroupClient) ListByResourceGroupPreparer(resourceGroupName string, "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-05-01-preview" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } if len(skiptoken) > 0 { queryParameters["$skiptoken"] = autorest.Encode("query", skiptoken) @@ -418,8 +422,9 @@ func (client GroupClient) ListKeysPreparer(resourceGroupName string, webServiceN "webServiceName": autorest.Encode("path", webServiceName), } + const APIVersion = "2016-05-01-preview" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -486,8 +491,9 @@ func (client GroupClient) PatchPreparer(resourceGroupName string, webServiceName "webServiceName": autorest.Encode("path", webServiceName), } + const APIVersion = "2016-05-01-preview" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -555,8 +561,9 @@ func (client GroupClient) RemovePreparer(resourceGroupName string, webServiceNam "webServiceName": autorest.Encode("path", webServiceName), } + const APIVersion = "2016-05-01-preview" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( diff --git a/arm/mediaservices/client.go b/arm/mediaservices/client.go old mode 100644 new mode 100755 index 149ace74859e..b67e498ad83b --- a/arm/mediaservices/client.go +++ b/arm/mediaservices/client.go @@ -27,9 +27,6 @@ import ( ) const ( - // APIVersion is the version of the Mediaservices - APIVersion = "2015-10-01" - // DefaultBaseURI is the default URI used for the service Mediaservices DefaultBaseURI = "https://management.azure.com" ) @@ -38,7 +35,6 @@ const ( type ManagementClient struct { autorest.Client BaseURI string - APIVersion string SubscriptionID string } @@ -52,7 +48,6 @@ func NewWithBaseURI(baseURI string, subscriptionID string) ManagementClient { return ManagementClient{ Client: autorest.NewClientWithUserAgent(UserAgent()), BaseURI: baseURI, - APIVersion: APIVersion, SubscriptionID: subscriptionID, } } diff --git a/arm/mediaservices/mediaservice.go b/arm/mediaservices/mediaservice.go old mode 100644 new mode 100755 index 917c0745c150..d44c98b9e01a --- a/arm/mediaservices/mediaservice.go +++ b/arm/mediaservices/mediaservice.go @@ -82,8 +82,9 @@ func (client Client) CheckNameAvailabilityPreparer(checkNameAvailabilityInput Ch "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2015-10-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -156,8 +157,9 @@ func (client Client) CreatePreparer(resourceGroupName string, mediaServiceName s "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2015-10-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -229,8 +231,9 @@ func (client Client) DeletePreparer(resourceGroupName string, mediaServiceName s "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2015-10-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -299,8 +302,9 @@ func (client Client) GetPreparer(resourceGroupName string, mediaServiceName stri "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2015-10-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -361,8 +365,9 @@ func (client Client) ListByResourceGroupPreparer(resourceGroupName string) (*htt "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2015-10-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -432,8 +437,9 @@ func (client Client) ListKeysPreparer(resourceGroupName string, mediaServiceName "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2015-10-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -504,8 +510,9 @@ func (client Client) RegenerateKeyPreparer(resourceGroupName string, mediaServic "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2015-10-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -582,8 +589,9 @@ func (client Client) SyncStorageKeysPreparer(resourceGroupName string, mediaServ "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2015-10-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -655,8 +663,9 @@ func (client Client) UpdatePreparer(resourceGroupName string, mediaServiceName s "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2015-10-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( diff --git a/arm/mediaservices/models.go b/arm/mediaservices/models.go old mode 100644 new mode 100755 diff --git a/arm/mediaservices/version.go b/arm/mediaservices/version.go old mode 100644 new mode 100755 index fb9e7c36db52..83cc43f3e0a1 --- a/arm/mediaservices/version.go +++ b/arm/mediaservices/version.go @@ -18,43 +18,12 @@ package mediaservices // Changes may cause incorrect behavior and will be lost if the code is // regenerated. -import ( - "bytes" - "fmt" - "strings" -) - -const ( - major = "8" - minor = "1" - patch = "0" - tag = "beta" - userAgentFormat = "Azure-SDK-For-Go/%s arm-%s/%s" -) - -// cached results of UserAgent and Version to prevent repeated operations. -var ( - userAgent string - version string -) - // UserAgent returns the UserAgent string to use when sending http.Requests. func UserAgent() string { - if userAgent == "" { - userAgent = fmt.Sprintf(userAgentFormat, Version(), "mediaservices", "2015-10-01") - } - return userAgent + return "Azure-SDK-For-Go/v9.0.0-beta arm-mediaservices/2015-10-01" } // Version returns the semantic version (see http://semver.org) of the client. func Version() string { - if version == "" { - versionBuilder := bytes.NewBufferString(fmt.Sprintf("%s.%s.%s", major, minor, patch)) - if tag != "" { - versionBuilder.WriteRune('-') - versionBuilder.WriteString(strings.TrimPrefix(tag, "-")) - } - version = string(versionBuilder.Bytes()) - } - return version + return "v9.0.0-beta" } diff --git a/arm/mobileengagement/appcollections.go b/arm/mobileengagement/appcollections.go old mode 100644 new mode 100755 index bfc373054e48..cb922ff157e8 --- a/arm/mobileengagement/appcollections.go +++ b/arm/mobileengagement/appcollections.go @@ -70,8 +70,9 @@ func (client AppCollectionsClient) CheckNameAvailabilityPreparer(parameters AppC "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2014-12-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -130,8 +131,9 @@ func (client AppCollectionsClient) ListPreparer() (*http.Request, error) { "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2014-12-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( diff --git a/arm/mobileengagement/apps.go b/arm/mobileengagement/apps.go old mode 100644 new mode 100755 index 1748f74e1405..9b2e7a8d2915 --- a/arm/mobileengagement/apps.go +++ b/arm/mobileengagement/apps.go @@ -71,8 +71,9 @@ func (client AppsClient) ListPreparer(resourceGroupName string, appCollection st "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2014-12-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( diff --git a/arm/mobileengagement/campaigns.go b/arm/mobileengagement/campaigns.go old mode 100644 new mode 100755 index 8d79d332019e..ae3ccf37f9fd --- a/arm/mobileengagement/campaigns.go +++ b/arm/mobileengagement/campaigns.go @@ -78,8 +78,9 @@ func (client CampaignsClient) ActivatePreparer(resourceGroupName string, appColl "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2014-12-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -155,8 +156,9 @@ func (client CampaignsClient) CreatePreparer(resourceGroupName string, appCollec "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2014-12-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -224,8 +226,9 @@ func (client CampaignsClient) DeletePreparer(kind CampaignKinds, id int32, resou "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2014-12-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -291,8 +294,9 @@ func (client CampaignsClient) FinishPreparer(resourceGroupName string, appCollec "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2014-12-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -359,8 +363,9 @@ func (client CampaignsClient) GetPreparer(kind CampaignKinds, id int32, resource "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2014-12-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -427,8 +432,9 @@ func (client CampaignsClient) GetByNamePreparer(resourceGroupName string, appCol "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2014-12-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -494,8 +500,9 @@ func (client CampaignsClient) GetStatisticsPreparer(kind CampaignKinds, id int32 "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2014-12-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -578,8 +585,9 @@ func (client CampaignsClient) ListPreparer(resourceGroupName string, appCollecti "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2014-12-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } if skip != nil { queryParameters["$skip"] = autorest.Encode("query", *skip) @@ -698,8 +706,9 @@ func (client CampaignsClient) PushPreparer(resourceGroupName string, appCollecti "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2014-12-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -768,8 +777,9 @@ func (client CampaignsClient) SuspendPreparer(resourceGroupName string, appColle "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2014-12-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -846,8 +856,9 @@ func (client CampaignsClient) TestNewPreparer(resourceGroupName string, appColle "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2014-12-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -923,8 +934,9 @@ func (client CampaignsClient) TestSavedPreparer(resourceGroupName string, appCol "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2014-12-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -1003,8 +1015,9 @@ func (client CampaignsClient) UpdatePreparer(kind CampaignKinds, id int32, param "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2014-12-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( diff --git a/arm/mobileengagement/client.go b/arm/mobileengagement/client.go old mode 100644 new mode 100755 index 83343cea22e4..c80e35de9170 --- a/arm/mobileengagement/client.go +++ b/arm/mobileengagement/client.go @@ -27,9 +27,6 @@ import ( ) const ( - // APIVersion is the version of the Mobileengagement - APIVersion = "2014-12-01" - // DefaultBaseURI is the default URI used for the service Mobileengagement DefaultBaseURI = "https://management.azure.com" ) @@ -38,7 +35,6 @@ const ( type ManagementClient struct { autorest.Client BaseURI string - APIVersion string SubscriptionID string } @@ -52,7 +48,6 @@ func NewWithBaseURI(baseURI string, subscriptionID string) ManagementClient { return ManagementClient{ Client: autorest.NewClientWithUserAgent(UserAgent()), BaseURI: baseURI, - APIVersion: APIVersion, SubscriptionID: subscriptionID, } } diff --git a/arm/mobileengagement/devices.go b/arm/mobileengagement/devices.go old mode 100644 new mode 100755 index b28febf841cb..c13cbd099ab3 --- a/arm/mobileengagement/devices.go +++ b/arm/mobileengagement/devices.go @@ -76,8 +76,9 @@ func (client DevicesClient) GetByDeviceIDPreparer(resourceGroupName string, appC "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2014-12-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -143,8 +144,9 @@ func (client DevicesClient) GetByUserIDPreparer(resourceGroupName string, appCol "userId": autorest.Encode("path", userID), } + const APIVersion = "2014-12-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -247,8 +249,9 @@ func (client DevicesClient) ListPreparer(resourceGroupName string, appCollection "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2014-12-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } if top != nil { queryParameters["$top"] = autorest.Encode("query", *top) @@ -353,8 +356,9 @@ func (client DevicesClient) TagByDeviceIDPreparer(resourceGroupName string, appC "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2014-12-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -428,8 +432,9 @@ func (client DevicesClient) TagByUserIDPreparer(resourceGroupName string, appCol "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2014-12-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( diff --git a/arm/mobileengagement/exporttasks.go b/arm/mobileengagement/exporttasks.go old mode 100644 new mode 100755 index 15f0cd4a0688..55dc3aefdd3f --- a/arm/mobileengagement/exporttasks.go +++ b/arm/mobileengagement/exporttasks.go @@ -82,8 +82,9 @@ func (client ExportTasksClient) CreateActivitiesTaskPreparer(resourceGroupName s "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2014-12-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -156,8 +157,9 @@ func (client ExportTasksClient) CreateCrashesTaskPreparer(resourceGroupName stri "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2014-12-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -230,8 +232,9 @@ func (client ExportTasksClient) CreateErrorsTaskPreparer(resourceGroupName strin "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2014-12-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -304,8 +307,9 @@ func (client ExportTasksClient) CreateEventsTaskPreparer(resourceGroupName strin "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2014-12-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -379,8 +383,9 @@ func (client ExportTasksClient) CreateFeedbackTaskByCampaignPreparer(resourceGro "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2014-12-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -454,8 +459,9 @@ func (client ExportTasksClient) CreateFeedbackTaskByDateRangePreparer(resourceGr "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2014-12-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -528,8 +534,9 @@ func (client ExportTasksClient) CreateJobsTaskPreparer(resourceGroupName string, "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2014-12-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -602,8 +609,9 @@ func (client ExportTasksClient) CreateSessionsTaskPreparer(resourceGroupName str "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2014-12-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -674,8 +682,9 @@ func (client ExportTasksClient) CreateTagsTaskPreparer(resourceGroupName string, "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2014-12-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -746,8 +755,9 @@ func (client ExportTasksClient) CreateTokensTaskPreparer(resourceGroupName strin "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2014-12-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -814,8 +824,9 @@ func (client ExportTasksClient) GetPreparer(resourceGroupName string, appCollect "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2014-12-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -906,8 +917,9 @@ func (client ExportTasksClient) ListPreparer(resourceGroupName string, appCollec "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2014-12-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } if skip != nil { queryParameters["$skip"] = autorest.Encode("query", *skip) diff --git a/arm/mobileengagement/importtasks.go b/arm/mobileengagement/importtasks.go old mode 100644 new mode 100755 index fdcbb2e23135..58269e8125bb --- a/arm/mobileengagement/importtasks.go +++ b/arm/mobileengagement/importtasks.go @@ -74,8 +74,9 @@ func (client ImportTasksClient) CreatePreparer(resourceGroupName string, appColl "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2014-12-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -143,8 +144,9 @@ func (client ImportTasksClient) GetPreparer(id string, resourceGroupName string, "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2014-12-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -235,8 +237,9 @@ func (client ImportTasksClient) ListPreparer(resourceGroupName string, appCollec "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2014-12-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } if skip != nil { queryParameters["$skip"] = autorest.Encode("query", *skip) diff --git a/arm/mobileengagement/models.go b/arm/mobileengagement/models.go old mode 100644 new mode 100755 diff --git a/arm/mobileengagement/supportedplatforms.go b/arm/mobileengagement/supportedplatforms.go old mode 100644 new mode 100755 index 155876da519c..a6ae0092c966 --- a/arm/mobileengagement/supportedplatforms.go +++ b/arm/mobileengagement/supportedplatforms.go @@ -68,8 +68,9 @@ func (client SupportedPlatformsClient) ListPreparer() (*http.Request, error) { "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2014-12-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( diff --git a/arm/mobileengagement/version.go b/arm/mobileengagement/version.go old mode 100644 new mode 100755 index 89b488465314..6172044da033 --- a/arm/mobileengagement/version.go +++ b/arm/mobileengagement/version.go @@ -18,43 +18,12 @@ package mobileengagement // Changes may cause incorrect behavior and will be lost if the code is // regenerated. -import ( - "bytes" - "fmt" - "strings" -) - -const ( - major = "8" - minor = "1" - patch = "0" - tag = "beta" - userAgentFormat = "Azure-SDK-For-Go/%s arm-%s/%s" -) - -// cached results of UserAgent and Version to prevent repeated operations. -var ( - userAgent string - version string -) - // UserAgent returns the UserAgent string to use when sending http.Requests. func UserAgent() string { - if userAgent == "" { - userAgent = fmt.Sprintf(userAgentFormat, Version(), "mobileengagement", "2014-12-01") - } - return userAgent + return "Azure-SDK-For-Go/v9.0.0-beta arm-mobileengagement/2014-12-01" } // Version returns the semantic version (see http://semver.org) of the client. func Version() string { - if version == "" { - versionBuilder := bytes.NewBufferString(fmt.Sprintf("%s.%s.%s", major, minor, patch)) - if tag != "" { - versionBuilder.WriteRune('-') - versionBuilder.WriteString(strings.TrimPrefix(tag, "-")) - } - version = string(versionBuilder.Bytes()) - } - return version + return "v9.0.0-beta" } diff --git a/arm/notificationhubs/client.go b/arm/notificationhubs/client.go old mode 100644 new mode 100755 index dc90018c3248..abab25635af1 --- a/arm/notificationhubs/client.go +++ b/arm/notificationhubs/client.go @@ -18,7 +18,7 @@ package notificationhubs // See the License for the specific language governing permissions and // limitations under the License. // -// Code generated by Microsoft (R) AutoRest Code Generator 0.17.0.0 +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 // Changes may cause incorrect behavior and will be lost if the code is // regenerated. @@ -27,9 +27,6 @@ import ( ) const ( - // APIVersion is the version of the Notificationhubs - APIVersion = "2016-03-01" - // DefaultBaseURI is the default URI used for the service Notificationhubs DefaultBaseURI = "https://management.azure.com" ) @@ -38,7 +35,6 @@ const ( type ManagementClient struct { autorest.Client BaseURI string - APIVersion string SubscriptionID string } @@ -52,7 +48,6 @@ func NewWithBaseURI(baseURI string, subscriptionID string) ManagementClient { return ManagementClient{ Client: autorest.NewClientWithUserAgent(UserAgent()), BaseURI: baseURI, - APIVersion: APIVersion, SubscriptionID: subscriptionID, } } diff --git a/arm/notificationhubs/models.go b/arm/notificationhubs/models.go old mode 100644 new mode 100755 index 4e49e1312264..909139764af9 --- a/arm/notificationhubs/models.go +++ b/arm/notificationhubs/models.go @@ -14,7 +14,7 @@ package notificationhubs // See the License for the specific language governing permissions and // limitations under the License. // -// Code generated by Microsoft (R) AutoRest Code Generator 0.17.0.0 +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 // Changes may cause incorrect behavior and will be lost if the code is // regenerated. @@ -121,6 +121,18 @@ type CheckAvailabilityResult struct { IsAvailiable *bool `json:"isAvailiable,omitempty"` } +// CreateOrUpdateParameters is parameters supplied to the CreateOrUpdate +// NotificationHub operation. +type CreateOrUpdateParameters struct { + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Location *string `json:"location,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + Sku *Sku `json:"sku,omitempty"` + *Properties `json:"properties,omitempty"` +} + // GcmCredential is description of a NotificationHub GcmCredential. type GcmCredential struct { *GcmCredentialProperties `json:"properties,omitempty"` @@ -132,6 +144,25 @@ type GcmCredentialProperties struct { GoogleAPIKey *string `json:"googleApiKey,omitempty"` } +// ListResult is the response of the List NotificationHub operation. +type ListResult struct { + autorest.Response `json:"-"` + Value *[]ResourceType `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// ListResultPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client ListResult) ListResultPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + // MpnsCredential is description of a NotificationHub MpnsCredential. type MpnsCredential struct { *MpnsCredentialProperties `json:"properties,omitempty"` @@ -209,63 +240,6 @@ type NamespaceResource struct { *NamespaceProperties `json:"properties,omitempty"` } -// NotificationHubCreateOrUpdateParameters is parameters supplied to the -// CreateOrUpdate NotificationHub operation. -type NotificationHubCreateOrUpdateParameters struct { - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - Sku *Sku `json:"sku,omitempty"` - *NotificationHubProperties `json:"properties,omitempty"` -} - -// NotificationHubListResult is the response of the List NotificationHub -// operation. -type NotificationHubListResult struct { - autorest.Response `json:"-"` - Value *[]NotificationHubResource `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// NotificationHubListResultPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client NotificationHubListResult) NotificationHubListResultPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// NotificationHubProperties is notificationHub properties. -type NotificationHubProperties struct { - Name *string `json:"name,omitempty"` - RegistrationTTL *string `json:"registrationTtl,omitempty"` - AuthorizationRules *[]SharedAccessAuthorizationRuleProperties `json:"authorizationRules,omitempty"` - ApnsCredential *ApnsCredential `json:"apnsCredential,omitempty"` - WnsCredential *WnsCredential `json:"wnsCredential,omitempty"` - GcmCredential *GcmCredential `json:"gcmCredential,omitempty"` - MpnsCredential *MpnsCredential `json:"mpnsCredential,omitempty"` - AdmCredential *AdmCredential `json:"admCredential,omitempty"` - BaiduCredential *BaiduCredential `json:"baiduCredential,omitempty"` -} - -// NotificationHubResource is description of a NotificationHub Resource. -type NotificationHubResource struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - Sku *Sku `json:"sku,omitempty"` - *NotificationHubProperties `json:"properties,omitempty"` -} - // PnsCredentialsProperties is description of a NotificationHub PNS // Credentials. type PnsCredentialsProperties struct { @@ -294,6 +268,19 @@ type PolicykeyResource struct { PolicyKey *string `json:"policyKey,omitempty"` } +// Properties is notificationHub properties. +type Properties struct { + Name *string `json:"name,omitempty"` + RegistrationTTL *string `json:"registrationTtl,omitempty"` + AuthorizationRules *[]SharedAccessAuthorizationRuleProperties `json:"authorizationRules,omitempty"` + ApnsCredential *ApnsCredential `json:"apnsCredential,omitempty"` + WnsCredential *WnsCredential `json:"wnsCredential,omitempty"` + GcmCredential *GcmCredential `json:"gcmCredential,omitempty"` + MpnsCredential *MpnsCredential `json:"mpnsCredential,omitempty"` + AdmCredential *AdmCredential `json:"admCredential,omitempty"` + BaiduCredential *BaiduCredential `json:"baiduCredential,omitempty"` +} + // Resource is type Resource struct { ID *string `json:"id,omitempty"` @@ -314,8 +301,20 @@ type ResourceListKeys struct { KeyName *string `json:"keyName,omitempty"` } -// SharedAccessAuthorizationRuleCreateOrUpdateParameters is parameters -// supplied to the CreateOrUpdate Namespace AuthorizationRules. +// ResourceType is description of a NotificationHub Resource. +type ResourceType struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Location *string `json:"location,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + Sku *Sku `json:"sku,omitempty"` + *Properties `json:"properties,omitempty"` +} + +// SharedAccessAuthorizationRuleCreateOrUpdateParameters is parameters supplied +// to the CreateOrUpdate Namespace AuthorizationRules. type SharedAccessAuthorizationRuleCreateOrUpdateParameters struct { ID *string `json:"id,omitempty"` Name *string `json:"name,omitempty"` diff --git a/arm/notificationhubs/namespaces.go b/arm/notificationhubs/namespaces.go old mode 100644 new mode 100755 index c6b1a316078e..bf49d368fed6 --- a/arm/notificationhubs/namespaces.go +++ b/arm/notificationhubs/namespaces.go @@ -14,7 +14,7 @@ package notificationhubs // See the License for the specific language governing permissions and // limitations under the License. // -// Code generated by Microsoft (R) AutoRest Code Generator 0.17.0.0 +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 // Changes may cause incorrect behavior and will be lost if the code is // regenerated. @@ -79,8 +79,9 @@ func (client NamespacesClient) CheckAvailabilityPreparer(parameters CheckAvailab "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-03-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -146,8 +147,9 @@ func (client NamespacesClient) CreateOrUpdatePreparer(resourceGroupName string, "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-03-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -220,8 +222,9 @@ func (client NamespacesClient) CreateOrUpdateAuthorizationRulePreparer(resourceG "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-03-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -255,9 +258,9 @@ func (client NamespacesClient) CreateOrUpdateAuthorizationRuleResponder(resp *ht // Delete deletes an existing namespace. This operation also removes all // associated notificationHubs under the namespace. This method may poll for -// completion. Polling can be canceled by passing the cancel channel -// argument. The channel will be used to cancel polling and any outstanding -// HTTP requests. +// completion. Polling can be canceled by passing the cancel channel argument. +// The channel will be used to cancel polling and any outstanding HTTP +// requests. // // resourceGroupName is the name of the resource group. namespaceName is the // namespace name. @@ -289,8 +292,9 @@ func (client NamespacesClient) DeletePreparer(resourceGroupName string, namespac "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-03-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -354,8 +358,9 @@ func (client NamespacesClient) DeleteAuthorizationRulePreparer(resourceGroupName "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-03-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -416,8 +421,9 @@ func (client NamespacesClient) GetPreparer(resourceGroupName string, namespaceNa "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-03-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -480,8 +486,9 @@ func (client NamespacesClient) GetAuthorizationRulePreparer(resourceGroupName st "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-03-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -542,8 +549,9 @@ func (client NamespacesClient) ListPreparer(resourceGroupName string) (*http.Req "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-03-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -625,8 +633,9 @@ func (client NamespacesClient) ListAllPreparer() (*http.Request, error) { "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-03-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -712,8 +721,9 @@ func (client NamespacesClient) ListAuthorizationRulesPreparer(resourceGroupName "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-03-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -801,8 +811,9 @@ func (client NamespacesClient) ListKeysPreparer(resourceGroupName string, namesp "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-03-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -865,8 +876,9 @@ func (client NamespacesClient) PatchPreparer(resourceGroupName string, namespace "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-03-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -934,8 +946,9 @@ func (client NamespacesClient) RegenerateKeysPreparer(resourceGroupName string, "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-03-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( diff --git a/arm/notificationhubs/notificationhubs.go b/arm/notificationhubs/notificationhubsgroup.go old mode 100644 new mode 100755 similarity index 70% rename from arm/notificationhubs/notificationhubs.go rename to arm/notificationhubs/notificationhubsgroup.go index 309eaf0a7331..9cc024e0d4e8 --- a/arm/notificationhubs/notificationhubs.go +++ b/arm/notificationhubs/notificationhubsgroup.go @@ -14,7 +14,7 @@ package notificationhubs // See the License for the specific language governing permissions and // limitations under the License. // -// Code generated by Microsoft (R) AutoRest Code Generator 0.17.0.0 +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 // Changes may cause incorrect behavior and will be lost if the code is // regenerated. @@ -25,19 +25,19 @@ import ( "net/http" ) -// Client is the azure NotificationHub client -type Client struct { +// GroupClient is the azure NotificationHub client +type GroupClient struct { ManagementClient } -// NewClient creates an instance of the Client client. -func NewClient(subscriptionID string) Client { - return NewClientWithBaseURI(DefaultBaseURI, subscriptionID) +// NewGroupClient creates an instance of the GroupClient client. +func NewGroupClient(subscriptionID string) GroupClient { + return NewGroupClientWithBaseURI(DefaultBaseURI, subscriptionID) } -// NewClientWithBaseURI creates an instance of the Client client. -func NewClientWithBaseURI(baseURI string, subscriptionID string) Client { - return Client{NewWithBaseURI(baseURI, subscriptionID)} +// NewGroupClientWithBaseURI creates an instance of the GroupClient client. +func NewGroupClientWithBaseURI(baseURI string, subscriptionID string) GroupClient { + return GroupClient{NewWithBaseURI(baseURI, subscriptionID)} } // CheckAvailability checks the availability of the given notificationHub in a @@ -45,43 +45,44 @@ func NewClientWithBaseURI(baseURI string, subscriptionID string) Client { // // resourceGroupName is the name of the resource group. namespaceName is the // namespace name. parameters is the notificationHub name. -func (client Client) CheckAvailability(resourceGroupName string, namespaceName string, parameters CheckAvailabilityParameters) (result CheckAvailabilityResult, err error) { +func (client GroupClient) CheckAvailability(resourceGroupName string, namespaceName string, parameters CheckAvailabilityParameters) (result CheckAvailabilityResult, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: parameters, Constraints: []validation.Constraint{{Target: "parameters.Name", Name: validation.Null, Rule: true, Chain: nil}, {Target: "parameters.Location", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "notificationhubs.Client", "CheckAvailability") + return result, validation.NewErrorWithValidationError(err, "notificationhubs.GroupClient", "CheckAvailability") } req, err := client.CheckAvailabilityPreparer(resourceGroupName, namespaceName, parameters) if err != nil { - return result, autorest.NewErrorWithError(err, "notificationhubs.Client", "CheckAvailability", nil, "Failure preparing request") + return result, autorest.NewErrorWithError(err, "notificationhubs.GroupClient", "CheckAvailability", nil, "Failure preparing request") } resp, err := client.CheckAvailabilitySender(req) if err != nil { result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "notificationhubs.Client", "CheckAvailability", resp, "Failure sending request") + return result, autorest.NewErrorWithError(err, "notificationhubs.GroupClient", "CheckAvailability", resp, "Failure sending request") } result, err = client.CheckAvailabilityResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "notificationhubs.Client", "CheckAvailability", resp, "Failure responding to request") + err = autorest.NewErrorWithError(err, "notificationhubs.GroupClient", "CheckAvailability", resp, "Failure responding to request") } return } // CheckAvailabilityPreparer prepares the CheckAvailability request. -func (client Client) CheckAvailabilityPreparer(resourceGroupName string, namespaceName string, parameters CheckAvailabilityParameters) (*http.Request, error) { +func (client GroupClient) CheckAvailabilityPreparer(resourceGroupName string, namespaceName string, parameters CheckAvailabilityParameters) (*http.Request, error) { pathParameters := map[string]interface{}{ "namespaceName": autorest.Encode("path", namespaceName), "resourceGroupName": autorest.Encode("path", resourceGroupName), "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-03-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -96,13 +97,13 @@ func (client Client) CheckAvailabilityPreparer(resourceGroupName string, namespa // CheckAvailabilitySender sends the CheckAvailability request. The method will close the // http.Response Body if it receives an error. -func (client Client) CheckAvailabilitySender(req *http.Request) (*http.Response, error) { +func (client GroupClient) CheckAvailabilitySender(req *http.Request) (*http.Response, error) { return autorest.SendWithSender(client, req) } // CheckAvailabilityResponder handles the response to the CheckAvailability request. The method always // closes the http.Response Body. -func (client Client) CheckAvailabilityResponder(resp *http.Response) (result CheckAvailabilityResult, err error) { +func (client GroupClient) CheckAvailabilityResponder(resp *http.Response) (result CheckAvailabilityResult, err error) { err = autorest.Respond( resp, client.ByInspecting(), @@ -116,37 +117,36 @@ func (client Client) CheckAvailabilityResponder(resp *http.Response) (result Che // CreateOrUpdate creates/Update a NotificationHub in a namespace. // // resourceGroupName is the name of the resource group. namespaceName is the -// namespace name. notificationHubName is the notification hub name. -// parameters is parameters supplied to the create/update a NotificationHub -// Resource. -func (client Client) CreateOrUpdate(resourceGroupName string, namespaceName string, notificationHubName string, parameters NotificationHubCreateOrUpdateParameters) (result NotificationHubResource, err error) { +// namespace name. notificationHubName is the notification hub name. parameters +// is parameters supplied to the create/update a NotificationHub Resource. +func (client GroupClient) CreateOrUpdate(resourceGroupName string, namespaceName string, notificationHubName string, parameters CreateOrUpdateParameters) (result ResourceType, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.NotificationHubProperties", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "notificationhubs.Client", "CreateOrUpdate") + Constraints: []validation.Constraint{{Target: "parameters.Properties", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "notificationhubs.GroupClient", "CreateOrUpdate") } req, err := client.CreateOrUpdatePreparer(resourceGroupName, namespaceName, notificationHubName, parameters) if err != nil { - return result, autorest.NewErrorWithError(err, "notificationhubs.Client", "CreateOrUpdate", nil, "Failure preparing request") + return result, autorest.NewErrorWithError(err, "notificationhubs.GroupClient", "CreateOrUpdate", nil, "Failure preparing request") } resp, err := client.CreateOrUpdateSender(req) if err != nil { result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "notificationhubs.Client", "CreateOrUpdate", resp, "Failure sending request") + return result, autorest.NewErrorWithError(err, "notificationhubs.GroupClient", "CreateOrUpdate", resp, "Failure sending request") } result, err = client.CreateOrUpdateResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "notificationhubs.Client", "CreateOrUpdate", resp, "Failure responding to request") + err = autorest.NewErrorWithError(err, "notificationhubs.GroupClient", "CreateOrUpdate", resp, "Failure responding to request") } return } // CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client Client) CreateOrUpdatePreparer(resourceGroupName string, namespaceName string, notificationHubName string, parameters NotificationHubCreateOrUpdateParameters) (*http.Request, error) { +func (client GroupClient) CreateOrUpdatePreparer(resourceGroupName string, namespaceName string, notificationHubName string, parameters CreateOrUpdateParameters) (*http.Request, error) { pathParameters := map[string]interface{}{ "namespaceName": autorest.Encode("path", namespaceName), "notificationHubName": autorest.Encode("path", notificationHubName), @@ -154,8 +154,9 @@ func (client Client) CreateOrUpdatePreparer(resourceGroupName string, namespaceN "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-03-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -170,13 +171,13 @@ func (client Client) CreateOrUpdatePreparer(resourceGroupName string, namespaceN // CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the // http.Response Body if it receives an error. -func (client Client) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { +func (client GroupClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { return autorest.SendWithSender(client, req) } // CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always // closes the http.Response Body. -func (client Client) CreateOrUpdateResponder(resp *http.Response) (result NotificationHubResource, err error) { +func (client GroupClient) CreateOrUpdateResponder(resp *http.Response) (result ResourceType, err error) { err = autorest.Respond( resp, client.ByInspecting(), @@ -194,34 +195,34 @@ func (client Client) CreateOrUpdateResponder(resp *http.Response) (result Notifi // namespace name. notificationHubName is the notification hub name. // authorizationRuleName is authorization Rule Name. parameters is the shared // access authorization rule. -func (client Client) CreateOrUpdateAuthorizationRule(resourceGroupName string, namespaceName string, notificationHubName string, authorizationRuleName string, parameters SharedAccessAuthorizationRuleCreateOrUpdateParameters) (result SharedAccessAuthorizationRuleResource, err error) { +func (client GroupClient) CreateOrUpdateAuthorizationRule(resourceGroupName string, namespaceName string, notificationHubName string, authorizationRuleName string, parameters SharedAccessAuthorizationRuleCreateOrUpdateParameters) (result SharedAccessAuthorizationRuleResource, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: parameters, Constraints: []validation.Constraint{{Target: "parameters.Properties", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "notificationhubs.Client", "CreateOrUpdateAuthorizationRule") + return result, validation.NewErrorWithValidationError(err, "notificationhubs.GroupClient", "CreateOrUpdateAuthorizationRule") } req, err := client.CreateOrUpdateAuthorizationRulePreparer(resourceGroupName, namespaceName, notificationHubName, authorizationRuleName, parameters) if err != nil { - return result, autorest.NewErrorWithError(err, "notificationhubs.Client", "CreateOrUpdateAuthorizationRule", nil, "Failure preparing request") + return result, autorest.NewErrorWithError(err, "notificationhubs.GroupClient", "CreateOrUpdateAuthorizationRule", nil, "Failure preparing request") } resp, err := client.CreateOrUpdateAuthorizationRuleSender(req) if err != nil { result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "notificationhubs.Client", "CreateOrUpdateAuthorizationRule", resp, "Failure sending request") + return result, autorest.NewErrorWithError(err, "notificationhubs.GroupClient", "CreateOrUpdateAuthorizationRule", resp, "Failure sending request") } result, err = client.CreateOrUpdateAuthorizationRuleResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "notificationhubs.Client", "CreateOrUpdateAuthorizationRule", resp, "Failure responding to request") + err = autorest.NewErrorWithError(err, "notificationhubs.GroupClient", "CreateOrUpdateAuthorizationRule", resp, "Failure responding to request") } return } // CreateOrUpdateAuthorizationRulePreparer prepares the CreateOrUpdateAuthorizationRule request. -func (client Client) CreateOrUpdateAuthorizationRulePreparer(resourceGroupName string, namespaceName string, notificationHubName string, authorizationRuleName string, parameters SharedAccessAuthorizationRuleCreateOrUpdateParameters) (*http.Request, error) { +func (client GroupClient) CreateOrUpdateAuthorizationRulePreparer(resourceGroupName string, namespaceName string, notificationHubName string, authorizationRuleName string, parameters SharedAccessAuthorizationRuleCreateOrUpdateParameters) (*http.Request, error) { pathParameters := map[string]interface{}{ "authorizationRuleName": autorest.Encode("path", authorizationRuleName), "namespaceName": autorest.Encode("path", namespaceName), @@ -230,8 +231,9 @@ func (client Client) CreateOrUpdateAuthorizationRulePreparer(resourceGroupName s "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-03-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -246,13 +248,13 @@ func (client Client) CreateOrUpdateAuthorizationRulePreparer(resourceGroupName s // CreateOrUpdateAuthorizationRuleSender sends the CreateOrUpdateAuthorizationRule request. The method will close the // http.Response Body if it receives an error. -func (client Client) CreateOrUpdateAuthorizationRuleSender(req *http.Request) (*http.Response, error) { +func (client GroupClient) CreateOrUpdateAuthorizationRuleSender(req *http.Request) (*http.Response, error) { return autorest.SendWithSender(client, req) } // CreateOrUpdateAuthorizationRuleResponder handles the response to the CreateOrUpdateAuthorizationRule request. The method always // closes the http.Response Body. -func (client Client) CreateOrUpdateAuthorizationRuleResponder(resp *http.Response) (result SharedAccessAuthorizationRuleResource, err error) { +func (client GroupClient) CreateOrUpdateAuthorizationRuleResponder(resp *http.Response) (result SharedAccessAuthorizationRuleResource, err error) { err = autorest.Respond( resp, client.ByInspecting(), @@ -267,28 +269,28 @@ func (client Client) CreateOrUpdateAuthorizationRuleResponder(resp *http.Respons // // resourceGroupName is the name of the resource group. namespaceName is the // namespace name. notificationHubName is the notification hub name. -func (client Client) Delete(resourceGroupName string, namespaceName string, notificationHubName string) (result autorest.Response, err error) { +func (client GroupClient) Delete(resourceGroupName string, namespaceName string, notificationHubName string) (result autorest.Response, err error) { req, err := client.DeletePreparer(resourceGroupName, namespaceName, notificationHubName) if err != nil { - return result, autorest.NewErrorWithError(err, "notificationhubs.Client", "Delete", nil, "Failure preparing request") + return result, autorest.NewErrorWithError(err, "notificationhubs.GroupClient", "Delete", nil, "Failure preparing request") } resp, err := client.DeleteSender(req) if err != nil { result.Response = resp - return result, autorest.NewErrorWithError(err, "notificationhubs.Client", "Delete", resp, "Failure sending request") + return result, autorest.NewErrorWithError(err, "notificationhubs.GroupClient", "Delete", resp, "Failure sending request") } result, err = client.DeleteResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "notificationhubs.Client", "Delete", resp, "Failure responding to request") + err = autorest.NewErrorWithError(err, "notificationhubs.GroupClient", "Delete", resp, "Failure responding to request") } return } // DeletePreparer prepares the Delete request. -func (client Client) DeletePreparer(resourceGroupName string, namespaceName string, notificationHubName string) (*http.Request, error) { +func (client GroupClient) DeletePreparer(resourceGroupName string, namespaceName string, notificationHubName string) (*http.Request, error) { pathParameters := map[string]interface{}{ "namespaceName": autorest.Encode("path", namespaceName), "notificationHubName": autorest.Encode("path", notificationHubName), @@ -296,8 +298,9 @@ func (client Client) DeletePreparer(resourceGroupName string, namespaceName stri "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-03-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -310,13 +313,13 @@ func (client Client) DeletePreparer(resourceGroupName string, namespaceName stri // DeleteSender sends the Delete request. The method will close the // http.Response Body if it receives an error. -func (client Client) DeleteSender(req *http.Request) (*http.Response, error) { +func (client GroupClient) DeleteSender(req *http.Request) (*http.Response, error) { return autorest.SendWithSender(client, req) } // DeleteResponder handles the response to the Delete request. The method always // closes the http.Response Body. -func (client Client) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { +func (client GroupClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { err = autorest.Respond( resp, client.ByInspecting(), @@ -331,28 +334,28 @@ func (client Client) DeleteResponder(resp *http.Response) (result autorest.Respo // resourceGroupName is the name of the resource group. namespaceName is the // namespace name. notificationHubName is the notification hub name. // authorizationRuleName is authorization Rule Name. -func (client Client) DeleteAuthorizationRule(resourceGroupName string, namespaceName string, notificationHubName string, authorizationRuleName string) (result autorest.Response, err error) { +func (client GroupClient) DeleteAuthorizationRule(resourceGroupName string, namespaceName string, notificationHubName string, authorizationRuleName string) (result autorest.Response, err error) { req, err := client.DeleteAuthorizationRulePreparer(resourceGroupName, namespaceName, notificationHubName, authorizationRuleName) if err != nil { - return result, autorest.NewErrorWithError(err, "notificationhubs.Client", "DeleteAuthorizationRule", nil, "Failure preparing request") + return result, autorest.NewErrorWithError(err, "notificationhubs.GroupClient", "DeleteAuthorizationRule", nil, "Failure preparing request") } resp, err := client.DeleteAuthorizationRuleSender(req) if err != nil { result.Response = resp - return result, autorest.NewErrorWithError(err, "notificationhubs.Client", "DeleteAuthorizationRule", resp, "Failure sending request") + return result, autorest.NewErrorWithError(err, "notificationhubs.GroupClient", "DeleteAuthorizationRule", resp, "Failure sending request") } result, err = client.DeleteAuthorizationRuleResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "notificationhubs.Client", "DeleteAuthorizationRule", resp, "Failure responding to request") + err = autorest.NewErrorWithError(err, "notificationhubs.GroupClient", "DeleteAuthorizationRule", resp, "Failure responding to request") } return } // DeleteAuthorizationRulePreparer prepares the DeleteAuthorizationRule request. -func (client Client) DeleteAuthorizationRulePreparer(resourceGroupName string, namespaceName string, notificationHubName string, authorizationRuleName string) (*http.Request, error) { +func (client GroupClient) DeleteAuthorizationRulePreparer(resourceGroupName string, namespaceName string, notificationHubName string, authorizationRuleName string) (*http.Request, error) { pathParameters := map[string]interface{}{ "authorizationRuleName": autorest.Encode("path", authorizationRuleName), "namespaceName": autorest.Encode("path", namespaceName), @@ -361,8 +364,9 @@ func (client Client) DeleteAuthorizationRulePreparer(resourceGroupName string, n "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-03-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -375,13 +379,13 @@ func (client Client) DeleteAuthorizationRulePreparer(resourceGroupName string, n // DeleteAuthorizationRuleSender sends the DeleteAuthorizationRule request. The method will close the // http.Response Body if it receives an error. -func (client Client) DeleteAuthorizationRuleSender(req *http.Request) (*http.Response, error) { +func (client GroupClient) DeleteAuthorizationRuleSender(req *http.Request) (*http.Response, error) { return autorest.SendWithSender(client, req) } // DeleteAuthorizationRuleResponder handles the response to the DeleteAuthorizationRule request. The method always // closes the http.Response Body. -func (client Client) DeleteAuthorizationRuleResponder(resp *http.Response) (result autorest.Response, err error) { +func (client GroupClient) DeleteAuthorizationRuleResponder(resp *http.Response) (result autorest.Response, err error) { err = autorest.Respond( resp, client.ByInspecting(), @@ -395,28 +399,28 @@ func (client Client) DeleteAuthorizationRuleResponder(resp *http.Response) (resu // // resourceGroupName is the name of the resource group. namespaceName is the // namespace name. notificationHubName is the notification hub name. -func (client Client) Get(resourceGroupName string, namespaceName string, notificationHubName string) (result NotificationHubResource, err error) { +func (client GroupClient) Get(resourceGroupName string, namespaceName string, notificationHubName string) (result ResourceType, err error) { req, err := client.GetPreparer(resourceGroupName, namespaceName, notificationHubName) if err != nil { - return result, autorest.NewErrorWithError(err, "notificationhubs.Client", "Get", nil, "Failure preparing request") + return result, autorest.NewErrorWithError(err, "notificationhubs.GroupClient", "Get", nil, "Failure preparing request") } resp, err := client.GetSender(req) if err != nil { result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "notificationhubs.Client", "Get", resp, "Failure sending request") + return result, autorest.NewErrorWithError(err, "notificationhubs.GroupClient", "Get", resp, "Failure sending request") } result, err = client.GetResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "notificationhubs.Client", "Get", resp, "Failure responding to request") + err = autorest.NewErrorWithError(err, "notificationhubs.GroupClient", "Get", resp, "Failure responding to request") } return } // GetPreparer prepares the Get request. -func (client Client) GetPreparer(resourceGroupName string, namespaceName string, notificationHubName string) (*http.Request, error) { +func (client GroupClient) GetPreparer(resourceGroupName string, namespaceName string, notificationHubName string) (*http.Request, error) { pathParameters := map[string]interface{}{ "namespaceName": autorest.Encode("path", namespaceName), "notificationHubName": autorest.Encode("path", notificationHubName), @@ -424,8 +428,9 @@ func (client Client) GetPreparer(resourceGroupName string, namespaceName string, "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-03-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -438,13 +443,13 @@ func (client Client) GetPreparer(resourceGroupName string, namespaceName string, // GetSender sends the Get request. The method will close the // http.Response Body if it receives an error. -func (client Client) GetSender(req *http.Request) (*http.Response, error) { +func (client GroupClient) GetSender(req *http.Request) (*http.Response, error) { return autorest.SendWithSender(client, req) } // GetResponder handles the response to the Get request. The method always // closes the http.Response Body. -func (client Client) GetResponder(resp *http.Response) (result NotificationHubResource, err error) { +func (client GroupClient) GetResponder(resp *http.Response) (result ResourceType, err error) { err = autorest.Respond( resp, client.ByInspecting(), @@ -461,28 +466,28 @@ func (client Client) GetResponder(resp *http.Response) (result NotificationHubRe // resourceGroupName is the name of the resource group. namespaceName is the // namespace name notificationHubName is the notification hub name. // authorizationRuleName is authorization rule name. -func (client Client) GetAuthorizationRule(resourceGroupName string, namespaceName string, notificationHubName string, authorizationRuleName string) (result SharedAccessAuthorizationRuleResource, err error) { +func (client GroupClient) GetAuthorizationRule(resourceGroupName string, namespaceName string, notificationHubName string, authorizationRuleName string) (result SharedAccessAuthorizationRuleResource, err error) { req, err := client.GetAuthorizationRulePreparer(resourceGroupName, namespaceName, notificationHubName, authorizationRuleName) if err != nil { - return result, autorest.NewErrorWithError(err, "notificationhubs.Client", "GetAuthorizationRule", nil, "Failure preparing request") + return result, autorest.NewErrorWithError(err, "notificationhubs.GroupClient", "GetAuthorizationRule", nil, "Failure preparing request") } resp, err := client.GetAuthorizationRuleSender(req) if err != nil { result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "notificationhubs.Client", "GetAuthorizationRule", resp, "Failure sending request") + return result, autorest.NewErrorWithError(err, "notificationhubs.GroupClient", "GetAuthorizationRule", resp, "Failure sending request") } result, err = client.GetAuthorizationRuleResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "notificationhubs.Client", "GetAuthorizationRule", resp, "Failure responding to request") + err = autorest.NewErrorWithError(err, "notificationhubs.GroupClient", "GetAuthorizationRule", resp, "Failure responding to request") } return } // GetAuthorizationRulePreparer prepares the GetAuthorizationRule request. -func (client Client) GetAuthorizationRulePreparer(resourceGroupName string, namespaceName string, notificationHubName string, authorizationRuleName string) (*http.Request, error) { +func (client GroupClient) GetAuthorizationRulePreparer(resourceGroupName string, namespaceName string, notificationHubName string, authorizationRuleName string) (*http.Request, error) { pathParameters := map[string]interface{}{ "authorizationRuleName": autorest.Encode("path", authorizationRuleName), "namespaceName": autorest.Encode("path", namespaceName), @@ -491,8 +496,9 @@ func (client Client) GetAuthorizationRulePreparer(resourceGroupName string, name "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-03-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -505,13 +511,13 @@ func (client Client) GetAuthorizationRulePreparer(resourceGroupName string, name // GetAuthorizationRuleSender sends the GetAuthorizationRule request. The method will close the // http.Response Body if it receives an error. -func (client Client) GetAuthorizationRuleSender(req *http.Request) (*http.Response, error) { +func (client GroupClient) GetAuthorizationRuleSender(req *http.Request) (*http.Response, error) { return autorest.SendWithSender(client, req) } // GetAuthorizationRuleResponder handles the response to the GetAuthorizationRule request. The method always // closes the http.Response Body. -func (client Client) GetAuthorizationRuleResponder(resp *http.Response) (result SharedAccessAuthorizationRuleResource, err error) { +func (client GroupClient) GetAuthorizationRuleResponder(resp *http.Response) (result SharedAccessAuthorizationRuleResource, err error) { err = autorest.Respond( resp, client.ByInspecting(), @@ -527,28 +533,28 @@ func (client Client) GetAuthorizationRuleResponder(resp *http.Response) (result // // resourceGroupName is the name of the resource group. namespaceName is the // namespace name. notificationHubName is the notification hub name. -func (client Client) GetPnsCredentials(resourceGroupName string, namespaceName string, notificationHubName string) (result PnsCredentialsResource, err error) { +func (client GroupClient) GetPnsCredentials(resourceGroupName string, namespaceName string, notificationHubName string) (result PnsCredentialsResource, err error) { req, err := client.GetPnsCredentialsPreparer(resourceGroupName, namespaceName, notificationHubName) if err != nil { - return result, autorest.NewErrorWithError(err, "notificationhubs.Client", "GetPnsCredentials", nil, "Failure preparing request") + return result, autorest.NewErrorWithError(err, "notificationhubs.GroupClient", "GetPnsCredentials", nil, "Failure preparing request") } resp, err := client.GetPnsCredentialsSender(req) if err != nil { result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "notificationhubs.Client", "GetPnsCredentials", resp, "Failure sending request") + return result, autorest.NewErrorWithError(err, "notificationhubs.GroupClient", "GetPnsCredentials", resp, "Failure sending request") } result, err = client.GetPnsCredentialsResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "notificationhubs.Client", "GetPnsCredentials", resp, "Failure responding to request") + err = autorest.NewErrorWithError(err, "notificationhubs.GroupClient", "GetPnsCredentials", resp, "Failure responding to request") } return } // GetPnsCredentialsPreparer prepares the GetPnsCredentials request. -func (client Client) GetPnsCredentialsPreparer(resourceGroupName string, namespaceName string, notificationHubName string) (*http.Request, error) { +func (client GroupClient) GetPnsCredentialsPreparer(resourceGroupName string, namespaceName string, notificationHubName string) (*http.Request, error) { pathParameters := map[string]interface{}{ "namespaceName": autorest.Encode("path", namespaceName), "notificationHubName": autorest.Encode("path", notificationHubName), @@ -556,8 +562,9 @@ func (client Client) GetPnsCredentialsPreparer(resourceGroupName string, namespa "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-03-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -570,13 +577,13 @@ func (client Client) GetPnsCredentialsPreparer(resourceGroupName string, namespa // GetPnsCredentialsSender sends the GetPnsCredentials request. The method will close the // http.Response Body if it receives an error. -func (client Client) GetPnsCredentialsSender(req *http.Request) (*http.Response, error) { +func (client GroupClient) GetPnsCredentialsSender(req *http.Request) (*http.Response, error) { return autorest.SendWithSender(client, req) } // GetPnsCredentialsResponder handles the response to the GetPnsCredentials request. The method always // closes the http.Response Body. -func (client Client) GetPnsCredentialsResponder(resp *http.Response) (result PnsCredentialsResource, err error) { +func (client GroupClient) GetPnsCredentialsResponder(resp *http.Response) (result PnsCredentialsResource, err error) { err = autorest.Respond( resp, client.ByInspecting(), @@ -591,36 +598,37 @@ func (client Client) GetPnsCredentialsResponder(resp *http.Response) (result Pns // // resourceGroupName is the name of the resource group. namespaceName is the // namespace name. -func (client Client) List(resourceGroupName string, namespaceName string) (result NotificationHubListResult, err error) { +func (client GroupClient) List(resourceGroupName string, namespaceName string) (result ListResult, err error) { req, err := client.ListPreparer(resourceGroupName, namespaceName) if err != nil { - return result, autorest.NewErrorWithError(err, "notificationhubs.Client", "List", nil, "Failure preparing request") + return result, autorest.NewErrorWithError(err, "notificationhubs.GroupClient", "List", nil, "Failure preparing request") } resp, err := client.ListSender(req) if err != nil { result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "notificationhubs.Client", "List", resp, "Failure sending request") + return result, autorest.NewErrorWithError(err, "notificationhubs.GroupClient", "List", resp, "Failure sending request") } result, err = client.ListResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "notificationhubs.Client", "List", resp, "Failure responding to request") + err = autorest.NewErrorWithError(err, "notificationhubs.GroupClient", "List", resp, "Failure responding to request") } return } // ListPreparer prepares the List request. -func (client Client) ListPreparer(resourceGroupName string, namespaceName string) (*http.Request, error) { +func (client GroupClient) ListPreparer(resourceGroupName string, namespaceName string) (*http.Request, error) { pathParameters := map[string]interface{}{ "namespaceName": autorest.Encode("path", namespaceName), "resourceGroupName": autorest.Encode("path", resourceGroupName), "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-03-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -633,13 +641,13 @@ func (client Client) ListPreparer(resourceGroupName string, namespaceName string // 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) { +func (client GroupClient) ListSender(req *http.Request) (*http.Response, error) { return autorest.SendWithSender(client, req) } // ListResponder handles the response to the List request. The method always // closes the http.Response Body. -func (client Client) ListResponder(resp *http.Response) (result NotificationHubListResult, err error) { +func (client GroupClient) ListResponder(resp *http.Response) (result ListResult, err error) { err = autorest.Respond( resp, client.ByInspecting(), @@ -651,10 +659,10 @@ func (client Client) ListResponder(resp *http.Response) (result NotificationHubL } // ListNextResults retrieves the next set of results, if any. -func (client Client) ListNextResults(lastResults NotificationHubListResult) (result NotificationHubListResult, err error) { - req, err := lastResults.NotificationHubListResultPreparer() +func (client GroupClient) ListNextResults(lastResults ListResult) (result ListResult, err error) { + req, err := lastResults.ListResultPreparer() if err != nil { - return result, autorest.NewErrorWithError(err, "notificationhubs.Client", "List", nil, "Failure preparing next results request") + return result, autorest.NewErrorWithError(err, "notificationhubs.GroupClient", "List", nil, "Failure preparing next results request") } if req == nil { return @@ -663,12 +671,12 @@ func (client Client) ListNextResults(lastResults NotificationHubListResult) (res resp, err := client.ListSender(req) if err != nil { result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "notificationhubs.Client", "List", resp, "Failure sending next results request") + return result, autorest.NewErrorWithError(err, "notificationhubs.GroupClient", "List", resp, "Failure sending next results request") } result, err = client.ListResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "notificationhubs.Client", "List", resp, "Failure responding to next results request") + err = autorest.NewErrorWithError(err, "notificationhubs.GroupClient", "List", resp, "Failure responding to next results request") } return @@ -678,28 +686,28 @@ func (client Client) ListNextResults(lastResults NotificationHubListResult) (res // // resourceGroupName is the name of the resource group. namespaceName is the // namespace name notificationHubName is the notification hub name. -func (client Client) ListAuthorizationRules(resourceGroupName string, namespaceName string, notificationHubName string) (result SharedAccessAuthorizationRuleListResult, err error) { +func (client GroupClient) ListAuthorizationRules(resourceGroupName string, namespaceName string, notificationHubName string) (result SharedAccessAuthorizationRuleListResult, err error) { req, err := client.ListAuthorizationRulesPreparer(resourceGroupName, namespaceName, notificationHubName) if err != nil { - return result, autorest.NewErrorWithError(err, "notificationhubs.Client", "ListAuthorizationRules", nil, "Failure preparing request") + return result, autorest.NewErrorWithError(err, "notificationhubs.GroupClient", "ListAuthorizationRules", nil, "Failure preparing request") } resp, err := client.ListAuthorizationRulesSender(req) if err != nil { result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "notificationhubs.Client", "ListAuthorizationRules", resp, "Failure sending request") + return result, autorest.NewErrorWithError(err, "notificationhubs.GroupClient", "ListAuthorizationRules", resp, "Failure sending request") } result, err = client.ListAuthorizationRulesResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "notificationhubs.Client", "ListAuthorizationRules", resp, "Failure responding to request") + err = autorest.NewErrorWithError(err, "notificationhubs.GroupClient", "ListAuthorizationRules", resp, "Failure responding to request") } return } // ListAuthorizationRulesPreparer prepares the ListAuthorizationRules request. -func (client Client) ListAuthorizationRulesPreparer(resourceGroupName string, namespaceName string, notificationHubName string) (*http.Request, error) { +func (client GroupClient) ListAuthorizationRulesPreparer(resourceGroupName string, namespaceName string, notificationHubName string) (*http.Request, error) { pathParameters := map[string]interface{}{ "namespaceName": autorest.Encode("path", namespaceName), "notificationHubName": autorest.Encode("path", notificationHubName), @@ -707,8 +715,9 @@ func (client Client) ListAuthorizationRulesPreparer(resourceGroupName string, na "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-03-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -721,13 +730,13 @@ func (client Client) ListAuthorizationRulesPreparer(resourceGroupName string, na // ListAuthorizationRulesSender sends the ListAuthorizationRules request. The method will close the // http.Response Body if it receives an error. -func (client Client) ListAuthorizationRulesSender(req *http.Request) (*http.Response, error) { +func (client GroupClient) ListAuthorizationRulesSender(req *http.Request) (*http.Response, error) { return autorest.SendWithSender(client, req) } // ListAuthorizationRulesResponder handles the response to the ListAuthorizationRules request. The method always // closes the http.Response Body. -func (client Client) ListAuthorizationRulesResponder(resp *http.Response) (result SharedAccessAuthorizationRuleListResult, err error) { +func (client GroupClient) ListAuthorizationRulesResponder(resp *http.Response) (result SharedAccessAuthorizationRuleListResult, err error) { err = autorest.Respond( resp, client.ByInspecting(), @@ -739,10 +748,10 @@ func (client Client) ListAuthorizationRulesResponder(resp *http.Response) (resul } // ListAuthorizationRulesNextResults retrieves the next set of results, if any. -func (client Client) ListAuthorizationRulesNextResults(lastResults SharedAccessAuthorizationRuleListResult) (result SharedAccessAuthorizationRuleListResult, err error) { +func (client GroupClient) ListAuthorizationRulesNextResults(lastResults SharedAccessAuthorizationRuleListResult) (result SharedAccessAuthorizationRuleListResult, err error) { req, err := lastResults.SharedAccessAuthorizationRuleListResultPreparer() if err != nil { - return result, autorest.NewErrorWithError(err, "notificationhubs.Client", "ListAuthorizationRules", nil, "Failure preparing next results request") + return result, autorest.NewErrorWithError(err, "notificationhubs.GroupClient", "ListAuthorizationRules", nil, "Failure preparing next results request") } if req == nil { return @@ -751,12 +760,12 @@ func (client Client) ListAuthorizationRulesNextResults(lastResults SharedAccessA resp, err := client.ListAuthorizationRulesSender(req) if err != nil { result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "notificationhubs.Client", "ListAuthorizationRules", resp, "Failure sending next results request") + return result, autorest.NewErrorWithError(err, "notificationhubs.GroupClient", "ListAuthorizationRules", resp, "Failure sending next results request") } result, err = client.ListAuthorizationRulesResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "notificationhubs.Client", "ListAuthorizationRules", resp, "Failure responding to next results request") + err = autorest.NewErrorWithError(err, "notificationhubs.GroupClient", "ListAuthorizationRules", resp, "Failure responding to next results request") } return @@ -769,28 +778,28 @@ func (client Client) ListAuthorizationRulesNextResults(lastResults SharedAccessA // namespace name. notificationHubName is the notification hub name. // authorizationRuleName is the connection string of the NotificationHub for // the specified authorizationRule. -func (client Client) ListKeys(resourceGroupName string, namespaceName string, notificationHubName string, authorizationRuleName string) (result ResourceListKeys, err error) { +func (client GroupClient) ListKeys(resourceGroupName string, namespaceName string, notificationHubName string, authorizationRuleName string) (result ResourceListKeys, err error) { req, err := client.ListKeysPreparer(resourceGroupName, namespaceName, notificationHubName, authorizationRuleName) if err != nil { - return result, autorest.NewErrorWithError(err, "notificationhubs.Client", "ListKeys", nil, "Failure preparing request") + return result, autorest.NewErrorWithError(err, "notificationhubs.GroupClient", "ListKeys", nil, "Failure preparing request") } resp, err := client.ListKeysSender(req) if err != nil { result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "notificationhubs.Client", "ListKeys", resp, "Failure sending request") + return result, autorest.NewErrorWithError(err, "notificationhubs.GroupClient", "ListKeys", resp, "Failure sending request") } result, err = client.ListKeysResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "notificationhubs.Client", "ListKeys", resp, "Failure responding to request") + err = autorest.NewErrorWithError(err, "notificationhubs.GroupClient", "ListKeys", resp, "Failure responding to request") } return } // ListKeysPreparer prepares the ListKeys request. -func (client Client) ListKeysPreparer(resourceGroupName string, namespaceName string, notificationHubName string, authorizationRuleName string) (*http.Request, error) { +func (client GroupClient) ListKeysPreparer(resourceGroupName string, namespaceName string, notificationHubName string, authorizationRuleName string) (*http.Request, error) { pathParameters := map[string]interface{}{ "authorizationRuleName": autorest.Encode("path", authorizationRuleName), "namespaceName": autorest.Encode("path", namespaceName), @@ -799,8 +808,9 @@ func (client Client) ListKeysPreparer(resourceGroupName string, namespaceName st "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-03-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -813,13 +823,13 @@ func (client Client) ListKeysPreparer(resourceGroupName string, namespaceName st // ListKeysSender sends the ListKeys request. The method will close the // http.Response Body if it receives an error. -func (client Client) ListKeysSender(req *http.Request) (*http.Response, error) { +func (client GroupClient) ListKeysSender(req *http.Request) (*http.Response, error) { return autorest.SendWithSender(client, req) } // ListKeysResponder handles the response to the ListKeys request. The method always // closes the http.Response Body. -func (client Client) ListKeysResponder(resp *http.Response) (result ResourceListKeys, err error) { +func (client GroupClient) ListKeysResponder(resp *http.Response) (result ResourceListKeys, err error) { err = autorest.Respond( resp, client.ByInspecting(), @@ -830,36 +840,36 @@ func (client Client) ListKeysResponder(resp *http.Response) (result ResourceList return } -// RegenerateKeys regenerates the Primary/Secondary Keys to the -// NotificationHub Authorization Rule +// RegenerateKeys regenerates the Primary/Secondary Keys to the NotificationHub +// Authorization Rule // // resourceGroupName is the name of the resource group. namespaceName is the // namespace name. notificationHubName is the notification hub name. // authorizationRuleName is the connection string of the NotificationHub for // the specified authorizationRule. parameters is parameters supplied to // regenerate the NotificationHub Authorization Rule Key. -func (client Client) RegenerateKeys(resourceGroupName string, namespaceName string, notificationHubName string, authorizationRuleName string, parameters PolicykeyResource) (result ResourceListKeys, err error) { +func (client GroupClient) RegenerateKeys(resourceGroupName string, namespaceName string, notificationHubName string, authorizationRuleName string, parameters PolicykeyResource) (result ResourceListKeys, err error) { req, err := client.RegenerateKeysPreparer(resourceGroupName, namespaceName, notificationHubName, authorizationRuleName, parameters) if err != nil { - return result, autorest.NewErrorWithError(err, "notificationhubs.Client", "RegenerateKeys", nil, "Failure preparing request") + return result, autorest.NewErrorWithError(err, "notificationhubs.GroupClient", "RegenerateKeys", nil, "Failure preparing request") } resp, err := client.RegenerateKeysSender(req) if err != nil { result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "notificationhubs.Client", "RegenerateKeys", resp, "Failure sending request") + return result, autorest.NewErrorWithError(err, "notificationhubs.GroupClient", "RegenerateKeys", resp, "Failure sending request") } result, err = client.RegenerateKeysResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "notificationhubs.Client", "RegenerateKeys", resp, "Failure responding to request") + err = autorest.NewErrorWithError(err, "notificationhubs.GroupClient", "RegenerateKeys", resp, "Failure responding to request") } return } // RegenerateKeysPreparer prepares the RegenerateKeys request. -func (client Client) RegenerateKeysPreparer(resourceGroupName string, namespaceName string, notificationHubName string, authorizationRuleName string, parameters PolicykeyResource) (*http.Request, error) { +func (client GroupClient) RegenerateKeysPreparer(resourceGroupName string, namespaceName string, notificationHubName string, authorizationRuleName string, parameters PolicykeyResource) (*http.Request, error) { pathParameters := map[string]interface{}{ "authorizationRuleName": autorest.Encode("path", authorizationRuleName), "namespaceName": autorest.Encode("path", namespaceName), @@ -868,8 +878,9 @@ func (client Client) RegenerateKeysPreparer(resourceGroupName string, namespaceN "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-03-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -884,13 +895,13 @@ func (client Client) RegenerateKeysPreparer(resourceGroupName string, namespaceN // RegenerateKeysSender sends the RegenerateKeys request. The method will close the // http.Response Body if it receives an error. -func (client Client) RegenerateKeysSender(req *http.Request) (*http.Response, error) { +func (client GroupClient) RegenerateKeysSender(req *http.Request) (*http.Response, error) { return autorest.SendWithSender(client, req) } // RegenerateKeysResponder handles the response to the RegenerateKeys request. The method always // closes the http.Response Body. -func (client Client) RegenerateKeysResponder(resp *http.Response) (result ResourceListKeys, err error) { +func (client GroupClient) RegenerateKeysResponder(resp *http.Response) (result ResourceListKeys, err error) { err = autorest.Respond( resp, client.ByInspecting(), diff --git a/arm/notificationhubs/version.go b/arm/notificationhubs/version.go old mode 100644 new mode 100755 index 9dd45ea62d9a..9d28969d8d75 --- a/arm/notificationhubs/version.go +++ b/arm/notificationhubs/version.go @@ -18,43 +18,12 @@ package notificationhubs // Changes may cause incorrect behavior and will be lost if the code is // regenerated. -import ( - "bytes" - "fmt" - "strings" -) - -const ( - major = "8" - minor = "1" - patch = "0" - tag = "beta" - userAgentFormat = "Azure-SDK-For-Go/%s arm-%s/%s" -) - -// cached results of UserAgent and Version to prevent repeated operations. -var ( - userAgent string - version string -) - // UserAgent returns the UserAgent string to use when sending http.Requests. func UserAgent() string { - if userAgent == "" { - userAgent = fmt.Sprintf(userAgentFormat, Version(), "notificationhubs", "2016-03-01") - } - return userAgent + return "Azure-SDK-For-Go/v9.0.0-beta arm-notificationhubs/2016-03-01" } // Version returns the semantic version (see http://semver.org) of the client. func Version() string { - if version == "" { - versionBuilder := bytes.NewBufferString(fmt.Sprintf("%s.%s.%s", major, minor, patch)) - if tag != "" { - versionBuilder.WriteRune('-') - versionBuilder.WriteString(strings.TrimPrefix(tag, "-")) - } - version = string(versionBuilder.Bytes()) - } - return version + return "v9.0.0-beta" } diff --git a/arm/powerbiembedded/client.go b/arm/powerbiembedded/client.go old mode 100644 new mode 100755 index ae9e1ef827e0..5c5496a3213f --- a/arm/powerbiembedded/client.go +++ b/arm/powerbiembedded/client.go @@ -30,9 +30,6 @@ import ( ) const ( - // APIVersion is the version of the Powerbiembedded - APIVersion = "2016-01-29" - // DefaultBaseURI is the default URI used for the service Powerbiembedded DefaultBaseURI = "https://management.azure.com" ) @@ -41,7 +38,6 @@ const ( type ManagementClient struct { autorest.Client BaseURI string - APIVersion string SubscriptionID string } @@ -55,7 +51,6 @@ func NewWithBaseURI(baseURI string, subscriptionID string) ManagementClient { return ManagementClient{ Client: autorest.NewClientWithUserAgent(UserAgent()), BaseURI: baseURI, - APIVersion: APIVersion, SubscriptionID: subscriptionID, } } @@ -84,8 +79,9 @@ func (client ManagementClient) GetAvailableOperations() (result OperationList, e // GetAvailableOperationsPreparer prepares the GetAvailableOperations request. func (client ManagementClient) GetAvailableOperationsPreparer() (*http.Request, error) { + const APIVersion = "2016-01-29" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( diff --git a/arm/powerbiembedded/models.go b/arm/powerbiembedded/models.go old mode 100644 new mode 100755 diff --git a/arm/powerbiembedded/version.go b/arm/powerbiembedded/version.go old mode 100644 new mode 100755 index 8da68e384fe9..f06520a2dcb8 --- a/arm/powerbiembedded/version.go +++ b/arm/powerbiembedded/version.go @@ -18,43 +18,12 @@ package powerbiembedded // Changes may cause incorrect behavior and will be lost if the code is // regenerated. -import ( - "bytes" - "fmt" - "strings" -) - -const ( - major = "8" - minor = "1" - patch = "0" - tag = "beta" - userAgentFormat = "Azure-SDK-For-Go/%s arm-%s/%s" -) - -// cached results of UserAgent and Version to prevent repeated operations. -var ( - userAgent string - version string -) - // UserAgent returns the UserAgent string to use when sending http.Requests. func UserAgent() string { - if userAgent == "" { - userAgent = fmt.Sprintf(userAgentFormat, Version(), "powerbiembedded", "2016-01-29") - } - return userAgent + return "Azure-SDK-For-Go/v9.0.0-beta arm-powerbiembedded/2016-01-29" } // Version returns the semantic version (see http://semver.org) of the client. func Version() string { - if version == "" { - versionBuilder := bytes.NewBufferString(fmt.Sprintf("%s.%s.%s", major, minor, patch)) - if tag != "" { - versionBuilder.WriteRune('-') - versionBuilder.WriteString(strings.TrimPrefix(tag, "-")) - } - version = string(versionBuilder.Bytes()) - } - return version + return "v9.0.0-beta" } diff --git a/arm/powerbiembedded/workspacecollections.go b/arm/powerbiembedded/workspacecollections.go old mode 100644 new mode 100755 index 45d2e912607a..040d2c4ab902 --- a/arm/powerbiembedded/workspacecollections.go +++ b/arm/powerbiembedded/workspacecollections.go @@ -74,8 +74,9 @@ func (client WorkspaceCollectionsClient) CheckNameAvailabilityPreparer(location "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-01-29" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -152,8 +153,9 @@ func (client WorkspaceCollectionsClient) CreatePreparer(resourceGroupName string "workspaceCollectionName": autorest.Encode("path", workspaceCollectionName), } + const APIVersion = "2016-01-29" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -220,8 +222,9 @@ func (client WorkspaceCollectionsClient) DeletePreparer(resourceGroupName string "workspaceCollectionName": autorest.Encode("path", workspaceCollectionName), } + const APIVersion = "2016-01-29" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -285,8 +288,9 @@ func (client WorkspaceCollectionsClient) GetAccessKeysPreparer(resourceGroupName "workspaceCollectionName": autorest.Encode("path", workspaceCollectionName), } + const APIVersion = "2016-01-29" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -348,8 +352,9 @@ func (client WorkspaceCollectionsClient) GetByNamePreparer(resourceGroupName str "workspaceCollectionName": autorest.Encode("path", workspaceCollectionName), } + const APIVersion = "2016-01-29" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -410,8 +415,9 @@ func (client WorkspaceCollectionsClient) ListByResourceGroupPreparer(resourceGro "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-01-29" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -469,8 +475,9 @@ func (client WorkspaceCollectionsClient) ListBySubscriptionPreparer() (*http.Req "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-01-29" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -532,8 +539,9 @@ func (client WorkspaceCollectionsClient) MigratePreparer(resourceGroupName strin "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-01-29" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -597,8 +605,9 @@ func (client WorkspaceCollectionsClient) RegenerateKeyPreparer(resourceGroupName "workspaceCollectionName": autorest.Encode("path", workspaceCollectionName), } + const APIVersion = "2016-01-29" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -664,8 +673,9 @@ func (client WorkspaceCollectionsClient) UpdatePreparer(resourceGroupName string "workspaceCollectionName": autorest.Encode("path", workspaceCollectionName), } + const APIVersion = "2016-01-29" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( diff --git a/arm/powerbiembedded/workspaces.go b/arm/powerbiembedded/workspaces.go old mode 100644 new mode 100755 index 6793ea3f12de..5b9e82364c37 --- a/arm/powerbiembedded/workspaces.go +++ b/arm/powerbiembedded/workspaces.go @@ -74,8 +74,9 @@ func (client WorkspacesClient) ListPreparer(resourceGroupName string, workspaceC "workspaceCollectionName": autorest.Encode("path", workspaceCollectionName), } + const APIVersion = "2016-01-29" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( diff --git a/arm/recoveryservices/client.go b/arm/recoveryservices/client.go old mode 100644 new mode 100755 index 0cd1116e602c..98b156452f78 --- a/arm/recoveryservices/client.go +++ b/arm/recoveryservices/client.go @@ -27,9 +27,6 @@ import ( ) const ( - // APIVersion is the version of the Recoveryservices - APIVersion = "2016-06-01" - // DefaultBaseURI is the default URI used for the service Recoveryservices DefaultBaseURI = "https://management.azure.com" ) @@ -38,7 +35,6 @@ const ( type ManagementClient struct { autorest.Client BaseURI string - APIVersion string SubscriptionID string } @@ -52,7 +48,6 @@ func NewWithBaseURI(baseURI string, subscriptionID string) ManagementClient { return ManagementClient{ Client: autorest.NewClientWithUserAgent(UserAgent()), BaseURI: baseURI, - APIVersion: APIVersion, SubscriptionID: subscriptionID, } } diff --git a/arm/recoveryservices/models.go b/arm/recoveryservices/models.go old mode 100644 new mode 100755 diff --git a/arm/recoveryservices/vaults.go b/arm/recoveryservices/vaults.go old mode 100644 new mode 100755 index 5e3d14ecd48c..6494205452a5 --- a/arm/recoveryservices/vaults.go +++ b/arm/recoveryservices/vaults.go @@ -73,8 +73,9 @@ func (client VaultsClient) CreateOrUpdatePreparer(resourceGroupName string, vaul "vaultName": autorest.Encode("path", vaultName), } + const APIVersion = "2016-06-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -139,8 +140,9 @@ func (client VaultsClient) DeletePreparer(resourceGroupName string, vaultName st "vaultName": autorest.Encode("path", vaultName), } + const APIVersion = "2016-06-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -202,8 +204,9 @@ func (client VaultsClient) GetPreparer(resourceGroupName string, vaultName strin "vaultName": autorest.Encode("path", vaultName), } + const APIVersion = "2016-06-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -264,8 +267,9 @@ func (client VaultsClient) ListByResourceGroupPreparer(resourceGroupName string) "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-06-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( diff --git a/arm/recoveryservices/version.go b/arm/recoveryservices/version.go old mode 100644 new mode 100755 index f0022f9a43bc..55b1391027d7 --- a/arm/recoveryservices/version.go +++ b/arm/recoveryservices/version.go @@ -18,43 +18,12 @@ package recoveryservices // Changes may cause incorrect behavior and will be lost if the code is // regenerated. -import ( - "bytes" - "fmt" - "strings" -) - -const ( - major = "8" - minor = "1" - patch = "0" - tag = "beta" - userAgentFormat = "Azure-SDK-For-Go/%s arm-%s/%s" -) - -// cached results of UserAgent and Version to prevent repeated operations. -var ( - userAgent string - version string -) - // UserAgent returns the UserAgent string to use when sending http.Requests. func UserAgent() string { - if userAgent == "" { - userAgent = fmt.Sprintf(userAgentFormat, Version(), "recoveryservices", "2016-06-01") - } - return userAgent + return "Azure-SDK-For-Go/v9.0.0-beta arm-recoveryservices/2016-06-01" } // Version returns the semantic version (see http://semver.org) of the client. func Version() string { - if version == "" { - versionBuilder := bytes.NewBufferString(fmt.Sprintf("%s.%s.%s", major, minor, patch)) - if tag != "" { - versionBuilder.WriteRune('-') - versionBuilder.WriteString(strings.TrimPrefix(tag, "-")) - } - version = string(versionBuilder.Bytes()) - } - return version + return "v9.0.0-beta" } diff --git a/arm/redis/client.go b/arm/redis/client.go old mode 100644 new mode 100755 index d547a53d8089..a2fe3a6d6891 --- a/arm/redis/client.go +++ b/arm/redis/client.go @@ -17,7 +17,7 @@ package redis // See the License for the specific language governing permissions and // limitations under the License. // -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.0 +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 // Changes may cause incorrect behavior and will be lost if the code is // regenerated. @@ -26,9 +26,6 @@ import ( ) const ( - // APIVersion is the version of the Redis - APIVersion = "2016-04-01" - // DefaultBaseURI is the default URI used for the service Redis DefaultBaseURI = "https://management.azure.com" ) @@ -37,7 +34,6 @@ const ( type ManagementClient struct { autorest.Client BaseURI string - APIVersion string SubscriptionID string } @@ -51,7 +47,6 @@ func NewWithBaseURI(baseURI string, subscriptionID string) ManagementClient { return ManagementClient{ Client: autorest.NewClientWithUserAgent(UserAgent()), BaseURI: baseURI, - APIVersion: APIVersion, SubscriptionID: subscriptionID, } } diff --git a/arm/redis/firewallrule.go b/arm/redis/firewallrule.go new file mode 100755 index 000000000000..ae46a713ecec --- /dev/null +++ b/arm/redis/firewallrule.go @@ -0,0 +1,248 @@ +package redis + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// 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/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// FirewallRuleClient is the rEST API for Azure Redis Cache Service. +type FirewallRuleClient struct { + ManagementClient +} + +// NewFirewallRuleClient creates an instance of the FirewallRuleClient client. +func NewFirewallRuleClient(subscriptionID string) FirewallRuleClient { + return NewFirewallRuleClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewFirewallRuleClientWithBaseURI creates an instance of the +// FirewallRuleClient client. +func NewFirewallRuleClientWithBaseURI(baseURI string, subscriptionID string) FirewallRuleClient { + return FirewallRuleClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate create or update a redis cache firewall rule +// +// resourceGroupName is the name of the resource group. cacheName is the name +// of the Redis cache. ruleName is the name of the firewall rule. parameters is +// parameters supplied to the create or update redis firewall rule operation. +func (client FirewallRuleClient) CreateOrUpdate(resourceGroupName string, cacheName string, ruleName string, parameters FirewallRule) (result FirewallRule, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.FirewallRuleProperties", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "parameters.FirewallRuleProperties.StartIP", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.FirewallRuleProperties.EndIP", Name: validation.Null, Rule: true, Chain: nil}, + }}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "redis.FirewallRuleClient", "CreateOrUpdate") + } + + req, err := client.CreateOrUpdatePreparer(resourceGroupName, cacheName, ruleName, parameters) + if err != nil { + return result, autorest.NewErrorWithError(err, "redis.FirewallRuleClient", "CreateOrUpdate", nil, "Failure preparing request") + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "redis.FirewallRuleClient", "CreateOrUpdate", resp, "Failure sending request") + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "redis.FirewallRuleClient", "CreateOrUpdate", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client FirewallRuleClient) CreateOrUpdatePreparer(resourceGroupName string, cacheName string, ruleName string, parameters FirewallRule) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "cacheName": autorest.Encode("path", cacheName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "ruleName": autorest.Encode("path", ruleName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/Redis/{cacheName}/firewallRules/{ruleName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client FirewallRuleClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client FirewallRuleClient) CreateOrUpdateResponder(resp *http.Response) (result FirewallRule, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes a single firewall rule in a specified redis cache. +// +// resourceGroupName is the name of the resource group. cacheName is the name +// of the Redis cache. ruleName is the name of the firewall rule. +func (client FirewallRuleClient) Delete(resourceGroupName string, cacheName string, ruleName string) (result autorest.Response, err error) { + req, err := client.DeletePreparer(resourceGroupName, cacheName, ruleName) + if err != nil { + return result, autorest.NewErrorWithError(err, "redis.FirewallRuleClient", "Delete", nil, "Failure preparing request") + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + return result, autorest.NewErrorWithError(err, "redis.FirewallRuleClient", "Delete", resp, "Failure sending request") + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "redis.FirewallRuleClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client FirewallRuleClient) DeletePreparer(resourceGroupName string, cacheName string, ruleName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "cacheName": autorest.Encode("path", cacheName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "ruleName": autorest.Encode("path", ruleName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-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.Cache/Redis/{cacheName}/firewallRules/{ruleName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client FirewallRuleClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client FirewallRuleClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets a single firewall rule in a specified redis cache. +// +// resourceGroupName is the name of the resource group. cacheName is the name +// of the Redis cache. ruleName is the name of the firewall rule. +func (client FirewallRuleClient) Get(resourceGroupName string, cacheName string, ruleName string) (result FirewallRule, err error) { + req, err := client.GetPreparer(resourceGroupName, cacheName, ruleName) + if err != nil { + return result, autorest.NewErrorWithError(err, "redis.FirewallRuleClient", "Get", nil, "Failure preparing request") + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "redis.FirewallRuleClient", "Get", resp, "Failure sending request") + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "redis.FirewallRuleClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client FirewallRuleClient) GetPreparer(resourceGroupName string, cacheName string, ruleName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "cacheName": autorest.Encode("path", cacheName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "ruleName": autorest.Encode("path", ruleName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-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.Cache/Redis/{cacheName}/firewallRules/{ruleName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client FirewallRuleClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client FirewallRuleClient) GetResponder(resp *http.Response) (result FirewallRule, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/arm/redis/firewallrules.go b/arm/redis/firewallrules.go new file mode 100755 index 000000000000..3e02d682384c --- /dev/null +++ b/arm/redis/firewallrules.go @@ -0,0 +1,130 @@ +package redis + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// 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/azure" + "net/http" +) + +// FirewallRulesClient is the rEST API for Azure Redis Cache Service. +type FirewallRulesClient struct { + ManagementClient +} + +// 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. +func NewFirewallRulesClientWithBaseURI(baseURI string, subscriptionID string) FirewallRulesClient { + return FirewallRulesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List gets all firewall rules in the specified redis cache. +// +// resourceGroupName is the name of the resource group. cacheName is the name +// of the Redis cache. +func (client FirewallRulesClient) List(resourceGroupName string, cacheName string) (result FirewallRuleListResult, err error) { + req, err := client.ListPreparer(resourceGroupName, cacheName) + if err != nil { + return result, autorest.NewErrorWithError(err, "redis.FirewallRulesClient", "List", nil, "Failure preparing request") + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "redis.FirewallRulesClient", "List", resp, "Failure sending request") + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "redis.FirewallRulesClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client FirewallRulesClient) ListPreparer(resourceGroupName string, cacheName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "cacheName": autorest.Encode("path", cacheName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-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.Cache/Redis/{cacheName}/firewallRules", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client FirewallRulesClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client FirewallRulesClient) ListResponder(resp *http.Response) (result FirewallRuleListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + 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 FirewallRulesClient) ListNextResults(lastResults FirewallRuleListResult) (result FirewallRuleListResult, err error) { + req, err := lastResults.FirewallRuleListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "redis.FirewallRulesClient", "List", 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, "redis.FirewallRulesClient", "List", resp, "Failure sending next results request") + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "redis.FirewallRulesClient", "List", resp, "Failure responding to next results request") + } + + return +} diff --git a/arm/redis/models.go b/arm/redis/models.go old mode 100644 new mode 100755 index 85e0035325bd..f4ef80cc53fa --- a/arm/redis/models.go +++ b/arm/redis/models.go @@ -14,7 +14,7 @@ package redis // See the License for the specific language governing permissions and // limitations under the License. // -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.0 +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 // Changes may cause incorrect behavior and will be lost if the code is // regenerated. @@ -127,6 +127,49 @@ type ExportRDBParameters struct { Container *string `json:"container,omitempty"` } +// FirewallRule is a firewall rule on a redis cache has a name, and describes a +// contiguous range of IP addresses permitted to connect +type FirewallRule struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + *FirewallRuleProperties `json:"properties,omitempty"` +} + +// FirewallRuleListResult is the response of list firewall rules Redis +// operation. +type FirewallRuleListResult struct { + autorest.Response `json:"-"` + Value *[]FirewallRule `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// FirewallRuleListResultPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client FirewallRuleListResult) FirewallRuleListResultPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// FirewallRuleProperties is specifies a range of IP addresses permitted to +// connect to the cache +type FirewallRuleProperties struct { + StartIP *string `json:"startIP,omitempty"` + EndIP *string `json:"endIP,omitempty"` +} + +// ForceRebootResponse is response to force reboot for Redis cache. +type ForceRebootResponse struct { + autorest.Response `json:"-"` + Message *string `json:"Message,omitempty"` +} + // ImportRDBParameters is parameters for Redis import operation. type ImportRDBParameters struct { Format *string `json:"format,omitempty"` @@ -152,6 +195,41 @@ func (client ListResult) ListResultPreparer() (*http.Request, error) { autorest.WithBaseURL(to.String(client.NextLink))) } +// Operation is rEST API operation +type Operation struct { + Name *string `json:"name,omitempty"` + Display *OperationDisplay `json:"display,omitempty"` +} + +// OperationDisplay is the object that describes the operation. +type OperationDisplay struct { + Provider *string `json:"provider,omitempty"` + Operation *string `json:"operation,omitempty"` + Resource *string `json:"resource,omitempty"` + Description *string `json:"description,omitempty"` +} + +// OperationListResult is 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 *[]Operation `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// OperationListResultPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client OperationListResult) OperationListResultPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + // PatchSchedule is response to put/get patch schedules for Redis cache. type PatchSchedule struct { autorest.Response `json:"-"` @@ -206,6 +284,7 @@ type ResourceProperties struct { HostName *string `json:"hostName,omitempty"` Port *int32 `json:"port,omitempty"` SslPort *int32 `json:"sslPort,omitempty"` + AccessKeys *AccessKeys `json:"accessKeys,omitempty"` } // ResourceType is a single Redis item in List or Get Operation. diff --git a/arm/redis/operations.go b/arm/redis/operations.go new file mode 100755 index 000000000000..ee84095324b3 --- /dev/null +++ b/arm/redis/operations.go @@ -0,0 +1,121 @@ +package redis + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// 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/azure" + "net/http" +) + +// OperationsClient is the rEST API for Azure Redis Cache Service. +type OperationsClient struct { + ManagementClient +} + +// 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. +func NewOperationsClientWithBaseURI(baseURI string, subscriptionID string) OperationsClient { + return OperationsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List lists all of the available REST API operations of the Microsoft.Cache +// provider. +func (client OperationsClient) List() (result OperationListResult, err error) { + req, err := client.ListPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "redis.OperationsClient", "List", nil, "Failure preparing request") + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "redis.OperationsClient", "List", resp, "Failure sending request") + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "redis.OperationsClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client OperationsClient) ListPreparer() (*http.Request, error) { + const APIVersion = "2016-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPath("/providers/Microsoft.Cache/operations"), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// 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 autorest.SendWithSender(client, req) +} + +// 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, + client.ByInspecting(), + 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(lastResults OperationListResult) (result OperationListResult, err error) { + req, err := lastResults.OperationListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "redis.OperationsClient", "List", 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, "redis.OperationsClient", "List", resp, "Failure sending next results request") + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "redis.OperationsClient", "List", resp, "Failure responding to next results request") + } + + return +} diff --git a/arm/redis/patchschedules.go b/arm/redis/patchschedules.go old mode 100644 new mode 100755 index 1994aaf4cf9e..0528bf650df9 --- a/arm/redis/patchschedules.go +++ b/arm/redis/patchschedules.go @@ -14,16 +14,15 @@ package redis // See the License for the specific language governing permissions and // limitations under the License. // -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.0 +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 // Changes may cause incorrect behavior and will be lost if the code is // regenerated. import ( - "net/http" - "github.com/Azure/go-autorest/autorest" "github.com/Azure/go-autorest/autorest/azure" "github.com/Azure/go-autorest/autorest/validation" + "net/http" ) // PatchSchedulesClient is the rEST API for Azure Redis Cache Service. @@ -54,7 +53,6 @@ func (client PatchSchedulesClient) CreateOrUpdate(resourceGroupName string, name {TargetValue: parameters, Constraints: []validation.Constraint{{Target: "parameters.ScheduleEntries", Name: validation.Null, Rule: true, Chain: []validation.Constraint{{Target: "parameters.ScheduleEntries.ScheduleEntries", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "redis.PatchSchedulesClient", "CreateOrUpdate") } @@ -85,8 +83,9 @@ func (client PatchSchedulesClient) CreateOrUpdatePreparer(resourceGroupName stri "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-04-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -111,7 +110,7 @@ func (client PatchSchedulesClient) CreateOrUpdateResponder(resp *http.Response) err = autorest.Respond( resp, client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) result.Response = autorest.Response{Response: resp} @@ -151,8 +150,9 @@ func (client PatchSchedulesClient) DeletePreparer(resourceGroupName string, name "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-04-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -213,8 +213,9 @@ func (client PatchSchedulesClient) GetPreparer(resourceGroupName string, name st "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-04-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -237,7 +238,7 @@ func (client PatchSchedulesClient) GetResponder(resp *http.Response) (result Pat err = autorest.Respond( resp, client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNotFound), + azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) result.Response = autorest.Response{Response: resp} diff --git a/arm/redis/redisgroup.go b/arm/redis/redisgroup.go old mode 100644 new mode 100755 index b41afccf5e90..3580a6157c5e --- a/arm/redis/redisgroup.go +++ b/arm/redis/redisgroup.go @@ -14,7 +14,7 @@ package redis // See the License for the specific language governing permissions and // limitations under the License. // -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.0 +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 // Changes may cause incorrect behavior and will be lost if the code is // regenerated. @@ -85,8 +85,9 @@ func (client GroupClient) CreatePreparer(resourceGroupName string, name string, "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-04-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -153,8 +154,9 @@ func (client GroupClient) DeletePreparer(resourceGroupName string, name string, "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-04-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -227,8 +229,9 @@ func (client GroupClient) ExportDataPreparer(resourceGroupName string, name stri "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-04-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -255,7 +258,7 @@ func (client GroupClient) ExportDataResponder(resp *http.Response) (result autor err = autorest.Respond( resp, client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + azure.WithErrorUnlessStatusCode(http.StatusAccepted, http.StatusOK, http.StatusNoContent), autorest.ByClosing()) result.Response = resp return @@ -266,7 +269,7 @@ func (client GroupClient) ExportDataResponder(resp *http.Response) (result autor // // resourceGroupName is the name of the resource group. name is the name of the // Redis cache. parameters is specifies which Redis node(s) to reboot. -func (client GroupClient) ForceReboot(resourceGroupName string, name string, parameters RebootParameters) (result autorest.Response, err error) { +func (client GroupClient) ForceReboot(resourceGroupName string, name string, parameters RebootParameters) (result ForceRebootResponse, err error) { req, err := client.ForceRebootPreparer(resourceGroupName, name, parameters) if err != nil { return result, autorest.NewErrorWithError(err, "redis.GroupClient", "ForceReboot", nil, "Failure preparing request") @@ -274,7 +277,7 @@ func (client GroupClient) ForceReboot(resourceGroupName string, name string, par resp, err := client.ForceRebootSender(req) if err != nil { - result.Response = resp + result.Response = autorest.Response{Response: resp} return result, autorest.NewErrorWithError(err, "redis.GroupClient", "ForceReboot", resp, "Failure sending request") } @@ -294,8 +297,9 @@ func (client GroupClient) ForceRebootPreparer(resourceGroupName string, name str "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-04-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -316,13 +320,14 @@ func (client GroupClient) ForceRebootSender(req *http.Request) (*http.Response, // ForceRebootResponder handles the response to the ForceReboot request. The method always // closes the http.Response Body. -func (client GroupClient) ForceRebootResponder(resp *http.Response) (result autorest.Response, err error) { +func (client GroupClient) ForceRebootResponder(resp *http.Response) (result ForceRebootResponse, err error) { err = autorest.Respond( resp, client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) - result.Response = resp + result.Response = autorest.Response{Response: resp} return } @@ -358,8 +363,9 @@ func (client GroupClient) GetPreparer(resourceGroupName string, name string) (*h "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-04-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -430,8 +436,9 @@ func (client GroupClient) ImportDataPreparer(resourceGroupName string, name stri "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-04-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -458,7 +465,7 @@ func (client GroupClient) ImportDataResponder(resp *http.Response) (result autor err = autorest.Respond( resp, client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + azure.WithErrorUnlessStatusCode(http.StatusAccepted, http.StatusOK, http.StatusNoContent), autorest.ByClosing()) result.Response = resp return @@ -491,8 +498,9 @@ func (client GroupClient) ListPreparer() (*http.Request, error) { "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-04-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -576,8 +584,9 @@ func (client GroupClient) ListByResourceGroupPreparer(resourceGroupName string) "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-04-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -664,8 +673,9 @@ func (client GroupClient) ListKeysPreparer(resourceGroupName string, name string "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-04-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -728,8 +738,9 @@ func (client GroupClient) RegenerateKeyPreparer(resourceGroupName string, name s "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-04-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -794,8 +805,9 @@ func (client GroupClient) UpdatePreparer(resourceGroupName string, name string, "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-04-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( diff --git a/arm/redis/version.go b/arm/redis/version.go old mode 100644 new mode 100755 index 6f6645623e2c..76457398d4bf --- a/arm/redis/version.go +++ b/arm/redis/version.go @@ -18,43 +18,12 @@ package redis // Changes may cause incorrect behavior and will be lost if the code is // regenerated. -import ( - "bytes" - "fmt" - "strings" -) - -const ( - major = "8" - minor = "1" - patch = "0" - tag = "beta" - userAgentFormat = "Azure-SDK-For-Go/%s arm-%s/%s" -) - -// cached results of UserAgent and Version to prevent repeated operations. -var ( - userAgent string - version string -) - // UserAgent returns the UserAgent string to use when sending http.Requests. func UserAgent() string { - if userAgent == "" { - userAgent = fmt.Sprintf(userAgentFormat, Version(), "redis", "2016-04-01") - } - return userAgent + return "Azure-SDK-For-Go/v9.0.0-beta arm-redis/2016-04-01" } // Version returns the semantic version (see http://semver.org) of the client. func Version() string { - if version == "" { - versionBuilder := bytes.NewBufferString(fmt.Sprintf("%s.%s.%s", major, minor, patch)) - if tag != "" { - versionBuilder.WriteRune('-') - versionBuilder.WriteString(strings.TrimPrefix(tag, "-")) - } - version = string(versionBuilder.Bytes()) - } - return version + return "v9.0.0-beta" } diff --git a/arm/resources/locks/client.go b/arm/resources/locks/client.go old mode 100644 new mode 100755 index e5cb193a3604..fdcf88219c08 --- a/arm/resources/locks/client.go +++ b/arm/resources/locks/client.go @@ -27,9 +27,6 @@ import ( ) const ( - // APIVersion is the version of the Locks - APIVersion = "2016-09-01" - // DefaultBaseURI is the default URI used for the service Locks DefaultBaseURI = "https://management.azure.com" ) @@ -38,7 +35,6 @@ const ( type ManagementClient struct { autorest.Client BaseURI string - APIVersion string SubscriptionID string } @@ -52,7 +48,6 @@ func NewWithBaseURI(baseURI string, subscriptionID string) ManagementClient { return ManagementClient{ Client: autorest.NewClientWithUserAgent(UserAgent()), BaseURI: baseURI, - APIVersion: APIVersion, SubscriptionID: subscriptionID, } } diff --git a/arm/resources/locks/managementlocks.go b/arm/resources/locks/managementlocks.go old mode 100644 new mode 100755 index f5ef1427d9ef..3b55c26934a1 --- a/arm/resources/locks/managementlocks.go +++ b/arm/resources/locks/managementlocks.go @@ -91,8 +91,9 @@ func (client ManagementLocksClient) CreateOrUpdateAtResourceGroupLevelPreparer(r "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-09-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -180,8 +181,9 @@ func (client ManagementLocksClient) CreateOrUpdateAtResourceLevelPreparer(resour "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-09-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -255,8 +257,9 @@ func (client ManagementLocksClient) CreateOrUpdateAtSubscriptionLevelPreparer(lo "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-09-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -330,8 +333,9 @@ func (client ManagementLocksClient) CreateOrUpdateByScopePreparer(scope string, "scope": autorest.Encode("path", scope), } + const APIVersion = "2016-09-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -406,8 +410,9 @@ func (client ManagementLocksClient) DeleteAtResourceGroupLevelPreparer(resourceG "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-09-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -487,8 +492,9 @@ func (client ManagementLocksClient) DeleteAtResourceLevelPreparer(resourceGroupN "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-09-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -550,8 +556,9 @@ func (client ManagementLocksClient) DeleteAtSubscriptionLevelPreparer(lockName s "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-09-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -610,8 +617,9 @@ func (client ManagementLocksClient) DeleteByScopePreparer(scope string, lockName "scope": autorest.Encode("path", scope), } + const APIVersion = "2016-09-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -680,8 +688,9 @@ func (client ManagementLocksClient) GetAtResourceGroupLevelPreparer(resourceGrou "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-09-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -759,8 +768,9 @@ func (client ManagementLocksClient) GetAtResourceLevelPreparer(resourceGroupName "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-09-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -820,8 +830,9 @@ func (client ManagementLocksClient) GetAtSubscriptionLevelPreparer(lockName stri "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-09-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -881,8 +892,9 @@ func (client ManagementLocksClient) GetByScopePreparer(scope string, lockName st "scope": autorest.Encode("path", scope), } + const APIVersion = "2016-09-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -951,8 +963,9 @@ func (client ManagementLocksClient) ListAtResourceGroupLevelPreparer(resourceGro "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-09-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } if len(filter) > 0 { queryParameters["$filter"] = autorest.Encode("query", filter) @@ -1057,8 +1070,9 @@ func (client ManagementLocksClient) ListAtResourceLevelPreparer(resourceGroupNam "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-09-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } if len(filter) > 0 { queryParameters["$filter"] = autorest.Encode("query", filter) @@ -1144,8 +1158,9 @@ func (client ManagementLocksClient) ListAtSubscriptionLevelPreparer(filter strin "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-09-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } if len(filter) > 0 { queryParameters["$filter"] = autorest.Encode("query", filter) diff --git a/arm/resources/locks/models.go b/arm/resources/locks/models.go old mode 100644 new mode 100755 diff --git a/arm/resources/locks/version.go b/arm/resources/locks/version.go old mode 100644 new mode 100755 index 8f3b26bb4174..6a415b6b4f2c --- a/arm/resources/locks/version.go +++ b/arm/resources/locks/version.go @@ -18,43 +18,12 @@ package locks // Changes may cause incorrect behavior and will be lost if the code is // regenerated. -import ( - "bytes" - "fmt" - "strings" -) - -const ( - major = "8" - minor = "1" - patch = "0" - tag = "beta" - userAgentFormat = "Azure-SDK-For-Go/%s arm-%s/%s" -) - -// cached results of UserAgent and Version to prevent repeated operations. -var ( - userAgent string - version string -) - // UserAgent returns the UserAgent string to use when sending http.Requests. func UserAgent() string { - if userAgent == "" { - userAgent = fmt.Sprintf(userAgentFormat, Version(), "locks", "2016-09-01") - } - return userAgent + return "Azure-SDK-For-Go/v9.0.0-beta arm-locks/2016-09-01" } // Version returns the semantic version (see http://semver.org) of the client. func Version() string { - if version == "" { - versionBuilder := bytes.NewBufferString(fmt.Sprintf("%s.%s.%s", major, minor, patch)) - if tag != "" { - versionBuilder.WriteRune('-') - versionBuilder.WriteString(strings.TrimPrefix(tag, "-")) - } - version = string(versionBuilder.Bytes()) - } - return version + return "v9.0.0-beta" } diff --git a/arm/resources/policy/assignments.go b/arm/resources/policy/assignments.go old mode 100644 new mode 100755 index a5c2fb10937d..afbdcfaddab4 --- a/arm/resources/policy/assignments.go +++ b/arm/resources/policy/assignments.go @@ -76,8 +76,9 @@ func (client AssignmentsClient) CreatePreparer(scope string, policyAssignmentNam "scope": scope, } + const APIVersion = "2016-12-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -148,8 +149,9 @@ func (client AssignmentsClient) CreateByIDPreparer(policyAssignmentID string, pa "policyAssignmentId": policyAssignmentID, } + const APIVersion = "2016-12-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -212,8 +214,9 @@ func (client AssignmentsClient) DeletePreparer(scope string, policyAssignmentNam "scope": scope, } + const APIVersion = "2016-12-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -279,8 +282,9 @@ func (client AssignmentsClient) DeleteByIDPreparer(policyAssignmentID string) (* "policyAssignmentId": policyAssignmentID, } + const APIVersion = "2016-12-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -341,8 +345,9 @@ func (client AssignmentsClient) GetPreparer(scope string, policyAssignmentName s "scope": scope, } + const APIVersion = "2016-12-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -407,8 +412,9 @@ func (client AssignmentsClient) GetByIDPreparer(policyAssignmentID string) (*htt "policyAssignmentId": policyAssignmentID, } + const APIVersion = "2016-12-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -467,8 +473,9 @@ func (client AssignmentsClient) ListPreparer(filter string) (*http.Request, erro "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-12-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } if len(filter) > 0 { queryParameters["$filter"] = autorest.Encode("query", filter) @@ -571,8 +578,9 @@ func (client AssignmentsClient) ListForResourcePreparer(resourceGroupName string "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-12-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } if len(filter) > 0 { queryParameters["$filter"] = autorest.Encode("query", filter) @@ -668,8 +676,9 @@ func (client AssignmentsClient) ListForResourceGroupPreparer(resourceGroupName s "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-12-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } if len(filter) > 0 { queryParameters["$filter"] = filter diff --git a/arm/resources/policy/client.go b/arm/resources/policy/client.go old mode 100644 new mode 100755 index 8cdad0e5bf10..e3338811d63e --- a/arm/resources/policy/client.go +++ b/arm/resources/policy/client.go @@ -28,9 +28,6 @@ import ( ) const ( - // APIVersion is the version of the Policy - APIVersion = "2016-12-01" - // DefaultBaseURI is the default URI used for the service Policy DefaultBaseURI = "https://management.azure.com" ) @@ -39,7 +36,6 @@ const ( type ManagementClient struct { autorest.Client BaseURI string - APIVersion string SubscriptionID string } @@ -53,7 +49,6 @@ func NewWithBaseURI(baseURI string, subscriptionID string) ManagementClient { return ManagementClient{ Client: autorest.NewClientWithUserAgent(UserAgent()), BaseURI: baseURI, - APIVersion: APIVersion, SubscriptionID: subscriptionID, } } diff --git a/arm/resources/policy/definitions.go b/arm/resources/policy/definitions.go old mode 100644 new mode 100755 index dba2b49a5b2e..97860782962c --- a/arm/resources/policy/definitions.go +++ b/arm/resources/policy/definitions.go @@ -72,8 +72,9 @@ func (client DefinitionsClient) CreateOrUpdatePreparer(policyDefinitionName stri "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-12-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -135,8 +136,9 @@ func (client DefinitionsClient) DeletePreparer(policyDefinitionName string) (*ht "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-12-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -195,8 +197,9 @@ func (client DefinitionsClient) GetPreparer(policyDefinitionName string) (*http. "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-12-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -255,8 +258,9 @@ func (client DefinitionsClient) ListPreparer(filter string) (*http.Request, erro "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-12-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } if len(filter) > 0 { queryParameters["$filter"] = autorest.Encode("query", filter) diff --git a/arm/resources/policy/models.go b/arm/resources/policy/models.go old mode 100644 new mode 100755 diff --git a/arm/resources/policy/version.go b/arm/resources/policy/version.go old mode 100644 new mode 100755 index 643433ac37b5..40fd51c5637f --- a/arm/resources/policy/version.go +++ b/arm/resources/policy/version.go @@ -18,43 +18,12 @@ package policy // Changes may cause incorrect behavior and will be lost if the code is // regenerated. -import ( - "bytes" - "fmt" - "strings" -) - -const ( - major = "8" - minor = "1" - patch = "0" - tag = "beta" - userAgentFormat = "Azure-SDK-For-Go/%s arm-%s/%s" -) - -// cached results of UserAgent and Version to prevent repeated operations. -var ( - userAgent string - version string -) - // UserAgent returns the UserAgent string to use when sending http.Requests. func UserAgent() string { - if userAgent == "" { - userAgent = fmt.Sprintf(userAgentFormat, Version(), "policy", "2016-12-01") - } - return userAgent + return "Azure-SDK-For-Go/v9.0.0-beta arm-policy/2016-12-01" } // Version returns the semantic version (see http://semver.org) of the client. func Version() string { - if version == "" { - versionBuilder := bytes.NewBufferString(fmt.Sprintf("%s.%s.%s", major, minor, patch)) - if tag != "" { - versionBuilder.WriteRune('-') - versionBuilder.WriteString(strings.TrimPrefix(tag, "-")) - } - version = string(versionBuilder.Bytes()) - } - return version + return "v9.0.0-beta" } diff --git a/arm/resources/resources/client.go b/arm/resources/resources/client.go old mode 100644 new mode 100755 index d994e08b3e15..3e13c72f95cd --- a/arm/resources/resources/client.go +++ b/arm/resources/resources/client.go @@ -27,9 +27,6 @@ import ( ) const ( - // APIVersion is the version of the Resources - APIVersion = "2016-09-01" - // DefaultBaseURI is the default URI used for the service Resources DefaultBaseURI = "https://management.azure.com" ) @@ -38,7 +35,6 @@ const ( type ManagementClient struct { autorest.Client BaseURI string - APIVersion string SubscriptionID string } @@ -52,7 +48,6 @@ func NewWithBaseURI(baseURI string, subscriptionID string) ManagementClient { return ManagementClient{ Client: autorest.NewClientWithUserAgent(UserAgent()), BaseURI: baseURI, - APIVersion: APIVersion, SubscriptionID: subscriptionID, } } diff --git a/arm/resources/resources/deploymentoperations.go b/arm/resources/resources/deploymentoperations.go old mode 100644 new mode 100755 index 58f470f3edeb..353d65049ed0 --- a/arm/resources/resources/deploymentoperations.go +++ b/arm/resources/resources/deploymentoperations.go @@ -89,8 +89,9 @@ func (client DeploymentOperationsClient) GetPreparer(resourceGroupName string, d "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-09-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -165,8 +166,9 @@ func (client DeploymentOperationsClient) ListPreparer(resourceGroupName string, "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-09-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } if top != nil { queryParameters["$top"] = autorest.Encode("query", *top) diff --git a/arm/resources/resources/deployments.go b/arm/resources/resources/deployments.go old mode 100644 new mode 100755 index bd1e702ca371..42b77def77ff --- a/arm/resources/resources/deployments.go +++ b/arm/resources/resources/deployments.go @@ -89,8 +89,9 @@ func (client DeploymentsClient) CancelPreparer(resourceGroupName string, deploym "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-09-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -164,8 +165,9 @@ func (client DeploymentsClient) CheckExistencePreparer(resourceGroupName string, "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-09-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -214,7 +216,7 @@ func (client DeploymentsClient) CreateOrUpdate(resourceGroupName string, deploym {Target: "deploymentName", Name: validation.MinLength, Rule: 1, Chain: nil}, {Target: "deploymentName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.Properties", Name: validation.Null, Rule: false, + Constraints: []validation.Constraint{{Target: "parameters.Properties", Name: validation.Null, Rule: true, Chain: []validation.Constraint{{Target: "parameters.Properties.TemplateLink", Name: validation.Null, Rule: false, Chain: []validation.Constraint{{Target: "parameters.Properties.TemplateLink.URI", Name: validation.Null, Rule: true, Chain: nil}}}, {Target: "parameters.Properties.ParametersLink", Name: validation.Null, Rule: false, @@ -250,8 +252,9 @@ func (client DeploymentsClient) CreateOrUpdatePreparer(resourceGroupName string, "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-09-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -341,8 +344,9 @@ func (client DeploymentsClient) DeletePreparer(resourceGroupName string, deploym "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-09-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -418,8 +422,9 @@ func (client DeploymentsClient) ExportTemplatePreparer(resourceGroupName string, "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-09-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -493,8 +498,9 @@ func (client DeploymentsClient) GetPreparer(resourceGroupName string, deployment "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-09-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -566,8 +572,9 @@ func (client DeploymentsClient) ListPreparer(resourceGroupName string, filter st "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-09-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } if len(filter) > 0 { queryParameters["$filter"] = autorest.Encode("query", filter) @@ -644,7 +651,7 @@ func (client DeploymentsClient) Validate(resourceGroupName string, deploymentNam {Target: "deploymentName", Name: validation.MinLength, Rule: 1, Chain: nil}, {Target: "deploymentName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.Properties", Name: validation.Null, Rule: false, + Constraints: []validation.Constraint{{Target: "parameters.Properties", Name: validation.Null, Rule: true, Chain: []validation.Constraint{{Target: "parameters.Properties.TemplateLink", Name: validation.Null, Rule: false, Chain: []validation.Constraint{{Target: "parameters.Properties.TemplateLink.URI", Name: validation.Null, Rule: true, Chain: nil}}}, {Target: "parameters.Properties.ParametersLink", Name: validation.Null, Rule: false, @@ -680,8 +687,9 @@ func (client DeploymentsClient) ValidatePreparer(resourceGroupName string, deplo "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-09-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( diff --git a/arm/resources/resources/groups.go b/arm/resources/resources/groups.go old mode 100644 new mode 100755 index 084cfe21e4e1..bc0f882c0f99 --- a/arm/resources/resources/groups.go +++ b/arm/resources/resources/groups.go @@ -80,8 +80,9 @@ func (client GroupsClient) CheckExistencePreparer(resourceGroupName string) (*ht "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-09-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -151,8 +152,9 @@ func (client GroupsClient) CreateOrUpdatePreparer(resourceGroupName string, para "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-09-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -227,8 +229,9 @@ func (client GroupsClient) DeletePreparer(resourceGroupName string, cancel <-cha "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-09-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -298,8 +301,9 @@ func (client GroupsClient) ExportTemplatePreparer(resourceGroupName string, para "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-09-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -370,8 +374,9 @@ func (client GroupsClient) GetPreparer(resourceGroupName string) (*http.Request, "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-09-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -431,8 +436,9 @@ func (client GroupsClient) ListPreparer(filter string, top *int32) (*http.Reques "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-09-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } if len(filter) > 0 { queryParameters["$filter"] = autorest.Encode("query", filter) @@ -533,8 +539,9 @@ func (client GroupsClient) ListResourcesPreparer(resourceGroupName string, filte "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-09-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } if len(filter) > 0 { queryParameters["$filter"] = autorest.Encode("query", filter) @@ -639,8 +646,9 @@ func (client GroupsClient) PatchPreparer(resourceGroupName string, parameters Gr "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-09-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( diff --git a/arm/resources/resources/models.go b/arm/resources/resources/models.go old mode 100644 new mode 100755 diff --git a/arm/resources/resources/providers.go b/arm/resources/resources/providers.go old mode 100644 new mode 100755 index 827e49dd5229..ea6b45028a27 --- a/arm/resources/resources/providers.go +++ b/arm/resources/resources/providers.go @@ -73,8 +73,9 @@ func (client ProvidersClient) GetPreparer(resourceProviderNamespace string, expa "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-09-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } if len(expand) > 0 { queryParameters["$expand"] = autorest.Encode("query", expand) @@ -140,8 +141,9 @@ func (client ProvidersClient) ListPreparer(top *int32, expand string) (*http.Req "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-09-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } if top != nil { queryParameters["$top"] = autorest.Encode("query", *top) @@ -232,8 +234,9 @@ func (client ProvidersClient) RegisterPreparer(resourceProviderNamespace string) "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-09-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -294,8 +297,9 @@ func (client ProvidersClient) UnregisterPreparer(resourceProviderNamespace strin "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-09-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( diff --git a/arm/resources/resources/resourcesgroup.go b/arm/resources/resources/resourcesgroup.go old mode 100644 new mode 100755 index 6b752cc815f6..f90828e2ea1a --- a/arm/resources/resources/resourcesgroup.go +++ b/arm/resources/resources/resourcesgroup.go @@ -87,8 +87,9 @@ func (client GroupClient) CheckExistencePreparer(resourceGroupName string, resou "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-09-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -148,8 +149,9 @@ func (client GroupClient) CheckExistenceByIDPreparer(resourceID string) (*http.R "resourceId": resourceID, } + const APIVersion = "2016-09-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -230,8 +232,9 @@ func (client GroupClient) CreateOrUpdatePreparer(resourceGroupName string, resou "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-09-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -306,8 +309,9 @@ func (client GroupClient) CreateOrUpdateByIDPreparer(resourceID string, paramete "resourceId": resourceID, } + const APIVersion = "2016-09-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -388,8 +392,9 @@ func (client GroupClient) DeletePreparer(resourceGroupName string, resourceProvi "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-09-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -453,8 +458,9 @@ func (client GroupClient) DeleteByIDPreparer(resourceID string, cancel <-chan st "resourceId": resourceID, } + const APIVersion = "2016-09-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -531,8 +537,9 @@ func (client GroupClient) GetPreparer(resourceGroupName string, resourceProvider "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-09-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -593,8 +600,9 @@ func (client GroupClient) GetByIDPreparer(resourceID string) (*http.Request, err "resourceId": resourceID, } + const APIVersion = "2016-09-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -655,8 +663,9 @@ func (client GroupClient) ListPreparer(filter string, expand string, top *int32) "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-09-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } if len(filter) > 0 { queryParameters["$filter"] = autorest.Encode("query", filter) @@ -764,8 +773,9 @@ func (client GroupClient) MoveResourcesPreparer(sourceResourceGroupName string, "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-09-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( diff --git a/arm/resources/resources/tags.go b/arm/resources/resources/tags.go old mode 100644 new mode 100755 index d9be4a4b13d6..18a3d0e46918 --- a/arm/resources/resources/tags.go +++ b/arm/resources/resources/tags.go @@ -72,8 +72,9 @@ func (client TagsClient) CreateOrUpdatePreparer(tagName string) (*http.Request, "tagName": autorest.Encode("path", tagName), } + const APIVersion = "2016-09-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -135,8 +136,9 @@ func (client TagsClient) CreateOrUpdateValuePreparer(tagName string, tagValue st "tagValue": autorest.Encode("path", tagValue), } + const APIVersion = "2016-09-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -197,8 +199,9 @@ func (client TagsClient) DeletePreparer(tagName string) (*http.Request, error) { "tagName": autorest.Encode("path", tagName), } + const APIVersion = "2016-09-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -258,8 +261,9 @@ func (client TagsClient) DeleteValuePreparer(tagName string, tagValue string) (* "tagValue": autorest.Encode("path", tagValue), } + const APIVersion = "2016-09-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -316,8 +320,9 @@ func (client TagsClient) ListPreparer() (*http.Request, error) { "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-09-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( diff --git a/arm/resources/resources/version.go b/arm/resources/resources/version.go old mode 100644 new mode 100755 index 391e5ffb758c..dd8330d7355e --- a/arm/resources/resources/version.go +++ b/arm/resources/resources/version.go @@ -18,43 +18,12 @@ package resources // Changes may cause incorrect behavior and will be lost if the code is // regenerated. -import ( - "bytes" - "fmt" - "strings" -) - -const ( - major = "8" - minor = "1" - patch = "0" - tag = "beta" - userAgentFormat = "Azure-SDK-For-Go/%s arm-%s/%s" -) - -// cached results of UserAgent and Version to prevent repeated operations. -var ( - userAgent string - version string -) - // UserAgent returns the UserAgent string to use when sending http.Requests. func UserAgent() string { - if userAgent == "" { - userAgent = fmt.Sprintf(userAgentFormat, Version(), "resources", "2016-09-01") - } - return userAgent + return "Azure-SDK-For-Go/v9.0.0-beta arm-resources/2016-09-01" } // Version returns the semantic version (see http://semver.org) of the client. func Version() string { - if version == "" { - versionBuilder := bytes.NewBufferString(fmt.Sprintf("%s.%s.%s", major, minor, patch)) - if tag != "" { - versionBuilder.WriteRune('-') - versionBuilder.WriteString(strings.TrimPrefix(tag, "-")) - } - version = string(versionBuilder.Bytes()) - } - return version + return "v9.0.0-beta" } diff --git a/arm/scheduler/client.go b/arm/scheduler/client.go old mode 100644 new mode 100755 index 6d90b5d03832..4d99f6f11d38 --- a/arm/scheduler/client.go +++ b/arm/scheduler/client.go @@ -27,9 +27,6 @@ import ( ) const ( - // APIVersion is the version of the Scheduler - APIVersion = "2016-03-01" - // DefaultBaseURI is the default URI used for the service Scheduler DefaultBaseURI = "https://management.azure.com" ) @@ -38,7 +35,6 @@ const ( type ManagementClient struct { autorest.Client BaseURI string - APIVersion string SubscriptionID string } @@ -52,7 +48,6 @@ func NewWithBaseURI(baseURI string, subscriptionID string) ManagementClient { return ManagementClient{ Client: autorest.NewClientWithUserAgent(UserAgent()), BaseURI: baseURI, - APIVersion: APIVersion, SubscriptionID: subscriptionID, } } diff --git a/arm/scheduler/jobcollections.go b/arm/scheduler/jobcollections.go old mode 100644 new mode 100755 index 636827469672..19a34708ccfe --- a/arm/scheduler/jobcollections.go +++ b/arm/scheduler/jobcollections.go @@ -75,8 +75,9 @@ func (client JobCollectionsClient) CreateOrUpdatePreparer(resourceGroupName stri "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-03-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -142,8 +143,9 @@ func (client JobCollectionsClient) DeletePreparer(resourceGroupName string, jobC "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-03-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -209,8 +211,9 @@ func (client JobCollectionsClient) DisablePreparer(resourceGroupName string, job "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-03-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -276,8 +279,9 @@ func (client JobCollectionsClient) EnablePreparer(resourceGroupName string, jobC "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-03-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -340,8 +344,9 @@ func (client JobCollectionsClient) GetPreparer(resourceGroupName string, jobColl "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-03-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -401,8 +406,9 @@ func (client JobCollectionsClient) ListByResourceGroupPreparer(resourceGroupName "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-03-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -483,8 +489,9 @@ func (client JobCollectionsClient) ListBySubscriptionPreparer() (*http.Request, "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-03-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -570,8 +577,9 @@ func (client JobCollectionsClient) PatchPreparer(resourceGroupName string, jobCo "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-03-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( diff --git a/arm/scheduler/jobs.go b/arm/scheduler/jobs.go old mode 100644 new mode 100755 index 318f50523ddb..fcb23ac9fb34 --- a/arm/scheduler/jobs.go +++ b/arm/scheduler/jobs.go @@ -73,8 +73,9 @@ func (client JobsClient) CreateOrUpdatePreparer(resourceGroupName string, jobCol "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-03-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -139,8 +140,9 @@ func (client JobsClient) DeletePreparer(resourceGroupName string, jobCollectionN "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-03-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -202,8 +204,9 @@ func (client JobsClient) GetPreparer(resourceGroupName string, jobCollectionName "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-03-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -276,8 +279,9 @@ func (client JobsClient) ListPreparer(resourceGroupName string, jobCollectionNam "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-03-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } if top != nil { queryParameters["$top"] = autorest.Encode("query", *top) @@ -385,8 +389,9 @@ func (client JobsClient) ListJobHistoryPreparer(resourceGroupName string, jobCol "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-03-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } if top != nil { queryParameters["$top"] = autorest.Encode("query", *top) @@ -482,8 +487,9 @@ func (client JobsClient) PatchPreparer(resourceGroupName string, jobCollectionNa "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-03-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -548,8 +554,9 @@ func (client JobsClient) RunPreparer(resourceGroupName string, jobCollectionName "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-03-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( diff --git a/arm/scheduler/models.go b/arm/scheduler/models.go old mode 100644 new mode 100755 diff --git a/arm/scheduler/version.go b/arm/scheduler/version.go old mode 100644 new mode 100755 index b56e86a67188..4073af38577d --- a/arm/scheduler/version.go +++ b/arm/scheduler/version.go @@ -18,43 +18,12 @@ package scheduler // Changes may cause incorrect behavior and will be lost if the code is // regenerated. -import ( - "bytes" - "fmt" - "strings" -) - -const ( - major = "8" - minor = "1" - patch = "0" - tag = "beta" - userAgentFormat = "Azure-SDK-For-Go/%s arm-%s/%s" -) - -// cached results of UserAgent and Version to prevent repeated operations. -var ( - userAgent string - version string -) - // UserAgent returns the UserAgent string to use when sending http.Requests. func UserAgent() string { - if userAgent == "" { - userAgent = fmt.Sprintf(userAgentFormat, Version(), "scheduler", "2016-03-01") - } - return userAgent + return "Azure-SDK-For-Go/v9.0.0-beta arm-scheduler/2016-03-01" } // Version returns the semantic version (see http://semver.org) of the client. func Version() string { - if version == "" { - versionBuilder := bytes.NewBufferString(fmt.Sprintf("%s.%s.%s", major, minor, patch)) - if tag != "" { - versionBuilder.WriteRune('-') - versionBuilder.WriteString(strings.TrimPrefix(tag, "-")) - } - version = string(versionBuilder.Bytes()) - } - return version + return "v9.0.0-beta" } diff --git a/arm/search/adminkeys.go b/arm/search/adminkeys.go old mode 100644 new mode 100755 index e118dc715038..7e9bb6985f9c --- a/arm/search/adminkeys.go +++ b/arm/search/adminkeys.go @@ -79,8 +79,9 @@ func (client AdminKeysClient) GetPreparer(resourceGroupName string, searchServic "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2015-08-19" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -154,8 +155,9 @@ func (client AdminKeysClient) RegeneratePreparer(resourceGroupName string, searc "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2015-08-19" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( diff --git a/arm/search/client.go b/arm/search/client.go old mode 100644 new mode 100755 index 17bbd8a90269..06993d493433 --- a/arm/search/client.go +++ b/arm/search/client.go @@ -27,9 +27,6 @@ import ( ) const ( - // APIVersion is the version of the Search - APIVersion = "2015-08-19" - // DefaultBaseURI is the default URI used for the service Search DefaultBaseURI = "https://management.azure.com" ) @@ -38,7 +35,6 @@ const ( type ManagementClient struct { autorest.Client BaseURI string - APIVersion string SubscriptionID string } @@ -52,7 +48,6 @@ func NewWithBaseURI(baseURI string, subscriptionID string) ManagementClient { return ManagementClient{ Client: autorest.NewClientWithUserAgent(UserAgent()), BaseURI: baseURI, - APIVersion: APIVersion, SubscriptionID: subscriptionID, } } diff --git a/arm/search/models.go b/arm/search/models.go old mode 100644 new mode 100755 diff --git a/arm/search/querykeys.go b/arm/search/querykeys.go old mode 100644 new mode 100755 index d3c9bf1c951a..4d5a18eee203 --- a/arm/search/querykeys.go +++ b/arm/search/querykeys.go @@ -81,8 +81,9 @@ func (client QueryKeysClient) CreatePreparer(resourceGroupName string, searchSer "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2015-08-19" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -156,8 +157,9 @@ func (client QueryKeysClient) DeletePreparer(resourceGroupName string, searchSer "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2015-08-19" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -227,8 +229,9 @@ func (client QueryKeysClient) ListBySearchServicePreparer(resourceGroupName stri "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2015-08-19" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( diff --git a/arm/search/services.go b/arm/search/services.go old mode 100644 new mode 100755 index badcf15590b7..7f11e1ef87fc --- a/arm/search/services.go +++ b/arm/search/services.go @@ -84,8 +84,9 @@ func (client ServicesClient) CheckNameAvailabilityPreparer(checkNameAvailability "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2015-08-19" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -181,8 +182,9 @@ func (client ServicesClient) CreateOrUpdatePreparer(resourceGroupName string, se "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2015-08-19" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -255,8 +257,9 @@ func (client ServicesClient) DeletePreparer(resourceGroupName string, searchServ "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2015-08-19" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -325,8 +328,9 @@ func (client ServicesClient) GetPreparer(resourceGroupName string, searchService "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2015-08-19" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -395,8 +399,9 @@ func (client ServicesClient) ListByResourceGroupPreparer(resourceGroupName strin "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2015-08-19" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( diff --git a/arm/search/version.go b/arm/search/version.go old mode 100644 new mode 100755 index 61189d2c2ffa..0c703018a859 --- a/arm/search/version.go +++ b/arm/search/version.go @@ -18,43 +18,12 @@ package search // Changes may cause incorrect behavior and will be lost if the code is // regenerated. -import ( - "bytes" - "fmt" - "strings" -) - -const ( - major = "8" - minor = "1" - patch = "0" - tag = "beta" - userAgentFormat = "Azure-SDK-For-Go/%s arm-%s/%s" -) - -// cached results of UserAgent and Version to prevent repeated operations. -var ( - userAgent string - version string -) - // UserAgent returns the UserAgent string to use when sending http.Requests. func UserAgent() string { - if userAgent == "" { - userAgent = fmt.Sprintf(userAgentFormat, Version(), "search", "2015-08-19") - } - return userAgent + return "Azure-SDK-For-Go/v9.0.0-beta arm-search/2015-08-19" } // Version returns the semantic version (see http://semver.org) of the client. func Version() string { - if version == "" { - versionBuilder := bytes.NewBufferString(fmt.Sprintf("%s.%s.%s", major, minor, patch)) - if tag != "" { - versionBuilder.WriteRune('-') - versionBuilder.WriteString(strings.TrimPrefix(tag, "-")) - } - version = string(versionBuilder.Bytes()) - } - return version + return "v9.0.0-beta" } diff --git a/arm/servermanagement/client.go b/arm/servermanagement/client.go old mode 100644 new mode 100755 index 14b3e0cc4d90..ab6f67d75377 --- a/arm/servermanagement/client.go +++ b/arm/servermanagement/client.go @@ -27,9 +27,6 @@ import ( ) const ( - // APIVersion is the version of the Servermanagement - APIVersion = "2016-07-01-preview" - // DefaultBaseURI is the default URI used for the service Servermanagement DefaultBaseURI = "https://management.azure.com" ) @@ -38,7 +35,6 @@ const ( type ManagementClient struct { autorest.Client BaseURI string - APIVersion string SubscriptionID string } @@ -52,7 +48,6 @@ func NewWithBaseURI(baseURI string, subscriptionID string) ManagementClient { return ManagementClient{ Client: autorest.NewClientWithUserAgent(UserAgent()), BaseURI: baseURI, - APIVersion: APIVersion, SubscriptionID: subscriptionID, } } diff --git a/arm/servermanagement/gateway.go b/arm/servermanagement/gateway.go old mode 100644 new mode 100755 index dfdc02b09057..1567ba1e445e --- a/arm/servermanagement/gateway.go +++ b/arm/servermanagement/gateway.go @@ -88,8 +88,9 @@ func (client GatewayClient) CreatePreparer(resourceGroupName string, gatewayName "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-07-01-preview" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -166,8 +167,9 @@ func (client GatewayClient) DeletePreparer(resourceGroupName string, gatewayName "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-07-01-preview" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -242,8 +244,9 @@ func (client GatewayClient) GetPreparer(resourceGroupName string, gatewayName st "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-07-01-preview" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } if len(string(expand)) > 0 { queryParameters["$expand"] = autorest.Encode("query", expand) @@ -322,8 +325,9 @@ func (client GatewayClient) GetProfilePreparer(resourceGroupName string, gateway "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-07-01-preview" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -381,8 +385,9 @@ func (client GatewayClient) ListPreparer() (*http.Request, error) { "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-07-01-preview" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -474,8 +479,9 @@ func (client GatewayClient) ListForResourceGroupPreparer(resourceGroupName strin "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-07-01-preview" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -576,8 +582,9 @@ func (client GatewayClient) RegenerateProfilePreparer(resourceGroupName string, "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-07-01-preview" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -656,8 +663,9 @@ func (client GatewayClient) UpdatePreparer(resourceGroupName string, gatewayName "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-07-01-preview" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -736,8 +744,9 @@ func (client GatewayClient) UpgradePreparer(resourceGroupName string, gatewayNam "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-07-01-preview" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( diff --git a/arm/servermanagement/models.go b/arm/servermanagement/models.go old mode 100644 new mode 100755 diff --git a/arm/servermanagement/node.go b/arm/servermanagement/node.go old mode 100644 new mode 100755 index a99f01464a57..e66a1ab10e2f --- a/arm/servermanagement/node.go +++ b/arm/servermanagement/node.go @@ -88,8 +88,9 @@ func (client NodeClient) CreatePreparer(resourceGroupName string, nodeName strin "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-07-01-preview" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -166,8 +167,9 @@ func (client NodeClient) DeletePreparer(resourceGroupName string, nodeName strin "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-07-01-preview" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -240,8 +242,9 @@ func (client NodeClient) GetPreparer(resourceGroupName string, nodeName string) "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-07-01-preview" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -298,8 +301,9 @@ func (client NodeClient) ListPreparer() (*http.Request, error) { "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-07-01-preview" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -391,8 +395,9 @@ func (client NodeClient) ListForResourceGroupPreparer(resourceGroupName string) "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-07-01-preview" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -493,8 +498,9 @@ func (client NodeClient) UpdatePreparer(resourceGroupName string, nodeName strin "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-07-01-preview" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( diff --git a/arm/servermanagement/powershell.go b/arm/servermanagement/powershell.go old mode 100644 new mode 100755 index 925be9ee071e..e7289c0ab2ba --- a/arm/servermanagement/powershell.go +++ b/arm/servermanagement/powershell.go @@ -91,8 +91,9 @@ func (client PowerShellClient) CancelCommandPreparer(resourceGroupName string, n "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-07-01-preview" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -173,8 +174,9 @@ func (client PowerShellClient) CreateSessionPreparer(resourceGroupName string, n "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-07-01-preview" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -253,8 +255,9 @@ func (client PowerShellClient) GetCommandStatusPreparer(resourceGroupName string "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-07-01-preview" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } if len(string(expand)) > 0 { queryParameters["$expand"] = autorest.Encode("query", expand) @@ -338,8 +341,9 @@ func (client PowerShellClient) InvokeCommandPreparer(resourceGroupName string, n "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-07-01-preview" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -417,8 +421,9 @@ func (client PowerShellClient) ListSessionPreparer(resourceGroupName string, nod "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-07-01-preview" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -496,8 +501,9 @@ func (client PowerShellClient) TabCompletionPreparer(resourceGroupName string, n "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-07-01-preview" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -579,8 +585,9 @@ func (client PowerShellClient) UpdateCommandPreparer(resourceGroupName string, n "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-07-01-preview" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( diff --git a/arm/servermanagement/session.go b/arm/servermanagement/session.go old mode 100644 new mode 100755 index 6041b6c61eed..0ab3658db1d1 --- a/arm/servermanagement/session.go +++ b/arm/servermanagement/session.go @@ -88,8 +88,9 @@ func (client SessionClient) CreatePreparer(resourceGroupName string, nodeName st "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-07-01-preview" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -167,8 +168,9 @@ func (client SessionClient) DeletePreparer(resourceGroupName string, nodeName st "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-07-01-preview" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -242,8 +244,9 @@ func (client SessionClient) GetPreparer(resourceGroupName string, nodeName strin "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-07-01-preview" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( diff --git a/arm/servermanagement/version.go b/arm/servermanagement/version.go old mode 100644 new mode 100755 index c995fae3a62d..ebc4f3d41906 --- a/arm/servermanagement/version.go +++ b/arm/servermanagement/version.go @@ -18,43 +18,12 @@ package servermanagement // Changes may cause incorrect behavior and will be lost if the code is // regenerated. -import ( - "bytes" - "fmt" - "strings" -) - -const ( - major = "8" - minor = "1" - patch = "0" - tag = "beta" - userAgentFormat = "Azure-SDK-For-Go/%s arm-%s/%s" -) - -// cached results of UserAgent and Version to prevent repeated operations. -var ( - userAgent string - version string -) - // UserAgent returns the UserAgent string to use when sending http.Requests. func UserAgent() string { - if userAgent == "" { - userAgent = fmt.Sprintf(userAgentFormat, Version(), "servermanagement", "2016-07-01-preview") - } - return userAgent + return "Azure-SDK-For-Go/v9.0.0-beta arm-servermanagement/2016-07-01-preview" } // Version returns the semantic version (see http://semver.org) of the client. func Version() string { - if version == "" { - versionBuilder := bytes.NewBufferString(fmt.Sprintf("%s.%s.%s", major, minor, patch)) - if tag != "" { - versionBuilder.WriteRune('-') - versionBuilder.WriteString(strings.TrimPrefix(tag, "-")) - } - version = string(versionBuilder.Bytes()) - } - return version + return "v9.0.0-beta" } diff --git a/arm/servicebus/client.go b/arm/servicebus/client.go old mode 100644 new mode 100755 index ffd627270762..446baff17636 --- a/arm/servicebus/client.go +++ b/arm/servicebus/client.go @@ -18,7 +18,7 @@ package servicebus // See the License for the specific language governing permissions and // limitations under the License. // -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.0 +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 // Changes may cause incorrect behavior and will be lost if the code is // regenerated. @@ -27,9 +27,6 @@ import ( ) const ( - // APIVersion is the version of the Servicebus - APIVersion = "2015-08-01" - // DefaultBaseURI is the default URI used for the service Servicebus DefaultBaseURI = "https://management.azure.com" ) @@ -38,7 +35,6 @@ const ( type ManagementClient struct { autorest.Client BaseURI string - APIVersion string SubscriptionID string } @@ -52,7 +48,6 @@ func NewWithBaseURI(baseURI string, subscriptionID string) ManagementClient { return ManagementClient{ Client: autorest.NewClientWithUserAgent(UserAgent()), BaseURI: baseURI, - APIVersion: APIVersion, SubscriptionID: subscriptionID, } } diff --git a/arm/servicebus/models.go b/arm/servicebus/models.go old mode 100644 new mode 100755 index fe0a171125c6..f33b1ff8bdb8 --- a/arm/servicebus/models.go +++ b/arm/servicebus/models.go @@ -14,7 +14,7 @@ package servicebus // See the License for the specific language governing permissions and // limitations under the License. // -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.0 +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 // Changes may cause incorrect behavior and will be lost if the code is // regenerated. @@ -166,6 +166,42 @@ const ( SkuTierStandard SkuTier = "Standard" ) +// UnavailableReason enumerates the values for unavailable reason. +type UnavailableReason string + +const ( + // InvalidName specifies the invalid name state for unavailable reason. + InvalidName UnavailableReason = "InvalidName" + // NameInLockdown specifies the name in lockdown state for unavailable + // reason. + NameInLockdown UnavailableReason = "NameInLockdown" + // NameInUse specifies the name in use state for unavailable reason. + NameInUse UnavailableReason = "NameInUse" + // None specifies the none state for unavailable reason. + None UnavailableReason = "None" + // SubscriptionIsDisabled specifies the subscription is disabled state for + // unavailable reason. + SubscriptionIsDisabled UnavailableReason = "SubscriptionIsDisabled" + // TooManyNamespaceInCurrentSubscription specifies the too many namespace + // in current subscription state for unavailable reason. + TooManyNamespaceInCurrentSubscription UnavailableReason = "TooManyNamespaceInCurrentSubscription" +) + +// CheckNameAvailability is description of a Check Name availability request +// properties. +type CheckNameAvailability struct { + Name *string `json:"name,omitempty"` +} + +// CheckNameAvailabilityResult is description of a Check Name availability +// request properties. +type CheckNameAvailabilityResult struct { + autorest.Response `json:"-"` + NameAvailable *bool `json:"nameAvailable,omitempty"` + Reason UnavailableReason `json:"reason,omitempty"` + Message *string `json:"message,omitempty"` +} + // MessageCountDetails is message Count Details. type MessageCountDetails struct { ActiveMessageCount *int64 `json:"activeMessageCount,omitempty"` @@ -226,6 +262,47 @@ type NamespaceResource struct { *NamespaceProperties `json:"properties,omitempty"` } +// NamespaceUpdateParameters is parameters supplied to the Patch Namespace +// operation. +type NamespaceUpdateParameters struct { + Tags *map[string]*string `json:"tags,omitempty"` + Sku *Sku `json:"sku,omitempty"` +} + +// Operation is a ServiceBus REST API operation +type Operation struct { + Name *string `json:"name,omitempty"` + Display *OperationDisplay `json:"display,omitempty"` +} + +// OperationDisplay is the object that represents the operation. +type OperationDisplay struct { + Provider *string `json:"provider,omitempty"` + Resource *string `json:"resource,omitempty"` + Operation *string `json:"operation,omitempty"` +} + +// OperationListResult is result of the request to list ServiceBus 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 *[]Operation `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// OperationListResultPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client OperationListResult) OperationListResultPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + // QueueCreateOrUpdateParameters is parameters supplied to the Create Or Update // Queue operation. type QueueCreateOrUpdateParameters struct { @@ -253,27 +330,27 @@ func (client QueueListResult) QueueListResultPreparer() (*http.Request, error) { autorest.WithBaseURL(to.String(client.NextLink))) } -// QueueProperties is +// QueueProperties is the Queue Properties definition. type QueueProperties struct { - LockDuration *string `json:"lockDuration ,omitempty"` + LockDuration *string `json:"lockDuration,omitempty"` AccessedAt *date.Time `json:"accessedAt,omitempty"` AutoDeleteOnIdle *string `json:"autoDeleteOnIdle,omitempty"` - EntityAvailabilityStatus EntityAvailabilityStatus `json:"entityAvailabilityStatus ,omitempty"` + EntityAvailabilityStatus EntityAvailabilityStatus `json:"entityAvailabilityStatus,omitempty"` CreatedAt *date.Time `json:"createdAt,omitempty"` DefaultMessageTimeToLive *string `json:"defaultMessageTimeToLive,omitempty"` - DuplicateDetectionHistoryTimeWindow *string `json:"duplicateDetectionHistoryTimeWindow ,omitempty"` + DuplicateDetectionHistoryTimeWindow *string `json:"duplicateDetectionHistoryTimeWindow,omitempty"` EnableBatchedOperations *bool `json:"enableBatchedOperations,omitempty"` DeadLetteringOnMessageExpiration *bool `json:"deadLetteringOnMessageExpiration,omitempty"` EnableExpress *bool `json:"enableExpress,omitempty"` EnablePartitioning *bool `json:"enablePartitioning,omitempty"` IsAnonymousAccessible *bool `json:"isAnonymousAccessible,omitempty"` - MaxDeliveryCount *int32 `json:"maxDeliveryCount ,omitempty"` + MaxDeliveryCount *int32 `json:"maxDeliveryCount,omitempty"` MaxSizeInMegabytes *int64 `json:"maxSizeInMegabytes,omitempty"` - MessageCount *int64 `json:"messageCount ,omitempty"` + MessageCount *int64 `json:"messageCount,omitempty"` CountDetails *MessageCountDetails `json:"countDetails,omitempty"` RequiresDuplicateDetection *bool `json:"requiresDuplicateDetection,omitempty"` RequiresSession *bool `json:"requiresSession,omitempty"` - SizeInBytes *int64 `json:"sizeInBytes ,omitempty"` + SizeInBytes *int64 `json:"sizeInBytes,omitempty"` Status EntityStatus `json:"status,omitempty"` SupportOrdering *bool `json:"supportOrdering,omitempty"` UpdatedAt *date.Time `json:"updatedAt,omitempty"` @@ -282,11 +359,9 @@ type QueueProperties struct { // QueueResource is description of queue Resource. type QueueResource struct { autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` *QueueProperties `json:"properties,omitempty"` } @@ -296,13 +371,11 @@ type RegenerateKeysParameters struct { Policykey Policykey `json:"Policykey,omitempty"` } -// Resource is +// Resource is the Resource definition for other than namespace. type Resource struct { - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` } // ResourceListKeys is namespace/ServiceBus Connection String @@ -353,11 +426,9 @@ type SharedAccessAuthorizationRuleProperties struct { // authorization rule. type SharedAccessAuthorizationRuleResource struct { autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` *SharedAccessAuthorizationRuleProperties `json:"properties,omitempty"` } @@ -418,11 +489,9 @@ type SubscriptionProperties struct { // SubscriptionResource is description of subscription resource. type SubscriptionResource struct { autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` *SubscriptionProperties `json:"properties,omitempty"` } @@ -453,15 +522,15 @@ func (client TopicListResult) TopicListResultPreparer() (*http.Request, error) { autorest.WithBaseURL(to.String(client.NextLink))) } -// TopicProperties is +// TopicProperties is the Tpoic Properties definition. type TopicProperties struct { AccessedAt *date.Time `json:"accessedAt,omitempty"` AutoDeleteOnIdle *string `json:"autoDeleteOnIdle,omitempty"` - EntityAvailabilityStatus EntityAvailabilityStatus `json:"entityAvailabilityStatus ,omitempty"` + EntityAvailabilityStatus EntityAvailabilityStatus `json:"entityAvailabilityStatus,omitempty"` CreatedAt *date.Time `json:"createdAt,omitempty"` CountDetails *MessageCountDetails `json:"countDetails,omitempty"` DefaultMessageTimeToLive *string `json:"defaultMessageTimeToLive,omitempty"` - DuplicateDetectionHistoryTimeWindow *string `json:"duplicateDetectionHistoryTimeWindow ,omitempty"` + DuplicateDetectionHistoryTimeWindow *string `json:"duplicateDetectionHistoryTimeWindow,omitempty"` EnableBatchedOperations *bool `json:"enableBatchedOperations,omitempty"` EnableExpress *bool `json:"enableExpress,omitempty"` EnablePartitioning *bool `json:"enablePartitioning,omitempty"` @@ -481,10 +550,17 @@ type TopicProperties struct { // TopicResource is description of topic resource. type TopicResource struct { autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` *TopicProperties `json:"properties,omitempty"` } + +// TrackedResource is the Resource definition. +type TrackedResource struct { + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Location *string `json:"location,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` +} diff --git a/arm/servicebus/namespaces.go b/arm/servicebus/namespaces.go old mode 100644 new mode 100755 index 2163c230de43..724d1232266b --- a/arm/servicebus/namespaces.go +++ b/arm/servicebus/namespaces.go @@ -14,7 +14,7 @@ package servicebus // See the License for the specific language governing permissions and // limitations under the License. // -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.0 +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 // Changes may cause incorrect behavior and will be lost if the code is // regenerated. @@ -41,17 +41,89 @@ func NewNamespacesClientWithBaseURI(baseURI string, subscriptionID string) Names return NamespacesClient{NewWithBaseURI(baseURI, subscriptionID)} } +// CheckNameAvailabilityMethod check the give namespace name availability. +// +// parameters is parameters to check availability of the given namespace name +func (client NamespacesClient) CheckNameAvailabilityMethod(parameters CheckNameAvailability) (result CheckNameAvailabilityResult, err error) { + 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.NewErrorWithValidationError(err, "servicebus.NamespacesClient", "CheckNameAvailabilityMethod") + } + + req, err := client.CheckNameAvailabilityMethodPreparer(parameters) + if err != nil { + return result, autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "CheckNameAvailabilityMethod", nil, "Failure preparing request") + } + + resp, err := client.CheckNameAvailabilityMethodSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "CheckNameAvailabilityMethod", resp, "Failure sending request") + } + + result, err = client.CheckNameAvailabilityMethodResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "CheckNameAvailabilityMethod", resp, "Failure responding to request") + } + + return +} + +// CheckNameAvailabilityMethodPreparer prepares the CheckNameAvailabilityMethod request. +func (client NamespacesClient) CheckNameAvailabilityMethodPreparer(parameters CheckNameAvailability) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.ServiceBus/CheckNameAvailability", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CheckNameAvailabilityMethodSender sends the CheckNameAvailabilityMethod request. The method will close the +// http.Response Body if it receives an error. +func (client NamespacesClient) CheckNameAvailabilityMethodSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CheckNameAvailabilityMethodResponder handles the response to the CheckNameAvailabilityMethod request. The method always +// closes the http.Response Body. +func (client NamespacesClient) CheckNameAvailabilityMethodResponder(resp *http.Response) (result CheckNameAvailabilityResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + // CreateOrUpdate creates or updates a service namespace. Once created, this // namespace's resource manifest is immutable. This operation is idempotent. // This method may poll for completion. Polling can be canceled by passing the // cancel channel argument. The channel will be used to cancel polling and any // outstanding HTTP requests. // -// resourceGroupName is the name of the resource group. namespaceName is the -// namespace name. parameters is parameters supplied to create a namespace -// resource. +// resourceGroupName is name of the Resource group within the Azure +// subscription. namespaceName is the namespace name. parameters is parameters +// supplied to create a namespace resource. func (client NamespacesClient) CreateOrUpdate(resourceGroupName string, namespaceName string, parameters NamespaceCreateOrUpdateParameters, cancel <-chan struct{}) (result autorest.Response, err error) { if err := validation.Validate([]validation.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}}}}); err != nil { return result, validation.NewErrorWithValidationError(err, "servicebus.NamespacesClient", "CreateOrUpdate") @@ -84,8 +156,9 @@ func (client NamespacesClient) CreateOrUpdatePreparer(resourceGroupName string, "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2015-08-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -112,7 +185,7 @@ func (client NamespacesClient) CreateOrUpdateResponder(resp *http.Response) (res err = autorest.Respond( resp, client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), + azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK, http.StatusAccepted), autorest.ByClosing()) result.Response = resp return @@ -121,11 +194,21 @@ func (client NamespacesClient) CreateOrUpdateResponder(resp *http.Response) (res // CreateOrUpdateAuthorizationRule creates or updates an authorization rule for // a namespace. // -// resourceGroupName is the name of the resource group. namespaceName is the -// namespace name. authorizationRuleName is namespace authorization rule name. -// parameters is the shared access authorization rule. +// resourceGroupName is name of the Resource group within the Azure +// subscription. namespaceName is the namespace name authorizationRuleName is +// the authorizationrule name. parameters is the shared access authorization +// rule. func (client NamespacesClient) CreateOrUpdateAuthorizationRule(resourceGroupName string, namespaceName string, authorizationRuleName string, parameters SharedAccessAuthorizationRuleCreateOrUpdateParameters) (result SharedAccessAuthorizationRuleResource, err error) { if err := validation.Validate([]validation.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: namespaceName, + Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, + {TargetValue: authorizationRuleName, + Constraints: []validation.Constraint{{Target: "authorizationRuleName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "authorizationRuleName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: parameters, Constraints: []validation.Constraint{{Target: "parameters.SharedAccessAuthorizationRuleProperties", Name: validation.Null, Rule: false, Chain: []validation.Constraint{{Target: "parameters.SharedAccessAuthorizationRuleProperties.Rights", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { @@ -160,8 +243,9 @@ func (client NamespacesClient) CreateOrUpdateAuthorizationRulePreparer(resourceG "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2015-08-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -199,9 +283,19 @@ func (client NamespacesClient) CreateOrUpdateAuthorizationRuleResponder(resp *ht // The channel will be used to cancel polling and any outstanding HTTP // requests. // -// resourceGroupName is the name of the resource group. namespaceName is the -// namespace name. +// resourceGroupName is name of the Resource group within the Azure +// subscription. namespaceName is the namespace name func (client NamespacesClient) Delete(resourceGroupName string, namespaceName string, cancel <-chan struct{}) (result autorest.Response, err error) { + if err := validation.Validate([]validation.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: namespaceName, + Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "servicebus.NamespacesClient", "Delete") + } + req, err := client.DeletePreparer(resourceGroupName, namespaceName, cancel) if err != nil { return result, autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "Delete", nil, "Failure preparing request") @@ -229,8 +323,9 @@ func (client NamespacesClient) DeletePreparer(resourceGroupName string, namespac "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2015-08-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -263,9 +358,23 @@ func (client NamespacesClient) DeleteResponder(resp *http.Response) (result auto // DeleteAuthorizationRule deletes a namespace authorization rule. // -// resourceGroupName is the name of the resource group. namespaceName is the -// namespace name. authorizationRuleName is authorization rule name. +// resourceGroupName is name of the Resource group within the Azure +// subscription. namespaceName is the namespace name authorizationRuleName is +// the authorizationrule name. func (client NamespacesClient) DeleteAuthorizationRule(resourceGroupName string, namespaceName string, authorizationRuleName string) (result autorest.Response, err error) { + if err := validation.Validate([]validation.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: namespaceName, + Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, + {TargetValue: authorizationRuleName, + Constraints: []validation.Constraint{{Target: "authorizationRuleName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "authorizationRuleName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "servicebus.NamespacesClient", "DeleteAuthorizationRule") + } + req, err := client.DeleteAuthorizationRulePreparer(resourceGroupName, namespaceName, authorizationRuleName) if err != nil { return result, autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "DeleteAuthorizationRule", nil, "Failure preparing request") @@ -294,8 +403,9 @@ func (client NamespacesClient) DeleteAuthorizationRulePreparer(resourceGroupName "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2015-08-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -326,9 +436,19 @@ func (client NamespacesClient) DeleteAuthorizationRuleResponder(resp *http.Respo // Get gets a description for the specified namespace. // -// resourceGroupName is the name of the resource group. namespaceName is the -// namespace name. +// resourceGroupName is name of the Resource group within the Azure +// subscription. namespaceName is the namespace name func (client NamespacesClient) Get(resourceGroupName string, namespaceName string) (result NamespaceResource, err error) { + if err := validation.Validate([]validation.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: namespaceName, + Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "servicebus.NamespacesClient", "Get") + } + req, err := client.GetPreparer(resourceGroupName, namespaceName) if err != nil { return result, autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "Get", nil, "Failure preparing request") @@ -356,8 +476,9 @@ func (client NamespacesClient) GetPreparer(resourceGroupName string, namespaceNa "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2015-08-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -390,9 +511,23 @@ func (client NamespacesClient) GetResponder(resp *http.Response) (result Namespa // GetAuthorizationRule gets an authorization rule for a namespace by rule // name. // -// resourceGroupName is the name of the resource group. namespaceName is the -// namespace name. authorizationRuleName is authorization rule name. +// resourceGroupName is name of the Resource group within the Azure +// subscription. namespaceName is the namespace name authorizationRuleName is +// the authorizationrule name. func (client NamespacesClient) GetAuthorizationRule(resourceGroupName string, namespaceName string, authorizationRuleName string) (result SharedAccessAuthorizationRuleResource, err error) { + if err := validation.Validate([]validation.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: namespaceName, + Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, + {TargetValue: authorizationRuleName, + Constraints: []validation.Constraint{{Target: "authorizationRuleName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "authorizationRuleName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "servicebus.NamespacesClient", "GetAuthorizationRule") + } + req, err := client.GetAuthorizationRulePreparer(resourceGroupName, namespaceName, authorizationRuleName) if err != nil { return result, autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "GetAuthorizationRule", nil, "Failure preparing request") @@ -421,8 +556,9 @@ func (client NamespacesClient) GetAuthorizationRulePreparer(resourceGroupName st "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2015-08-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -454,9 +590,19 @@ func (client NamespacesClient) GetAuthorizationRuleResponder(resp *http.Response // ListAuthorizationRules gets the authorization rules for a namespace. // -// resourceGroupName is the name of the resource group. namespaceName is the -// namespace name. +// resourceGroupName is name of the Resource group within the Azure +// subscription. namespaceName is the namespace name func (client NamespacesClient) ListAuthorizationRules(resourceGroupName string, namespaceName string) (result SharedAccessAuthorizationRuleListResult, err error) { + if err := validation.Validate([]validation.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: namespaceName, + Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "servicebus.NamespacesClient", "ListAuthorizationRules") + } + req, err := client.ListAuthorizationRulesPreparer(resourceGroupName, namespaceName) if err != nil { return result, autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "ListAuthorizationRules", nil, "Failure preparing request") @@ -484,8 +630,9 @@ func (client NamespacesClient) ListAuthorizationRulesPreparer(resourceGroupName "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2015-08-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -541,8 +688,16 @@ func (client NamespacesClient) ListAuthorizationRulesNextResults(lastResults Sha // ListByResourceGroup gets the available namespaces within a resource group. // -// resourceGroupName is the name of the resource group. +// resourceGroupName is name of the Resource group within the Azure +// subscription. func (client NamespacesClient) ListByResourceGroup(resourceGroupName string) (result NamespaceListResult, err error) { + if err := validation.Validate([]validation.Validation{ + {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.NewErrorWithValidationError(err, "servicebus.NamespacesClient", "ListByResourceGroup") + } + req, err := client.ListByResourceGroupPreparer(resourceGroupName) if err != nil { return result, autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "ListByResourceGroup", nil, "Failure preparing request") @@ -569,8 +724,9 @@ func (client NamespacesClient) ListByResourceGroupPreparer(resourceGroupName str "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2015-08-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -652,8 +808,9 @@ func (client NamespacesClient) ListBySubscriptionPreparer() (*http.Request, erro "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2015-08-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -710,9 +867,23 @@ func (client NamespacesClient) ListBySubscriptionNextResults(lastResults Namespa // ListKeys gets the primary and secondary connection strings for the // namespace. // -// resourceGroupName is the name of the resource group. namespaceName is the -// namespace name. authorizationRuleName is the authorization rule name. +// resourceGroupName is name of the Resource group within the Azure +// subscription. namespaceName is the namespace name authorizationRuleName is +// the authorizationrule name. func (client NamespacesClient) ListKeys(resourceGroupName string, namespaceName string, authorizationRuleName string) (result ResourceListKeys, err error) { + if err := validation.Validate([]validation.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: namespaceName, + Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, + {TargetValue: authorizationRuleName, + Constraints: []validation.Constraint{{Target: "authorizationRuleName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "authorizationRuleName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "servicebus.NamespacesClient", "ListKeys") + } + req, err := client.ListKeysPreparer(resourceGroupName, namespaceName, authorizationRuleName) if err != nil { return result, autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "ListKeys", nil, "Failure preparing request") @@ -741,8 +912,9 @@ func (client NamespacesClient) ListKeysPreparer(resourceGroupName string, namesp "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2015-08-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -775,10 +947,24 @@ func (client NamespacesClient) ListKeysResponder(resp *http.Response) (result Re // RegenerateKeys regenerates the primary or secondary connection strings for // the namespace. // -// resourceGroupName is the name of the resource group. namespaceName is the -// namespace name. authorizationRuleName is the authorization rule name. -// parameters is parameters supplied to regenerate the authorization rule. +// resourceGroupName is name of the Resource group within the Azure +// subscription. namespaceName is the namespace name authorizationRuleName is +// the authorizationrule name. parameters is parameters supplied to regenerate +// the authorization rule. func (client NamespacesClient) RegenerateKeys(resourceGroupName string, namespaceName string, authorizationRuleName string, parameters RegenerateKeysParameters) (result ResourceListKeys, err error) { + if err := validation.Validate([]validation.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: namespaceName, + Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, + {TargetValue: authorizationRuleName, + Constraints: []validation.Constraint{{Target: "authorizationRuleName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "authorizationRuleName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "servicebus.NamespacesClient", "RegenerateKeys") + } + req, err := client.RegenerateKeysPreparer(resourceGroupName, namespaceName, authorizationRuleName, parameters) if err != nil { return result, autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "RegenerateKeys", nil, "Failure preparing request") @@ -807,8 +993,9 @@ func (client NamespacesClient) RegenerateKeysPreparer(resourceGroupName string, "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2015-08-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -839,3 +1026,81 @@ func (client NamespacesClient) RegenerateKeysResponder(resp *http.Response) (res result.Response = autorest.Response{Response: resp} return } + +// Update updates a service namespace. Once created, this namespace's resource +// manifest is immutable. This operation is idempotent. +// +// resourceGroupName is name of the Resource group within the Azure +// subscription. namespaceName is the namespace name parameters is parameters +// supplied to update a namespace resource. +func (client NamespacesClient) Update(resourceGroupName string, namespaceName string, parameters NamespaceUpdateParameters) (result NamespaceResource, err error) { + if err := validation.Validate([]validation.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: namespaceName, + Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "servicebus.NamespacesClient", "Update") + } + + req, err := client.UpdatePreparer(resourceGroupName, namespaceName, parameters) + if err != nil { + return result, autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "Update", nil, "Failure preparing request") + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "Update", resp, "Failure sending request") + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "Update", resp, "Failure responding to request") + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client NamespacesClient) UpdatePreparer(resourceGroupName string, namespaceName string, parameters NamespaceUpdateParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "namespaceName": autorest.Encode("path", namespaceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client NamespacesClient) UpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client NamespacesClient) UpdateResponder(resp *http.Response) (result NamespaceResource, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/arm/servicebus/operations.go b/arm/servicebus/operations.go new file mode 100755 index 000000000000..8d8421f0f9b0 --- /dev/null +++ b/arm/servicebus/operations.go @@ -0,0 +1,120 @@ +package servicebus + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// 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/azure" + "net/http" +) + +// OperationsClient is the azure Service Bus client +type OperationsClient struct { + ManagementClient +} + +// 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. +func NewOperationsClientWithBaseURI(baseURI string, subscriptionID string) OperationsClient { + return OperationsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List lists all of the available ServiceBus REST API operations. +func (client OperationsClient) List() (result OperationListResult, err error) { + req, err := client.ListPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "servicebus.OperationsClient", "List", nil, "Failure preparing request") + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "servicebus.OperationsClient", "List", resp, "Failure sending request") + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.OperationsClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client OperationsClient) ListPreparer() (*http.Request, error) { + const APIVersion = "2015-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPath("/providers/Microsoft.ServiceBus/operations"), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// 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 autorest.SendWithSender(client, req) +} + +// 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, + client.ByInspecting(), + 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(lastResults OperationListResult) (result OperationListResult, err error) { + req, err := lastResults.OperationListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "servicebus.OperationsClient", "List", 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, "servicebus.OperationsClient", "List", resp, "Failure sending next results request") + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.OperationsClient", "List", resp, "Failure responding to next results request") + } + + return +} diff --git a/arm/servicebus/queues.go b/arm/servicebus/queues.go old mode 100644 new mode 100755 index 854eea482736..77f2fcdc0088 --- a/arm/servicebus/queues.go +++ b/arm/servicebus/queues.go @@ -14,7 +14,7 @@ package servicebus // See the License for the specific language governing permissions and // limitations under the License. // -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.0 +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 // Changes may cause incorrect behavior and will be lost if the code is // regenerated. @@ -43,11 +43,21 @@ func NewQueuesClientWithBaseURI(baseURI string, subscriptionID string) QueuesCli // CreateOrUpdate creates or updates a Service Bus queue. This operation is // idempotent. // -// resourceGroupName is the name of the resource group. namespaceName is the -// namespace name. queueName is the queue name. parameters is parameters -// supplied to create or update a queue resource. +// resourceGroupName is name of the Resource group within the Azure +// subscription. namespaceName is the namespace name queueName is the queue +// name. parameters is parameters supplied to create or update a queue +// resource. func (client QueuesClient) CreateOrUpdate(resourceGroupName string, namespaceName string, queueName string, parameters QueueCreateOrUpdateParameters) (result QueueResource, err error) { if err := validation.Validate([]validation.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: namespaceName, + Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, + {TargetValue: queueName, + Constraints: []validation.Constraint{{Target: "queueName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "queueName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: parameters, Constraints: []validation.Constraint{{Target: "parameters.Location", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { return result, validation.NewErrorWithValidationError(err, "servicebus.QueuesClient", "CreateOrUpdate") @@ -81,8 +91,9 @@ func (client QueuesClient) CreateOrUpdatePreparer(resourceGroupName string, name "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2015-08-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -116,11 +127,24 @@ func (client QueuesClient) CreateOrUpdateResponder(resp *http.Response) (result // CreateOrUpdateAuthorizationRule creates an authorization rule for a queue. // -// resourceGroupName is the name of the resource group. namespaceName is the -// namespace name. queueName is the queue name. authorizationRuleName is -// authorization rule name. parameters is the shared access authorization rule. +// resourceGroupName is name of the Resource group within the Azure +// subscription. namespaceName is the namespace name queueName is the queue +// name. authorizationRuleName is the authorizationrule name. parameters is the +// shared access authorization rule. func (client QueuesClient) CreateOrUpdateAuthorizationRule(resourceGroupName string, namespaceName string, queueName string, authorizationRuleName string, parameters SharedAccessAuthorizationRuleCreateOrUpdateParameters) (result SharedAccessAuthorizationRuleResource, err error) { if err := validation.Validate([]validation.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: namespaceName, + Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, + {TargetValue: queueName, + Constraints: []validation.Constraint{{Target: "queueName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "queueName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: authorizationRuleName, + Constraints: []validation.Constraint{{Target: "authorizationRuleName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "authorizationRuleName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: parameters, Constraints: []validation.Constraint{{Target: "parameters.SharedAccessAuthorizationRuleProperties", Name: validation.Null, Rule: false, Chain: []validation.Constraint{{Target: "parameters.SharedAccessAuthorizationRuleProperties.Rights", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { @@ -156,8 +180,9 @@ func (client QueuesClient) CreateOrUpdateAuthorizationRulePreparer(resourceGroup "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2015-08-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -191,9 +216,23 @@ func (client QueuesClient) CreateOrUpdateAuthorizationRuleResponder(resp *http.R // Delete deletes a queue from the specified namespace in a resource group. // -// resourceGroupName is the name of the resource group. namespaceName is the -// namespace name. queueName is the name of the queue to be deleted. +// resourceGroupName is name of the Resource group within the Azure +// subscription. namespaceName is the namespace name queueName is the queue +// name. func (client QueuesClient) Delete(resourceGroupName string, namespaceName string, queueName string) (result autorest.Response, err error) { + if err := validation.Validate([]validation.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: namespaceName, + Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, + {TargetValue: queueName, + Constraints: []validation.Constraint{{Target: "queueName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "queueName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "servicebus.QueuesClient", "Delete") + } + req, err := client.DeletePreparer(resourceGroupName, namespaceName, queueName) if err != nil { return result, autorest.NewErrorWithError(err, "servicebus.QueuesClient", "Delete", nil, "Failure preparing request") @@ -222,8 +261,9 @@ func (client QueuesClient) DeletePreparer(resourceGroupName string, namespaceNam "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2015-08-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -254,10 +294,26 @@ func (client QueuesClient) DeleteResponder(resp *http.Response) (result autorest // DeleteAuthorizationRule deletes a queue authorization rule. // -// resourceGroupName is the name of the resource group. namespaceName is the -// namespace name. queueName is the queue name. authorizationRuleName is -// authorization rule name. +// resourceGroupName is name of the Resource group within the Azure +// subscription. namespaceName is the namespace name queueName is the queue +// name. authorizationRuleName is the authorizationrule name. func (client QueuesClient) DeleteAuthorizationRule(resourceGroupName string, namespaceName string, queueName string, authorizationRuleName string) (result autorest.Response, err error) { + if err := validation.Validate([]validation.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: namespaceName, + Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, + {TargetValue: queueName, + Constraints: []validation.Constraint{{Target: "queueName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "queueName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: authorizationRuleName, + Constraints: []validation.Constraint{{Target: "authorizationRuleName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "authorizationRuleName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "servicebus.QueuesClient", "DeleteAuthorizationRule") + } + req, err := client.DeleteAuthorizationRulePreparer(resourceGroupName, namespaceName, queueName, authorizationRuleName) if err != nil { return result, autorest.NewErrorWithError(err, "servicebus.QueuesClient", "DeleteAuthorizationRule", nil, "Failure preparing request") @@ -287,8 +343,9 @@ func (client QueuesClient) DeleteAuthorizationRulePreparer(resourceGroupName str "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2015-08-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -319,9 +376,23 @@ func (client QueuesClient) DeleteAuthorizationRuleResponder(resp *http.Response) // Get returns a description for the specified queue. // -// resourceGroupName is the name of the resource group. namespaceName is the -// namespace name. queueName is the queue name. +// resourceGroupName is name of the Resource group within the Azure +// subscription. namespaceName is the namespace name queueName is the queue +// name. func (client QueuesClient) Get(resourceGroupName string, namespaceName string, queueName string) (result QueueResource, err error) { + if err := validation.Validate([]validation.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: namespaceName, + Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, + {TargetValue: queueName, + Constraints: []validation.Constraint{{Target: "queueName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "queueName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "servicebus.QueuesClient", "Get") + } + req, err := client.GetPreparer(resourceGroupName, namespaceName, queueName) if err != nil { return result, autorest.NewErrorWithError(err, "servicebus.QueuesClient", "Get", nil, "Failure preparing request") @@ -350,8 +421,9 @@ func (client QueuesClient) GetPreparer(resourceGroupName string, namespaceName s "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2015-08-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -383,10 +455,26 @@ func (client QueuesClient) GetResponder(resp *http.Response) (result QueueResour // GetAuthorizationRule gets an authorization rule for a queue by rule name. // -// resourceGroupName is the name of the resource group. namespaceName is the -// namespace name. queueName is the queue name. authorizationRuleName is -// authorization rule name. +// resourceGroupName is name of the Resource group within the Azure +// subscription. namespaceName is the namespace name queueName is the queue +// name. authorizationRuleName is the authorizationrule name. func (client QueuesClient) GetAuthorizationRule(resourceGroupName string, namespaceName string, queueName string, authorizationRuleName string) (result SharedAccessAuthorizationRuleResource, err error) { + if err := validation.Validate([]validation.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: namespaceName, + Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, + {TargetValue: queueName, + Constraints: []validation.Constraint{{Target: "queueName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "queueName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: authorizationRuleName, + Constraints: []validation.Constraint{{Target: "authorizationRuleName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "authorizationRuleName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "servicebus.QueuesClient", "GetAuthorizationRule") + } + req, err := client.GetAuthorizationRulePreparer(resourceGroupName, namespaceName, queueName, authorizationRuleName) if err != nil { return result, autorest.NewErrorWithError(err, "servicebus.QueuesClient", "GetAuthorizationRule", nil, "Failure preparing request") @@ -416,8 +504,9 @@ func (client QueuesClient) GetAuthorizationRulePreparer(resourceGroupName string "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2015-08-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -449,9 +538,19 @@ func (client QueuesClient) GetAuthorizationRuleResponder(resp *http.Response) (r // ListAll gets the queues within a namespace. // -// resourceGroupName is the name of the resource group. namespaceName is the -// namespace name. +// resourceGroupName is name of the Resource group within the Azure +// subscription. namespaceName is the namespace name func (client QueuesClient) ListAll(resourceGroupName string, namespaceName string) (result QueueListResult, err error) { + if err := validation.Validate([]validation.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: namespaceName, + Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "servicebus.QueuesClient", "ListAll") + } + req, err := client.ListAllPreparer(resourceGroupName, namespaceName) if err != nil { return result, autorest.NewErrorWithError(err, "servicebus.QueuesClient", "ListAll", nil, "Failure preparing request") @@ -479,8 +578,9 @@ func (client QueuesClient) ListAllPreparer(resourceGroupName string, namespaceNa "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2015-08-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -536,9 +636,23 @@ func (client QueuesClient) ListAllNextResults(lastResults QueueListResult) (resu // ListAuthorizationRules gets all authorization rules for a queue. // -// resourceGroupName is the name of the resource group. namespaceName is the -// namespace name queueName is the queue name. +// resourceGroupName is name of the Resource group within the Azure +// subscription. namespaceName is the namespace name queueName is the queue +// name. func (client QueuesClient) ListAuthorizationRules(resourceGroupName string, namespaceName string, queueName string) (result SharedAccessAuthorizationRuleListResult, err error) { + if err := validation.Validate([]validation.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: namespaceName, + Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, + {TargetValue: queueName, + Constraints: []validation.Constraint{{Target: "queueName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "queueName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "servicebus.QueuesClient", "ListAuthorizationRules") + } + req, err := client.ListAuthorizationRulesPreparer(resourceGroupName, namespaceName, queueName) if err != nil { return result, autorest.NewErrorWithError(err, "servicebus.QueuesClient", "ListAuthorizationRules", nil, "Failure preparing request") @@ -567,8 +681,9 @@ func (client QueuesClient) ListAuthorizationRulesPreparer(resourceGroupName stri "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2015-08-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -624,10 +739,26 @@ func (client QueuesClient) ListAuthorizationRulesNextResults(lastResults SharedA // ListKeys primary and secondary connection strings to the queue. // -// resourceGroupName is the name of the resource group. namespaceName is the -// namespace name. queueName is the queue name. authorizationRuleName is the -// authorization rule name. +// resourceGroupName is name of the Resource group within the Azure +// subscription. namespaceName is the namespace name queueName is the queue +// name. authorizationRuleName is the authorizationrule name. func (client QueuesClient) ListKeys(resourceGroupName string, namespaceName string, queueName string, authorizationRuleName string) (result ResourceListKeys, err error) { + if err := validation.Validate([]validation.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: namespaceName, + Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, + {TargetValue: queueName, + Constraints: []validation.Constraint{{Target: "queueName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "queueName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: authorizationRuleName, + Constraints: []validation.Constraint{{Target: "authorizationRuleName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "authorizationRuleName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "servicebus.QueuesClient", "ListKeys") + } + req, err := client.ListKeysPreparer(resourceGroupName, namespaceName, queueName, authorizationRuleName) if err != nil { return result, autorest.NewErrorWithError(err, "servicebus.QueuesClient", "ListKeys", nil, "Failure preparing request") @@ -657,8 +788,9 @@ func (client QueuesClient) ListKeysPreparer(resourceGroupName string, namespaceN "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2015-08-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -691,11 +823,27 @@ func (client QueuesClient) ListKeysResponder(resp *http.Response) (result Resour // RegenerateKeys regenerates the primary or secondary connection strings to // the queue. // -// resourceGroupName is the name of the resource group. namespaceName is the -// namespace name. queueName is the queue name. authorizationRuleName is the -// authorization rule name. parameters is parameters supplied to regenerate the -// authorization rule. +// resourceGroupName is name of the Resource group within the Azure +// subscription. namespaceName is the namespace name queueName is the queue +// name. authorizationRuleName is the authorizationrule name. parameters is +// parameters supplied to regenerate the authorization rule. func (client QueuesClient) RegenerateKeys(resourceGroupName string, namespaceName string, queueName string, authorizationRuleName string, parameters RegenerateKeysParameters) (result ResourceListKeys, err error) { + if err := validation.Validate([]validation.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: namespaceName, + Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, + {TargetValue: queueName, + Constraints: []validation.Constraint{{Target: "queueName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "queueName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: authorizationRuleName, + Constraints: []validation.Constraint{{Target: "authorizationRuleName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "authorizationRuleName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "servicebus.QueuesClient", "RegenerateKeys") + } + req, err := client.RegenerateKeysPreparer(resourceGroupName, namespaceName, queueName, authorizationRuleName, parameters) if err != nil { return result, autorest.NewErrorWithError(err, "servicebus.QueuesClient", "RegenerateKeys", nil, "Failure preparing request") @@ -725,8 +873,9 @@ func (client QueuesClient) RegenerateKeysPreparer(resourceGroupName string, name "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2015-08-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( diff --git a/arm/servicebus/subscriptions.go b/arm/servicebus/subscriptions.go old mode 100644 new mode 100755 index 47c798f99bc8..fa1c5fc136b5 --- a/arm/servicebus/subscriptions.go +++ b/arm/servicebus/subscriptions.go @@ -14,7 +14,7 @@ package servicebus // See the License for the specific language governing permissions and // limitations under the License. // -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.0 +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 // Changes may cause incorrect behavior and will be lost if the code is // regenerated. @@ -44,12 +44,24 @@ func NewSubscriptionsClientWithBaseURI(baseURI string, subscriptionID string) Su // CreateOrUpdate creates a topic subscription. // -// resourceGroupName is the name of the resource group. namespaceName is the -// namespace name. topicName is the topic name. subscriptionName is the -// subscription name. parameters is parameters supplied to create a -// subscription resource. +// resourceGroupName is name of the Resource group within the Azure +// subscription. namespaceName is the namespace name topicName is the topic +// name. subscriptionName is the subscription name. parameters is parameters +// supplied to create a subscription resource. func (client SubscriptionsClient) CreateOrUpdate(resourceGroupName string, namespaceName string, topicName string, subscriptionName string, parameters SubscriptionCreateOrUpdateParameters) (result SubscriptionResource, err error) { if err := validation.Validate([]validation.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: namespaceName, + Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, + {TargetValue: topicName, + Constraints: []validation.Constraint{{Target: "topicName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "topicName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: subscriptionName, + Constraints: []validation.Constraint{{Target: "subscriptionName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "subscriptionName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: parameters, Constraints: []validation.Constraint{{Target: "parameters.Location", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { return result, validation.NewErrorWithValidationError(err, "servicebus.SubscriptionsClient", "CreateOrUpdate") @@ -84,8 +96,9 @@ func (client SubscriptionsClient) CreateOrUpdatePreparer(resourceGroupName strin "topicName": autorest.Encode("path", topicName), } + const APIVersion = "2015-08-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -119,10 +132,26 @@ func (client SubscriptionsClient) CreateOrUpdateResponder(resp *http.Response) ( // Delete deletes a subscription from the specified topic. // -// resourceGroupName is the name of the resource group. namespaceName is the -// namespace name. topicName is the topic name. subscriptionName is the -// subscription name. +// resourceGroupName is name of the Resource group within the Azure +// subscription. namespaceName is the namespace name topicName is the topic +// name. subscriptionName is the subscription name. func (client SubscriptionsClient) Delete(resourceGroupName string, namespaceName string, topicName string, subscriptionName string) (result autorest.Response, err error) { + if err := validation.Validate([]validation.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: namespaceName, + Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, + {TargetValue: topicName, + Constraints: []validation.Constraint{{Target: "topicName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "topicName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: subscriptionName, + Constraints: []validation.Constraint{{Target: "subscriptionName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "subscriptionName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "servicebus.SubscriptionsClient", "Delete") + } + req, err := client.DeletePreparer(resourceGroupName, namespaceName, topicName, subscriptionName) if err != nil { return result, autorest.NewErrorWithError(err, "servicebus.SubscriptionsClient", "Delete", nil, "Failure preparing request") @@ -152,8 +181,9 @@ func (client SubscriptionsClient) DeletePreparer(resourceGroupName string, names "topicName": autorest.Encode("path", topicName), } + const APIVersion = "2015-08-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -184,10 +214,26 @@ func (client SubscriptionsClient) DeleteResponder(resp *http.Response) (result a // Get returns a subscription description for the specified topic. // -// resourceGroupName is the name of the resource group. namespaceName is the -// namespace name. topicName is the topic name. subscriptionName is the -// subscription name. +// resourceGroupName is name of the Resource group within the Azure +// subscription. namespaceName is the namespace name topicName is the topic +// name. subscriptionName is the subscription name. func (client SubscriptionsClient) Get(resourceGroupName string, namespaceName string, topicName string, subscriptionName string) (result SubscriptionResource, err error) { + if err := validation.Validate([]validation.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: namespaceName, + Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, + {TargetValue: topicName, + Constraints: []validation.Constraint{{Target: "topicName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "topicName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: subscriptionName, + Constraints: []validation.Constraint{{Target: "subscriptionName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "subscriptionName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "servicebus.SubscriptionsClient", "Get") + } + req, err := client.GetPreparer(resourceGroupName, namespaceName, topicName, subscriptionName) if err != nil { return result, autorest.NewErrorWithError(err, "servicebus.SubscriptionsClient", "Get", nil, "Failure preparing request") @@ -217,8 +263,9 @@ func (client SubscriptionsClient) GetPreparer(resourceGroupName string, namespac "topicName": autorest.Encode("path", topicName), } + const APIVersion = "2015-08-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -248,11 +295,25 @@ func (client SubscriptionsClient) GetResponder(resp *http.Response) (result Subs return } -// ListAll lsit all the subscriptions under a specified topic. +// ListAll list all the subscriptions under a specified topic. // -// resourceGroupName is the name of the resource group. namespaceName is the -// namespace name. topicName is the topic name. +// resourceGroupName is name of the Resource group within the Azure +// subscription. namespaceName is the namespace name topicName is the topic +// name. func (client SubscriptionsClient) ListAll(resourceGroupName string, namespaceName string, topicName string) (result SubscriptionListResult, err error) { + if err := validation.Validate([]validation.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: namespaceName, + Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, + {TargetValue: topicName, + Constraints: []validation.Constraint{{Target: "topicName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "topicName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "servicebus.SubscriptionsClient", "ListAll") + } + req, err := client.ListAllPreparer(resourceGroupName, namespaceName, topicName) if err != nil { return result, autorest.NewErrorWithError(err, "servicebus.SubscriptionsClient", "ListAll", nil, "Failure preparing request") @@ -281,8 +342,9 @@ func (client SubscriptionsClient) ListAllPreparer(resourceGroupName string, name "topicName": autorest.Encode("path", topicName), } + const APIVersion = "2015-08-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( diff --git a/arm/servicebus/topics.go b/arm/servicebus/topics.go old mode 100644 new mode 100755 index 5123a1a45918..c1d6529ae03a --- a/arm/servicebus/topics.go +++ b/arm/servicebus/topics.go @@ -14,7 +14,7 @@ package servicebus // See the License for the specific language governing permissions and // limitations under the License. // -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.0 +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 // Changes may cause incorrect behavior and will be lost if the code is // regenerated. @@ -42,11 +42,20 @@ func NewTopicsClientWithBaseURI(baseURI string, subscriptionID string) TopicsCli // CreateOrUpdate creates a topic in the specified namespace. // -// resourceGroupName is the name of the resource group. namespaceName is the -// namespace name. topicName is the topic name. parameters is parameters -// supplied to create a topic resource. +// resourceGroupName is name of the Resource group within the Azure +// subscription. namespaceName is the namespace name topicName is the topic +// name. parameters is parameters supplied to create a topic resource. func (client TopicsClient) CreateOrUpdate(resourceGroupName string, namespaceName string, topicName string, parameters TopicCreateOrUpdateParameters) (result TopicResource, err error) { if err := validation.Validate([]validation.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: namespaceName, + Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, + {TargetValue: topicName, + Constraints: []validation.Constraint{{Target: "topicName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "topicName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: parameters, Constraints: []validation.Constraint{{Target: "parameters.Location", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { return result, validation.NewErrorWithValidationError(err, "servicebus.TopicsClient", "CreateOrUpdate") @@ -80,8 +89,9 @@ func (client TopicsClient) CreateOrUpdatePreparer(resourceGroupName string, name "topicName": autorest.Encode("path", topicName), } + const APIVersion = "2015-08-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -116,11 +126,24 @@ func (client TopicsClient) CreateOrUpdateResponder(resp *http.Response) (result // CreateOrUpdateAuthorizationRule creates an authorizatio rule for the // specified topic. // -// resourceGroupName is the name of the resource group. namespaceName is the -// namespace name. topicName is the topic name. authorizationRuleName is -// authorization rule name. parameters is the shared access authorization rule. +// resourceGroupName is name of the Resource group within the Azure +// subscription. namespaceName is the namespace name topicName is the topic +// name. authorizationRuleName is the authorizationrule name. parameters is the +// shared access authorization rule. func (client TopicsClient) CreateOrUpdateAuthorizationRule(resourceGroupName string, namespaceName string, topicName string, authorizationRuleName string, parameters SharedAccessAuthorizationRuleCreateOrUpdateParameters) (result SharedAccessAuthorizationRuleResource, err error) { if err := validation.Validate([]validation.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: namespaceName, + Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, + {TargetValue: topicName, + Constraints: []validation.Constraint{{Target: "topicName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "topicName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: authorizationRuleName, + Constraints: []validation.Constraint{{Target: "authorizationRuleName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "authorizationRuleName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: parameters, Constraints: []validation.Constraint{{Target: "parameters.SharedAccessAuthorizationRuleProperties", Name: validation.Null, Rule: false, Chain: []validation.Constraint{{Target: "parameters.SharedAccessAuthorizationRuleProperties.Rights", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { @@ -156,8 +179,9 @@ func (client TopicsClient) CreateOrUpdateAuthorizationRulePreparer(resourceGroup "topicName": autorest.Encode("path", topicName), } + const APIVersion = "2015-08-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -191,9 +215,23 @@ func (client TopicsClient) CreateOrUpdateAuthorizationRuleResponder(resp *http.R // Delete deletes a topic from the specified namespace and resource group. // -// resourceGroupName is the name of the resource group. namespaceName is the -// namespace name. topicName is the name of the topic to delete. +// resourceGroupName is name of the Resource group within the Azure +// subscription. namespaceName is the namespace name topicName is the topic +// name. func (client TopicsClient) Delete(resourceGroupName string, namespaceName string, topicName string) (result autorest.Response, err error) { + if err := validation.Validate([]validation.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: namespaceName, + Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, + {TargetValue: topicName, + Constraints: []validation.Constraint{{Target: "topicName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "topicName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "servicebus.TopicsClient", "Delete") + } + req, err := client.DeletePreparer(resourceGroupName, namespaceName, topicName) if err != nil { return result, autorest.NewErrorWithError(err, "servicebus.TopicsClient", "Delete", nil, "Failure preparing request") @@ -222,8 +260,9 @@ func (client TopicsClient) DeletePreparer(resourceGroupName string, namespaceNam "topicName": autorest.Encode("path", topicName), } + const APIVersion = "2015-08-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -254,10 +293,26 @@ func (client TopicsClient) DeleteResponder(resp *http.Response) (result autorest // DeleteAuthorizationRule deletes a topic authorization rule. // -// resourceGroupName is the name of the resource group. namespaceName is the -// namespace name. topicName is the topic name. authorizationRuleName is -// authorization rule name. +// resourceGroupName is name of the Resource group within the Azure +// subscription. namespaceName is the namespace name topicName is the topic +// name. authorizationRuleName is the authorizationrule name. func (client TopicsClient) DeleteAuthorizationRule(resourceGroupName string, namespaceName string, topicName string, authorizationRuleName string) (result autorest.Response, err error) { + if err := validation.Validate([]validation.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: namespaceName, + Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, + {TargetValue: topicName, + Constraints: []validation.Constraint{{Target: "topicName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "topicName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: authorizationRuleName, + Constraints: []validation.Constraint{{Target: "authorizationRuleName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "authorizationRuleName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "servicebus.TopicsClient", "DeleteAuthorizationRule") + } + req, err := client.DeleteAuthorizationRulePreparer(resourceGroupName, namespaceName, topicName, authorizationRuleName) if err != nil { return result, autorest.NewErrorWithError(err, "servicebus.TopicsClient", "DeleteAuthorizationRule", nil, "Failure preparing request") @@ -287,8 +342,9 @@ func (client TopicsClient) DeleteAuthorizationRulePreparer(resourceGroupName str "topicName": autorest.Encode("path", topicName), } + const APIVersion = "2015-08-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -319,9 +375,23 @@ func (client TopicsClient) DeleteAuthorizationRuleResponder(resp *http.Response) // Get returns a description for the specified topic. // -// resourceGroupName is the name of the resource group. namespaceName is the -// namespace name. topicName is the topic name. +// resourceGroupName is name of the Resource group within the Azure +// subscription. namespaceName is the namespace name topicName is the topic +// name. func (client TopicsClient) Get(resourceGroupName string, namespaceName string, topicName string) (result TopicResource, err error) { + if err := validation.Validate([]validation.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: namespaceName, + Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, + {TargetValue: topicName, + Constraints: []validation.Constraint{{Target: "topicName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "topicName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "servicebus.TopicsClient", "Get") + } + req, err := client.GetPreparer(resourceGroupName, namespaceName, topicName) if err != nil { return result, autorest.NewErrorWithError(err, "servicebus.TopicsClient", "Get", nil, "Failure preparing request") @@ -350,8 +420,9 @@ func (client TopicsClient) GetPreparer(resourceGroupName string, namespaceName s "topicName": autorest.Encode("path", topicName), } + const APIVersion = "2015-08-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -383,10 +454,26 @@ func (client TopicsClient) GetResponder(resp *http.Response) (result TopicResour // GetAuthorizationRule returns the specified authorization rule. // -// resourceGroupName is the name of the resource group. namespaceName is the -// namespace name. topicName is the topic name. authorizationRuleName is -// authorization rule name. +// resourceGroupName is name of the Resource group within the Azure +// subscription. namespaceName is the namespace name topicName is the topic +// name. authorizationRuleName is the authorizationrule name. func (client TopicsClient) GetAuthorizationRule(resourceGroupName string, namespaceName string, topicName string, authorizationRuleName string) (result SharedAccessAuthorizationRuleResource, err error) { + if err := validation.Validate([]validation.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: namespaceName, + Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, + {TargetValue: topicName, + Constraints: []validation.Constraint{{Target: "topicName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "topicName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: authorizationRuleName, + Constraints: []validation.Constraint{{Target: "authorizationRuleName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "authorizationRuleName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "servicebus.TopicsClient", "GetAuthorizationRule") + } + req, err := client.GetAuthorizationRulePreparer(resourceGroupName, namespaceName, topicName, authorizationRuleName) if err != nil { return result, autorest.NewErrorWithError(err, "servicebus.TopicsClient", "GetAuthorizationRule", nil, "Failure preparing request") @@ -416,8 +503,9 @@ func (client TopicsClient) GetAuthorizationRulePreparer(resourceGroupName string "topicName": autorest.Encode("path", topicName), } + const APIVersion = "2015-08-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -449,9 +537,19 @@ func (client TopicsClient) GetAuthorizationRuleResponder(resp *http.Response) (r // ListAll gets all the topics in a namespace. // -// resourceGroupName is the name of the resource group. namespaceName is the -// namespace name. +// resourceGroupName is name of the Resource group within the Azure +// subscription. namespaceName is the namespace name func (client TopicsClient) ListAll(resourceGroupName string, namespaceName string) (result TopicListResult, err error) { + if err := validation.Validate([]validation.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: namespaceName, + Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "servicebus.TopicsClient", "ListAll") + } + req, err := client.ListAllPreparer(resourceGroupName, namespaceName) if err != nil { return result, autorest.NewErrorWithError(err, "servicebus.TopicsClient", "ListAll", nil, "Failure preparing request") @@ -479,8 +577,9 @@ func (client TopicsClient) ListAllPreparer(resourceGroupName string, namespaceNa "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2015-08-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -536,9 +635,23 @@ func (client TopicsClient) ListAllNextResults(lastResults TopicListResult) (resu // ListAuthorizationRules gets authorization rules for a topic. // -// resourceGroupName is the name of the resource group. namespaceName is the -// namespace name. topicName is the topic name. +// resourceGroupName is name of the Resource group within the Azure +// subscription. namespaceName is the namespace name topicName is the topic +// name. func (client TopicsClient) ListAuthorizationRules(resourceGroupName string, namespaceName string, topicName string) (result SharedAccessAuthorizationRuleListResult, err error) { + if err := validation.Validate([]validation.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: namespaceName, + Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, + {TargetValue: topicName, + Constraints: []validation.Constraint{{Target: "topicName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "topicName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "servicebus.TopicsClient", "ListAuthorizationRules") + } + req, err := client.ListAuthorizationRulesPreparer(resourceGroupName, namespaceName, topicName) if err != nil { return result, autorest.NewErrorWithError(err, "servicebus.TopicsClient", "ListAuthorizationRules", nil, "Failure preparing request") @@ -567,8 +680,9 @@ func (client TopicsClient) ListAuthorizationRulesPreparer(resourceGroupName stri "topicName": autorest.Encode("path", topicName), } + const APIVersion = "2015-08-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -624,10 +738,26 @@ func (client TopicsClient) ListAuthorizationRulesNextResults(lastResults SharedA // ListKeys gets the primary and secondary connection strings for the topic. // -// resourceGroupName is the name of the resource group. namespaceName is the -// namespace name. topicName is the topic name. authorizationRuleName is the -// authorization rule name. +// resourceGroupName is name of the Resource group within the Azure +// subscription. namespaceName is the namespace name topicName is the topic +// name. authorizationRuleName is the authorizationrule name. func (client TopicsClient) ListKeys(resourceGroupName string, namespaceName string, topicName string, authorizationRuleName string) (result ResourceListKeys, err error) { + if err := validation.Validate([]validation.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: namespaceName, + Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, + {TargetValue: topicName, + Constraints: []validation.Constraint{{Target: "topicName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "topicName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: authorizationRuleName, + Constraints: []validation.Constraint{{Target: "authorizationRuleName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "authorizationRuleName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "servicebus.TopicsClient", "ListKeys") + } + req, err := client.ListKeysPreparer(resourceGroupName, namespaceName, topicName, authorizationRuleName) if err != nil { return result, autorest.NewErrorWithError(err, "servicebus.TopicsClient", "ListKeys", nil, "Failure preparing request") @@ -657,8 +787,9 @@ func (client TopicsClient) ListKeysPreparer(resourceGroupName string, namespaceN "topicName": autorest.Encode("path", topicName), } + const APIVersion = "2015-08-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -691,11 +822,27 @@ func (client TopicsClient) ListKeysResponder(resp *http.Response) (result Resour // RegenerateKeys regenerates primary or secondary connection strings for the // topic. // -// resourceGroupName is the name of the resource group. namespaceName is the -// namespace name. topicName is the topic name. authorizationRuleName is the -// authorization rule name. parameters is parameters supplied to regenerate the -// authorization rule. +// resourceGroupName is name of the Resource group within the Azure +// subscription. namespaceName is the namespace name topicName is the topic +// name. authorizationRuleName is the authorizationrule name. parameters is +// parameters supplied to regenerate the authorization rule. func (client TopicsClient) RegenerateKeys(resourceGroupName string, namespaceName string, topicName string, authorizationRuleName string, parameters RegenerateKeysParameters) (result ResourceListKeys, err error) { + if err := validation.Validate([]validation.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: namespaceName, + Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, + {TargetValue: topicName, + Constraints: []validation.Constraint{{Target: "topicName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "topicName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: authorizationRuleName, + Constraints: []validation.Constraint{{Target: "authorizationRuleName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "authorizationRuleName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "servicebus.TopicsClient", "RegenerateKeys") + } + req, err := client.RegenerateKeysPreparer(resourceGroupName, namespaceName, topicName, authorizationRuleName, parameters) if err != nil { return result, autorest.NewErrorWithError(err, "servicebus.TopicsClient", "RegenerateKeys", nil, "Failure preparing request") @@ -725,8 +872,9 @@ func (client TopicsClient) RegenerateKeysPreparer(resourceGroupName string, name "topicName": autorest.Encode("path", topicName), } + const APIVersion = "2015-08-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( diff --git a/arm/servicebus/version.go b/arm/servicebus/version.go old mode 100644 new mode 100755 index 6bb9a10d99bc..fab580ed3b6d --- a/arm/servicebus/version.go +++ b/arm/servicebus/version.go @@ -18,43 +18,12 @@ package servicebus // Changes may cause incorrect behavior and will be lost if the code is // regenerated. -import ( - "bytes" - "fmt" - "strings" -) - -const ( - major = "8" - minor = "1" - patch = "0" - tag = "beta" - userAgentFormat = "Azure-SDK-For-Go/%s arm-%s/%s" -) - -// cached results of UserAgent and Version to prevent repeated operations. -var ( - userAgent string - version string -) - // UserAgent returns the UserAgent string to use when sending http.Requests. func UserAgent() string { - if userAgent == "" { - userAgent = fmt.Sprintf(userAgentFormat, Version(), "servicebus", "2015-08-01") - } - return userAgent + return "Azure-SDK-For-Go/v9.0.0-beta arm-servicebus/2015-08-01" } // Version returns the semantic version (see http://semver.org) of the client. func Version() string { - if version == "" { - versionBuilder := bytes.NewBufferString(fmt.Sprintf("%s.%s.%s", major, minor, patch)) - if tag != "" { - versionBuilder.WriteRune('-') - versionBuilder.WriteString(strings.TrimPrefix(tag, "-")) - } - version = string(versionBuilder.Bytes()) - } - return version + return "v9.0.0-beta" } diff --git a/arm/sql/client.go b/arm/sql/client.go old mode 100644 new mode 100755 index 916cd50435bc..02cad2847105 --- a/arm/sql/client.go +++ b/arm/sql/client.go @@ -1,8 +1,8 @@ // Package sql implements the Azure ARM Sql service API version 2014-04-01. // // Provides create, read, update and delete functionality for Azure SQL -// resources including servers, databases, elastic pools, recommendations, -// operations, and usage metrics. +// Database resources including servers, databases, elastic pools, +// recommendations, operations, and usage metrics. package sql // Copyright (c) Microsoft and contributors. All rights reserved. @@ -19,18 +19,17 @@ package sql // See the License for the specific language governing permissions and // limitations under the License. // -// Code generated by Microsoft (R) AutoRest Code Generator 0.17.0.0 +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 // 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/azure" + "net/http" ) const ( - // APIVersion is the version of the Sql - APIVersion = "2014-04-01" - // DefaultBaseURI is the default URI used for the service Sql DefaultBaseURI = "https://management.azure.com" ) @@ -39,7 +38,6 @@ const ( type ManagementClient struct { autorest.Client BaseURI string - APIVersion string SubscriptionID string } @@ -53,7 +51,61 @@ func NewWithBaseURI(baseURI string, subscriptionID string) ManagementClient { return ManagementClient{ Client: autorest.NewClientWithUserAgent(UserAgent()), BaseURI: baseURI, - APIVersion: APIVersion, SubscriptionID: subscriptionID, } } + +// ListOperations lists all of the available SQL Rest API operations. +func (client ManagementClient) ListOperations() (result OperationListResult, err error) { + req, err := client.ListOperationsPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "sql.ManagementClient", "ListOperations", nil, "Failure preparing request") + } + + resp, err := client.ListOperationsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "sql.ManagementClient", "ListOperations", resp, "Failure sending request") + } + + result, err = client.ListOperationsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ManagementClient", "ListOperations", resp, "Failure responding to request") + } + + return +} + +// ListOperationsPreparer prepares the ListOperations request. +func (client ManagementClient) ListOperationsPreparer() (*http.Request, error) { + const APIVersion = "2014-04-01" + 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{}) +} + +// ListOperationsSender sends the ListOperations request. The method will close the +// http.Response Body if it receives an error. +func (client ManagementClient) ListOperationsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListOperationsResponder handles the response to the ListOperations request. The method always +// closes the http.Response Body. +func (client ManagementClient) ListOperationsResponder(resp *http.Response) (result OperationListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/arm/sql/databases.go b/arm/sql/databases.go old mode 100644 new mode 100755 index 70a13d619993..feecaf6fa9ba --- a/arm/sql/databases.go +++ b/arm/sql/databases.go @@ -14,7 +14,7 @@ package sql // See the License for the specific language governing permissions and // limitations under the License. // -// Code generated by Microsoft (R) AutoRest Code Generator 0.17.0.0 +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 // Changes may cause incorrect behavior and will be lost if the code is // regenerated. @@ -25,7 +25,7 @@ import ( ) // DatabasesClient is the provides create, read, update and delete -// functionality for Azure SQL resources including servers, databases, +// functionality for Azure SQL Database resources including servers, databases, // elastic pools, recommendations, operations, and usage metrics. type DatabasesClient struct { ManagementClient @@ -42,19 +42,17 @@ func NewDatabasesClientWithBaseURI(baseURI string, subscriptionID string) Databa return DatabasesClient{NewWithBaseURI(baseURI, subscriptionID)} } -// CreateOrUpdate creates a new Azure SQL database or updates an existing -// Azure SQL database. Location is a required property in the request body, -// and it must be the same as the location of the SQL server. This method may -// poll for completion. Polling can be canceled by passing the cancel channel -// argument. The channel will be used to cancel polling and any outstanding -// HTTP requests. +// CreateOrUpdate creates a new database or updates an existing database. +// Location is a required property in the request body, and it must be the same +// as the location of the SQL server. This method may poll for completion. +// Polling can be canceled by passing the cancel channel argument. The channel +// will be used to cancel polling and any outstanding HTTP requests. // // resourceGroupName is the name of the resource group that contains the // resource. You can obtain this value from the Azure Resource Manager API or -// the portal. serverName is the name of the Azure SQL server. databaseName -// is the name of the Azure SQL database to be operated on (updated or -// created). parameters is the required parameters for creating or updating a -// database. +// the portal. serverName is the name of the server. databaseName is the name +// of the database to be operated on (updated or created). parameters is the +// required parameters for creating or updating a database. func (client DatabasesClient) CreateOrUpdate(resourceGroupName string, serverName string, databaseName string, parameters Database, cancel <-chan struct{}) (result autorest.Response, err error) { req, err := client.CreateOrUpdatePreparer(resourceGroupName, serverName, databaseName, parameters, cancel) if err != nil { @@ -84,8 +82,9 @@ func (client DatabasesClient) CreateOrUpdatePreparer(resourceGroupName string, s "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2014-04-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -118,15 +117,15 @@ func (client DatabasesClient) CreateOrUpdateResponder(resp *http.Response) (resu return } -// CreateOrUpdateTransparentDataEncryptionConfiguration creates or updates an -// Azure SQL Database Transparent Data Encryption Operation. +// CreateOrUpdateTransparentDataEncryptionConfiguration creates or updates a +// database's transparent data encryption configuration. // // resourceGroupName is the name of the resource group that contains the // resource. You can obtain this value from the Azure Resource Manager API or -// the portal. serverName is the name of the Azure SQL server. databaseName -// is the name of the Azure SQL database for which setting the Transparent -// Data Encryption applies. parameters is the required parameters for -// creating or updating transparent data encryption. +// the portal. serverName is the name of the server. databaseName is the name +// of the database for which setting the transparent data encryption applies. +// parameters is the required parameters for creating or updating transparent +// data encryption. func (client DatabasesClient) CreateOrUpdateTransparentDataEncryptionConfiguration(resourceGroupName string, serverName string, databaseName string, parameters TransparentDataEncryption) (result TransparentDataEncryption, err error) { req, err := client.CreateOrUpdateTransparentDataEncryptionConfigurationPreparer(resourceGroupName, serverName, databaseName, parameters) if err != nil { @@ -156,8 +155,9 @@ func (client DatabasesClient) CreateOrUpdateTransparentDataEncryptionConfigurati "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2014-04-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -189,12 +189,12 @@ func (client DatabasesClient) CreateOrUpdateTransparentDataEncryptionConfigurati return } -// Delete deletes an Azure SQL database. +// Delete deletes a database. // // resourceGroupName is the name of the resource group that contains the // resource. You can obtain this value from the Azure Resource Manager API or -// the portal. serverName is the name of the Azure SQL server. databaseName -// is the name of the Azure SQL database to be deleted. +// the portal. serverName is the name of the server. databaseName is the name +// of the database to be deleted. func (client DatabasesClient) Delete(resourceGroupName string, serverName string, databaseName string) (result autorest.Response, err error) { req, err := client.DeletePreparer(resourceGroupName, serverName, databaseName) if err != nil { @@ -224,8 +224,9 @@ func (client DatabasesClient) DeletePreparer(resourceGroupName string, serverNam "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2014-04-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -254,14 +255,14 @@ func (client DatabasesClient) DeleteResponder(resp *http.Response) (result autor return } -// Get gets information about an Azure SQL database. +// Get gets a database. // // resourceGroupName is the name of the resource group that contains the // resource. You can obtain this value from the Azure Resource Manager API or -// the portal. serverName is the name of the Azure SQL server. databaseName -// is the name of the Azure SQL database to be retrieved. expand is the comma -// separated list of child objects to expand in the response. Possible -// properties: serviceTierAdvisors, upgradeHint, transparentDataEncryption. +// the portal. serverName is the name of the server. databaseName is the name +// of the database to be retrieved. expand is a comma separated list of child +// objects to expand in the response. Possible properties: serviceTierAdvisors, +// transparentDataEncryption. func (client DatabasesClient) Get(resourceGroupName string, serverName string, databaseName string, expand string) (result Database, err error) { req, err := client.GetPreparer(resourceGroupName, serverName, databaseName, expand) if err != nil { @@ -291,8 +292,9 @@ func (client DatabasesClient) GetPreparer(resourceGroupName string, serverName s "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2014-04-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } if len(expand) > 0 { queryParameters["$expand"] = autorest.Encode("query", expand) @@ -325,13 +327,12 @@ func (client DatabasesClient) GetResponder(resp *http.Response) (result Database return } -// GetServiceTierAdvisor gets information about a service tier advisor. +// GetServiceTierAdvisor gets a service tier advisor. // // resourceGroupName is the name of the resource group that contains the // resource. You can obtain this value from the Azure Resource Manager API or -// the portal. serverName is the name of the Azure SQL server. databaseName -// is the name of database. serviceTierAdvisorName is the name of service -// tier advisor. +// the portal. serverName is the name of the server. databaseName is the name +// of database. serviceTierAdvisorName is the name of service tier advisor. func (client DatabasesClient) GetServiceTierAdvisor(resourceGroupName string, serverName string, databaseName string, serviceTierAdvisorName string) (result ServiceTierAdvisor, err error) { req, err := client.GetServiceTierAdvisorPreparer(resourceGroupName, serverName, databaseName, serviceTierAdvisorName) if err != nil { @@ -362,8 +363,9 @@ func (client DatabasesClient) GetServiceTierAdvisorPreparer(resourceGroupName st "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2014-04-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -393,14 +395,13 @@ func (client DatabasesClient) GetServiceTierAdvisorResponder(resp *http.Response return } -// GetTransparentDataEncryptionConfiguration gets an Azure SQL Database -// Transparent Data Encryption Response. +// GetTransparentDataEncryptionConfiguration gets a database's transparent data +// encryption configuration. // // resourceGroupName is the name of the resource group that contains the // resource. You can obtain this value from the Azure Resource Manager API or -// the portal. serverName is the name of the Azure SQL server. databaseName -// is the name of the Azure SQL database for which the Transparent Data -// Encryption applies. +// the portal. serverName is the name of the server. databaseName is the name +// of the database for which the transparent data encryption applies. func (client DatabasesClient) GetTransparentDataEncryptionConfiguration(resourceGroupName string, serverName string, databaseName string) (result TransparentDataEncryption, err error) { req, err := client.GetTransparentDataEncryptionConfigurationPreparer(resourceGroupName, serverName, databaseName) if err != nil { @@ -430,8 +431,9 @@ func (client DatabasesClient) GetTransparentDataEncryptionConfigurationPreparer( "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2014-04-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -461,13 +463,16 @@ func (client DatabasesClient) GetTransparentDataEncryptionConfigurationResponder return } -// ListByServer returns information about an Azure SQL database. +// ListByServer returns a list of databases in a server. // // resourceGroupName is the name of the resource group that contains the // resource. You can obtain this value from the Azure Resource Manager API or -// the portal. serverName is the name of the Azure SQL server. -func (client DatabasesClient) ListByServer(resourceGroupName string, serverName string) (result DatabaseListResult, err error) { - req, err := client.ListByServerPreparer(resourceGroupName, serverName) +// the portal. serverName is the name of the server. expand is a comma +// separated list of child objects to expand in the response. Possible +// properties: serviceTierAdvisors, transparentDataEncryption. filter is an +// OData filter expression that describes a subset of databases to return. +func (client DatabasesClient) ListByServer(resourceGroupName string, serverName string, expand string, filter string) (result DatabaseListResult, err error) { + req, err := client.ListByServerPreparer(resourceGroupName, serverName, expand, filter) if err != nil { return result, autorest.NewErrorWithError(err, "sql.DatabasesClient", "ListByServer", nil, "Failure preparing request") } @@ -487,15 +492,22 @@ func (client DatabasesClient) ListByServer(resourceGroupName string, serverName } // ListByServerPreparer prepares the ListByServer request. -func (client DatabasesClient) ListByServerPreparer(resourceGroupName string, serverName string) (*http.Request, error) { +func (client DatabasesClient) ListByServerPreparer(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": client.APIVersion, + "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( @@ -525,13 +537,12 @@ func (client DatabasesClient) ListByServerResponder(resp *http.Response) (result return } -// ListRestorePoints returns a list of Azure SQL database restore points. +// ListRestorePoints returns a list of database restore points. // // resourceGroupName is the name of the resource group that contains the // resource. You can obtain this value from the Azure Resource Manager API or -// the portal. serverName is the name of the Azure SQL server. databaseName -// is the name of the Azure SQL database from which to retrieve available -// restore points. +// the portal. serverName is the name of the server. databaseName is the name +// of the database from which to retrieve available restore points. func (client DatabasesClient) ListRestorePoints(resourceGroupName string, serverName string, databaseName string) (result RestorePointListResult, err error) { req, err := client.ListRestorePointsPreparer(resourceGroupName, serverName, databaseName) if err != nil { @@ -561,8 +572,9 @@ func (client DatabasesClient) ListRestorePointsPreparer(resourceGroupName string "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2014-04-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -592,13 +604,13 @@ func (client DatabasesClient) ListRestorePointsResponder(resp *http.Response) (r return } -// ListServiceTierAdvisors returns information about service tier advisors for -// specified database. +// ListServiceTierAdvisors returns service tier advisors for specified +// database. // // resourceGroupName is the name of the resource group that contains the // resource. You can obtain this value from the Azure Resource Manager API or -// the portal. serverName is the name of the Azure SQL server. databaseName -// is the name of database. +// the portal. serverName is the name of the server. databaseName is the name +// of database. func (client DatabasesClient) ListServiceTierAdvisors(resourceGroupName string, serverName string, databaseName string) (result ServiceTierAdvisorListResult, err error) { req, err := client.ListServiceTierAdvisorsPreparer(resourceGroupName, serverName, databaseName) if err != nil { @@ -628,8 +640,9 @@ func (client DatabasesClient) ListServiceTierAdvisorsPreparer(resourceGroupName "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2014-04-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -659,14 +672,13 @@ func (client DatabasesClient) ListServiceTierAdvisorsResponder(resp *http.Respon return } -// ListTransparentDataEncryptionActivity returns an Azure SQL Database -// Transparent Data Encryption Activity Response. +// ListTransparentDataEncryptionActivity returns a database's transparent data +// encryption operation result. // // resourceGroupName is the name of the resource group that contains the // resource. You can obtain this value from the Azure Resource Manager API or -// the portal. serverName is the name of the Azure SQL server. databaseName -// is the name of the Azure SQL database for which the Transparent Data -// Encryption applies. +// the portal. serverName is the name of the server. databaseName is the name +// of the database for which the transparent data encryption applies. func (client DatabasesClient) ListTransparentDataEncryptionActivity(resourceGroupName string, serverName string, databaseName string) (result TransparentDataEncryptionActivityListResult, err error) { req, err := client.ListTransparentDataEncryptionActivityPreparer(resourceGroupName, serverName, databaseName) if err != nil { @@ -696,8 +708,9 @@ func (client DatabasesClient) ListTransparentDataEncryptionActivityPreparer(reso "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2014-04-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -727,12 +740,12 @@ func (client DatabasesClient) ListTransparentDataEncryptionActivityResponder(res return } -// ListUsages returns information about Azure SQL database usages. +// ListUsages returns database usages. // // resourceGroupName is the name of the resource group that contains the // resource. You can obtain this value from the Azure Resource Manager API or -// the portal. serverName is the name of the Azure SQL server. databaseName -// is the name of the Azure SQL database. +// the portal. serverName is the name of the server. databaseName is the name +// of the database. func (client DatabasesClient) ListUsages(resourceGroupName string, serverName string, databaseName string) (result DatabaseMetricListResult, err error) { req, err := client.ListUsagesPreparer(resourceGroupName, serverName, databaseName) if err != nil { @@ -762,8 +775,9 @@ func (client DatabasesClient) ListUsagesPreparer(resourceGroupName string, serve "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2014-04-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -793,37 +807,36 @@ func (client DatabasesClient) ListUsagesResponder(resp *http.Response) (result D return } -// PauseDataWarehouse pause an Azure SQL Data Warehouse database. This method -// may poll for completion. Polling can be canceled by passing the cancel -// channel argument. The channel will be used to cancel polling and any -// outstanding HTTP requests. +// Pause pauses a data warehouse. This method may poll for completion. Polling +// can be canceled by passing the cancel channel argument. The channel will be +// used to cancel polling and any outstanding HTTP requests. // // resourceGroupName is the name of the resource group that contains the // resource. You can obtain this value from the Azure Resource Manager API or -// the portal. serverName is the name of the Azure SQL server. databaseName -// is the name of the Azure SQL Data Warehouse database to pause. -func (client DatabasesClient) PauseDataWarehouse(resourceGroupName string, serverName string, databaseName string, cancel <-chan struct{}) (result autorest.Response, err error) { - req, err := client.PauseDataWarehousePreparer(resourceGroupName, serverName, databaseName, cancel) +// the portal. serverName is the name of the server. databaseName is the name +// of the data warehouse to pause. +func (client DatabasesClient) Pause(resourceGroupName string, serverName string, databaseName string, cancel <-chan struct{}) (result autorest.Response, err error) { + req, err := client.PausePreparer(resourceGroupName, serverName, databaseName, cancel) if err != nil { - return result, autorest.NewErrorWithError(err, "sql.DatabasesClient", "PauseDataWarehouse", nil, "Failure preparing request") + return result, autorest.NewErrorWithError(err, "sql.DatabasesClient", "Pause", nil, "Failure preparing request") } - resp, err := client.PauseDataWarehouseSender(req) + resp, err := client.PauseSender(req) if err != nil { result.Response = resp - return result, autorest.NewErrorWithError(err, "sql.DatabasesClient", "PauseDataWarehouse", resp, "Failure sending request") + return result, autorest.NewErrorWithError(err, "sql.DatabasesClient", "Pause", resp, "Failure sending request") } - result, err = client.PauseDataWarehouseResponder(resp) + result, err = client.PauseResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "PauseDataWarehouse", resp, "Failure responding to request") + err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "Pause", resp, "Failure responding to request") } return } -// PauseDataWarehousePreparer prepares the PauseDataWarehouse request. -func (client DatabasesClient) PauseDataWarehousePreparer(resourceGroupName string, serverName string, databaseName string, cancel <-chan struct{}) (*http.Request, error) { +// PausePreparer prepares the Pause request. +func (client DatabasesClient) PausePreparer(resourceGroupName string, serverName string, databaseName string, cancel <-chan struct{}) (*http.Request, error) { pathParameters := map[string]interface{}{ "databaseName": autorest.Encode("path", databaseName), "resourceGroupName": autorest.Encode("path", resourceGroupName), @@ -831,8 +844,9 @@ func (client DatabasesClient) PauseDataWarehousePreparer(resourceGroupName strin "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2014-04-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -843,17 +857,17 @@ func (client DatabasesClient) PauseDataWarehousePreparer(resourceGroupName strin return preparer.Prepare(&http.Request{Cancel: cancel}) } -// PauseDataWarehouseSender sends the PauseDataWarehouse request. The method will close the +// PauseSender sends the Pause request. The method will close the // http.Response Body if it receives an error. -func (client DatabasesClient) PauseDataWarehouseSender(req *http.Request) (*http.Response, error) { +func (client DatabasesClient) PauseSender(req *http.Request) (*http.Response, error) { return autorest.SendWithSender(client, req, azure.DoPollForAsynchronous(client.PollingDelay)) } -// PauseDataWarehouseResponder handles the response to the PauseDataWarehouse request. The method always +// PauseResponder handles the response to the Pause request. The method always // closes the http.Response Body. -func (client DatabasesClient) PauseDataWarehouseResponder(resp *http.Response) (result autorest.Response, err error) { +func (client DatabasesClient) PauseResponder(resp *http.Response) (result autorest.Response, err error) { err = autorest.Respond( resp, client.ByInspecting(), @@ -863,37 +877,36 @@ func (client DatabasesClient) PauseDataWarehouseResponder(resp *http.Response) ( return } -// ResumeDataWarehouse resume an Azure SQL Data Warehouse database. This -// method may poll for completion. Polling can be canceled by passing the -// cancel channel argument. The channel will be used to cancel polling and -// any outstanding HTTP requests. +// Resume resumes a data warehouse. This method may poll for completion. +// Polling can be canceled by passing the cancel channel argument. The channel +// will be used to cancel polling and any outstanding HTTP requests. // // resourceGroupName is the name of the resource group that contains the // resource. You can obtain this value from the Azure Resource Manager API or -// the portal. serverName is the name of the Azure SQL server. databaseName -// is the name of the Azure SQL Data Warehouse database to resume. -func (client DatabasesClient) ResumeDataWarehouse(resourceGroupName string, serverName string, databaseName string, cancel <-chan struct{}) (result autorest.Response, err error) { - req, err := client.ResumeDataWarehousePreparer(resourceGroupName, serverName, databaseName, cancel) +// the portal. serverName is the name of the server. databaseName is the name +// of the data warehouse to resume. +func (client DatabasesClient) Resume(resourceGroupName string, serverName string, databaseName string, cancel <-chan struct{}) (result autorest.Response, err error) { + req, err := client.ResumePreparer(resourceGroupName, serverName, databaseName, cancel) if err != nil { - return result, autorest.NewErrorWithError(err, "sql.DatabasesClient", "ResumeDataWarehouse", nil, "Failure preparing request") + return result, autorest.NewErrorWithError(err, "sql.DatabasesClient", "Resume", nil, "Failure preparing request") } - resp, err := client.ResumeDataWarehouseSender(req) + resp, err := client.ResumeSender(req) if err != nil { result.Response = resp - return result, autorest.NewErrorWithError(err, "sql.DatabasesClient", "ResumeDataWarehouse", resp, "Failure sending request") + return result, autorest.NewErrorWithError(err, "sql.DatabasesClient", "Resume", resp, "Failure sending request") } - result, err = client.ResumeDataWarehouseResponder(resp) + result, err = client.ResumeResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "ResumeDataWarehouse", resp, "Failure responding to request") + err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "Resume", resp, "Failure responding to request") } return } -// ResumeDataWarehousePreparer prepares the ResumeDataWarehouse request. -func (client DatabasesClient) ResumeDataWarehousePreparer(resourceGroupName string, serverName string, databaseName string, cancel <-chan struct{}) (*http.Request, error) { +// ResumePreparer prepares the Resume request. +func (client DatabasesClient) ResumePreparer(resourceGroupName string, serverName string, databaseName string, cancel <-chan struct{}) (*http.Request, error) { pathParameters := map[string]interface{}{ "databaseName": autorest.Encode("path", databaseName), "resourceGroupName": autorest.Encode("path", resourceGroupName), @@ -901,8 +914,9 @@ func (client DatabasesClient) ResumeDataWarehousePreparer(resourceGroupName stri "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2014-04-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -913,17 +927,17 @@ func (client DatabasesClient) ResumeDataWarehousePreparer(resourceGroupName stri return preparer.Prepare(&http.Request{Cancel: cancel}) } -// ResumeDataWarehouseSender sends the ResumeDataWarehouse request. The method will close the +// ResumeSender sends the Resume request. The method will close the // http.Response Body if it receives an error. -func (client DatabasesClient) ResumeDataWarehouseSender(req *http.Request) (*http.Response, error) { +func (client DatabasesClient) ResumeSender(req *http.Request) (*http.Response, error) { return autorest.SendWithSender(client, req, azure.DoPollForAsynchronous(client.PollingDelay)) } -// ResumeDataWarehouseResponder handles the response to the ResumeDataWarehouse request. The method always +// ResumeResponder handles the response to the Resume request. The method always // closes the http.Response Body. -func (client DatabasesClient) ResumeDataWarehouseResponder(resp *http.Response) (result autorest.Response, err error) { +func (client DatabasesClient) ResumeResponder(resp *http.Response) (result autorest.Response, err error) { err = autorest.Respond( resp, client.ByInspecting(), diff --git a/arm/sql/elasticpools.go b/arm/sql/elasticpools.go old mode 100644 new mode 100755 index e68d6674ae0c..07b4dbb0db54 --- a/arm/sql/elasticpools.go +++ b/arm/sql/elasticpools.go @@ -14,7 +14,7 @@ package sql // See the License for the specific language governing permissions and // limitations under the License. // -// Code generated by Microsoft (R) AutoRest Code Generator 0.17.0.0 +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 // Changes may cause incorrect behavior and will be lost if the code is // regenerated. @@ -25,7 +25,7 @@ import ( ) // ElasticPoolsClient is the provides create, read, update and delete -// functionality for Azure SQL resources including servers, databases, +// functionality for Azure SQL Database resources including servers, databases, // elastic pools, recommendations, operations, and usage metrics. type ElasticPoolsClient struct { ManagementClient @@ -42,17 +42,16 @@ func NewElasticPoolsClientWithBaseURI(baseURI string, subscriptionID string) Ela return ElasticPoolsClient{NewWithBaseURI(baseURI, subscriptionID)} } -// CreateOrUpdate creates a new Azure SQL elastic pool or updates an existing -// Azure SQL elastic pool. This method may poll for completion. Polling can -// be canceled by passing the cancel channel argument. The channel will be -// used to cancel polling and any outstanding HTTP requests. +// CreateOrUpdate creates a new elastic pool or updates an existing elastic +// pool. This method may poll for completion. Polling can be canceled by +// passing the cancel channel argument. The channel will be used to cancel +// polling and any outstanding HTTP requests. // // resourceGroupName is the name of the resource group that contains the // resource. You can obtain this value from the Azure Resource Manager API or -// the portal. serverName is the name of the Azure SQL server. -// elasticPoolName is the name of the Azure SQL Elastic Pool to be operated -// on (Updated or created). parameters is the required parameters for -// creating or updating an Elastic Pool. +// the portal. serverName is the name of the server. elasticPoolName is the +// name of the elastic pool to be operated on (updated or created). parameters +// is the required parameters for creating or updating an elastic pool. func (client ElasticPoolsClient) CreateOrUpdate(resourceGroupName string, serverName string, elasticPoolName string, parameters ElasticPool, cancel <-chan struct{}) (result autorest.Response, err error) { req, err := client.CreateOrUpdatePreparer(resourceGroupName, serverName, elasticPoolName, parameters, cancel) if err != nil { @@ -82,8 +81,9 @@ func (client ElasticPoolsClient) CreateOrUpdatePreparer(resourceGroupName string "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2014-04-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -116,12 +116,12 @@ func (client ElasticPoolsClient) CreateOrUpdateResponder(resp *http.Response) (r return } -// Delete deletes the Azure SQL elastic pool. +// Delete deletes the elastic pool. // // resourceGroupName is the name of the resource group that contains the // resource. You can obtain this value from the Azure Resource Manager API or -// the portal. serverName is the name of the Azure SQL server. -// elasticPoolName is the name of the Azure SQL Elastic Pool to be deleted. +// the portal. serverName is the name of the server. elasticPoolName is the +// name of the elastic pool to be deleted. func (client ElasticPoolsClient) Delete(resourceGroupName string, serverName string, elasticPoolName string) (result autorest.Response, err error) { req, err := client.DeletePreparer(resourceGroupName, serverName, elasticPoolName) if err != nil { @@ -151,8 +151,9 @@ func (client ElasticPoolsClient) DeletePreparer(resourceGroupName string, server "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2014-04-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -181,12 +182,12 @@ func (client ElasticPoolsClient) DeleteResponder(resp *http.Response) (result au return } -// Get gets information about an Azure SQL elastic pool. +// Get gets an elastic pool. // // resourceGroupName is the name of the resource group that contains the // resource. You can obtain this value from the Azure Resource Manager API or -// the portal. serverName is the name of the Azure SQL server. -// elasticPoolName is the name of the Azure SQL Elastic Pool to be retrieved. +// the portal. serverName is the name of the server. elasticPoolName is the +// name of the elastic pool to be retrieved. func (client ElasticPoolsClient) Get(resourceGroupName string, serverName string, elasticPoolName string) (result ElasticPool, err error) { req, err := client.GetPreparer(resourceGroupName, serverName, elasticPoolName) if err != nil { @@ -216,8 +217,9 @@ func (client ElasticPoolsClient) GetPreparer(resourceGroupName string, serverNam "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2014-04-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -247,14 +249,13 @@ func (client ElasticPoolsClient) GetResponder(resp *http.Response) (result Elast return } -// GetDatabase gets information about an Azure SQL database inside of an Azure -// SQL elastic pool. +// GetDatabase gets a database inside of an elastic pool. // // resourceGroupName is the name of the resource group that contains the // resource. You can obtain this value from the Azure Resource Manager API or -// the portal. serverName is the name of the Azure SQL server. -// elasticPoolName is the name of the Azure SQL Elastic Pool to be retrieved. -// databaseName is the name of the Azure SQL database to be retrieved. +// the portal. serverName is the name of the server. elasticPoolName is the +// name of the elastic pool to be retrieved. databaseName is the name of the +// database to be retrieved. func (client ElasticPoolsClient) GetDatabase(resourceGroupName string, serverName string, elasticPoolName string, databaseName string) (result Database, err error) { req, err := client.GetDatabasePreparer(resourceGroupName, serverName, elasticPoolName, databaseName) if err != nil { @@ -285,8 +286,9 @@ func (client ElasticPoolsClient) GetDatabasePreparer(resourceGroupName string, s "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2014-04-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -316,13 +318,12 @@ func (client ElasticPoolsClient) GetDatabaseResponder(resp *http.Response) (resu return } -// ListActivity returns information about Azure SQL elastic pool activities. +// ListActivity returns elastic pool activities. // // resourceGroupName is the name of the resource group that contains the // resource. You can obtain this value from the Azure Resource Manager API or -// the portal. serverName is the name of the Azure SQL server. -// elasticPoolName is the name of the Azure SQL Elastic Pool for which to get -// the current activity. +// the portal. serverName is the name of the server. elasticPoolName is the +// name of the elastic pool for which to get the current activity. func (client ElasticPoolsClient) ListActivity(resourceGroupName string, serverName string, elasticPoolName string) (result ElasticPoolActivityListResult, err error) { req, err := client.ListActivityPreparer(resourceGroupName, serverName, elasticPoolName) if err != nil { @@ -352,8 +353,9 @@ func (client ElasticPoolsClient) ListActivityPreparer(resourceGroupName string, "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2014-04-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -383,11 +385,11 @@ func (client ElasticPoolsClient) ListActivityResponder(resp *http.Response) (res return } -// ListByServer returns information about Azure SQL elastic pools. +// ListByServer returns a list of elastic pools in a server. // // resourceGroupName is the name of the resource group that contains the // resource. You can obtain this value from the Azure Resource Manager API or -// the portal. serverName is the name of the Azure SQL server. +// the portal. serverName is the name of the server. func (client ElasticPoolsClient) ListByServer(resourceGroupName string, serverName string) (result ElasticPoolListResult, err error) { req, err := client.ListByServerPreparer(resourceGroupName, serverName) if err != nil { @@ -416,8 +418,9 @@ func (client ElasticPoolsClient) ListByServerPreparer(resourceGroupName string, "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2014-04-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -447,15 +450,15 @@ func (client ElasticPoolsClient) ListByServerResponder(resp *http.Response) (res return } -// ListDatabaseActivity returns information about activity on Azure SQL -// databases inside of an Azure SQL elastic pool. +// ListDatabaseActivity returns activity on databases inside of an elastic +// pool. // -// elasticPoolName is the name of the Azure SQL Elastic Pool. // resourceGroupName is the name of the resource group that contains the // resource. You can obtain this value from the Azure Resource Manager API or -// the portal. serverName is the name of the Azure SQL server. -func (client ElasticPoolsClient) ListDatabaseActivity(elasticPoolName string, resourceGroupName string, serverName string) (result ElasticPoolDatabaseActivityListResult, err error) { - req, err := client.ListDatabaseActivityPreparer(elasticPoolName, resourceGroupName, serverName) +// the portal. serverName is the name of the server. elasticPoolName is the +// name of the elastic pool. +func (client ElasticPoolsClient) ListDatabaseActivity(resourceGroupName string, serverName string, elasticPoolName string) (result ElasticPoolDatabaseActivityListResult, err error) { + req, err := client.ListDatabaseActivityPreparer(resourceGroupName, serverName, elasticPoolName) if err != nil { return result, autorest.NewErrorWithError(err, "sql.ElasticPoolsClient", "ListDatabaseActivity", nil, "Failure preparing request") } @@ -475,7 +478,7 @@ func (client ElasticPoolsClient) ListDatabaseActivity(elasticPoolName string, re } // ListDatabaseActivityPreparer prepares the ListDatabaseActivity request. -func (client ElasticPoolsClient) ListDatabaseActivityPreparer(elasticPoolName string, resourceGroupName string, serverName string) (*http.Request, error) { +func (client ElasticPoolsClient) ListDatabaseActivityPreparer(resourceGroupName string, serverName string, elasticPoolName string) (*http.Request, error) { pathParameters := map[string]interface{}{ "elasticPoolName": autorest.Encode("path", elasticPoolName), "resourceGroupName": autorest.Encode("path", resourceGroupName), @@ -483,8 +486,9 @@ func (client ElasticPoolsClient) ListDatabaseActivityPreparer(elasticPoolName st "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2014-04-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -514,13 +518,12 @@ func (client ElasticPoolsClient) ListDatabaseActivityResponder(resp *http.Respon return } -// ListDatabases returns information about an Azure SQL database inside of an -// Azure SQL elastic pool. +// ListDatabases returns a list of databases in an elastic pool. // // resourceGroupName is the name of the resource group that contains the // resource. You can obtain this value from the Azure Resource Manager API or -// the portal. serverName is the name of the Azure SQL server. -// elasticPoolName is the name of the Azure SQL Elastic Pool to be retrieved. +// the portal. serverName is the name of the server. elasticPoolName is the +// name of the elastic pool to be retrieved. func (client ElasticPoolsClient) ListDatabases(resourceGroupName string, serverName string, elasticPoolName string) (result DatabaseListResult, err error) { req, err := client.ListDatabasesPreparer(resourceGroupName, serverName, elasticPoolName) if err != nil { @@ -550,8 +553,9 @@ func (client ElasticPoolsClient) ListDatabasesPreparer(resourceGroupName string, "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2014-04-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( diff --git a/arm/sql/models.go b/arm/sql/models.go old mode 100644 new mode 100755 index 497d7defb9c3..9d274a8214a7 --- a/arm/sql/models.go +++ b/arm/sql/models.go @@ -14,7 +14,7 @@ package sql // See the License for the specific language governing permissions and // limitations under the License. // -// Code generated by Microsoft (R) AutoRest Code Generator 0.17.0.0 +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 // Changes may cause incorrect behavior and will be lost if the code is // regenerated. @@ -44,43 +44,50 @@ const ( Recovery CreateMode = "Recovery" // Restore specifies the restore state for create mode. Restore CreateMode = "Restore" + // RestoreLongTermRetentionBackup specifies the restore long term retention + // backup state for create mode. + RestoreLongTermRetentionBackup CreateMode = "RestoreLongTermRetentionBackup" ) -// DatabaseEditions enumerates the values for database editions. -type DatabaseEditions string +// DatabaseEdition enumerates the values for database edition. +type DatabaseEdition string const ( - // Basic specifies the basic state for database editions. - Basic DatabaseEditions = "Basic" - // Business specifies the business state for database editions. - Business DatabaseEditions = "Business" - // DataWarehouse specifies the data warehouse state for database editions. - DataWarehouse DatabaseEditions = "DataWarehouse" - // Free specifies the free state for database editions. - Free DatabaseEditions = "Free" - // Premium specifies the premium state for database editions. - Premium DatabaseEditions = "Premium" - // Standard specifies the standard state for database editions. - Standard DatabaseEditions = "Standard" - // Stretch specifies the stretch state for database editions. - Stretch DatabaseEditions = "Stretch" - // Web specifies the web state for database editions. - Web DatabaseEditions = "Web" + // Basic specifies the basic state for database edition. + Basic DatabaseEdition = "Basic" + // Business specifies the business state for database edition. + Business DatabaseEdition = "Business" + // DataWarehouse specifies the data warehouse state for database edition. + DataWarehouse DatabaseEdition = "DataWarehouse" + // Free specifies the free state for database edition. + Free DatabaseEdition = "Free" + // Premium specifies the premium state for database edition. + Premium DatabaseEdition = "Premium" + // Standard specifies the standard state for database edition. + Standard DatabaseEdition = "Standard" + // Stretch specifies the stretch state for database edition. + Stretch DatabaseEdition = "Stretch" + // System specifies the system state for database edition. + System DatabaseEdition = "System" + // System2 specifies the system 2 state for database edition. + System2 DatabaseEdition = "System2" + // Web specifies the web state for database edition. + Web DatabaseEdition = "Web" ) -// ElasticPoolEditions enumerates the values for elastic pool editions. -type ElasticPoolEditions string +// ElasticPoolEdition enumerates the values for elastic pool edition. +type ElasticPoolEdition string const ( - // ElasticPoolEditionsBasic specifies the elastic pool editions basic - // state for elastic pool editions. - ElasticPoolEditionsBasic ElasticPoolEditions = "Basic" - // ElasticPoolEditionsPremium specifies the elastic pool editions premium - // state for elastic pool editions. - ElasticPoolEditionsPremium ElasticPoolEditions = "Premium" - // ElasticPoolEditionsStandard specifies the elastic pool editions - // standard state for elastic pool editions. - ElasticPoolEditionsStandard ElasticPoolEditions = "Standard" + // ElasticPoolEditionBasic specifies the elastic pool edition basic state + // for elastic pool edition. + ElasticPoolEditionBasic ElasticPoolEdition = "Basic" + // ElasticPoolEditionPremium specifies the elastic pool edition premium + // state for elastic pool edition. + ElasticPoolEditionPremium ElasticPoolEdition = "Premium" + // ElasticPoolEditionStandard specifies the elastic pool edition standard + // state for elastic pool edition. + ElasticPoolEditionStandard ElasticPoolEdition = "Standard" ) // ElasticPoolState enumerates the values for elastic pool state. @@ -95,61 +102,72 @@ const ( Ready ElasticPoolState = "Ready" ) -// RecommendedIndexActions enumerates the values for recommended index actions. -type RecommendedIndexActions string +// ReadScale enumerates the values for read scale. +type ReadScale string const ( - // Create specifies the create state for recommended index actions. - Create RecommendedIndexActions = "Create" - // Drop specifies the drop state for recommended index actions. - Drop RecommendedIndexActions = "Drop" - // Rebuild specifies the rebuild state for recommended index actions. - Rebuild RecommendedIndexActions = "Rebuild" + // ReadScaleDisabled specifies the read scale disabled state for read + // scale. + ReadScaleDisabled ReadScale = "Disabled" + // ReadScaleEnabled specifies the read scale enabled state for read scale. + ReadScaleEnabled ReadScale = "Enabled" ) -// RecommendedIndexStates enumerates the values for recommended index states. -type RecommendedIndexStates string +// RecommendedIndexAction enumerates the values for recommended index action. +type RecommendedIndexAction string const ( - // Active specifies the active state for recommended index states. - Active RecommendedIndexStates = "Active" - // Blocked specifies the blocked state for recommended index states. - Blocked RecommendedIndexStates = "Blocked" - // Executing specifies the executing state for recommended index states. - Executing RecommendedIndexStates = "Executing" - // Expired specifies the expired state for recommended index states. - Expired RecommendedIndexStates = "Expired" - // Ignored specifies the ignored state for recommended index states. - Ignored RecommendedIndexStates = "Ignored" - // Pending specifies the pending state for recommended index states. - Pending RecommendedIndexStates = "Pending" + // Create specifies the create state for recommended index action. + Create RecommendedIndexAction = "Create" + // Drop specifies the drop state for recommended index action. + Drop RecommendedIndexAction = "Drop" + // Rebuild specifies the rebuild state for recommended index action. + Rebuild RecommendedIndexAction = "Rebuild" +) + +// RecommendedIndexState enumerates the values for recommended index state. +type RecommendedIndexState string + +const ( + // Active specifies the active state for recommended index state. + Active RecommendedIndexState = "Active" + // Blocked specifies the blocked state for recommended index state. + Blocked RecommendedIndexState = "Blocked" + // Executing specifies the executing state for recommended index state. + Executing RecommendedIndexState = "Executing" + // Expired specifies the expired state for recommended index state. + Expired RecommendedIndexState = "Expired" + // Ignored specifies the ignored state for recommended index state. + Ignored RecommendedIndexState = "Ignored" + // Pending specifies the pending state for recommended index state. + Pending RecommendedIndexState = "Pending" // PendingRevert specifies the pending revert state for recommended index - // states. - PendingRevert RecommendedIndexStates = "Pending Revert" - // Reverted specifies the reverted state for recommended index states. - Reverted RecommendedIndexStates = "Reverted" - // Reverting specifies the reverting state for recommended index states. - Reverting RecommendedIndexStates = "Reverting" - // Success specifies the success state for recommended index states. - Success RecommendedIndexStates = "Success" - // Verifying specifies the verifying state for recommended index states. - Verifying RecommendedIndexStates = "Verifying" + // state. + PendingRevert RecommendedIndexState = "Pending Revert" + // Reverted specifies the reverted state for recommended index state. + Reverted RecommendedIndexState = "Reverted" + // Reverting specifies the reverting state for recommended index state. + Reverting RecommendedIndexState = "Reverting" + // Success specifies the success state for recommended index state. + Success RecommendedIndexState = "Success" + // Verifying specifies the verifying state for recommended index state. + Verifying RecommendedIndexState = "Verifying" ) -// RecommendedIndexTypes enumerates the values for recommended index types. -type RecommendedIndexTypes string +// RecommendedIndexType enumerates the values for recommended index type. +type RecommendedIndexType string const ( - // CLUSTERED specifies the clustered state for recommended index types. - CLUSTERED RecommendedIndexTypes = "CLUSTERED" + // CLUSTERED specifies the clustered state for recommended index type. + CLUSTERED RecommendedIndexType = "CLUSTERED" // CLUSTEREDCOLUMNSTORE specifies the clusteredcolumnstore state for - // recommended index types. - CLUSTEREDCOLUMNSTORE RecommendedIndexTypes = "CLUSTERED COLUMNSTORE" - // COLUMNSTORE specifies the columnstore state for recommended index types. - COLUMNSTORE RecommendedIndexTypes = "COLUMNSTORE" + // recommended index type. + CLUSTEREDCOLUMNSTORE RecommendedIndexType = "CLUSTERED COLUMNSTORE" + // COLUMNSTORE specifies the columnstore state for recommended index type. + COLUMNSTORE RecommendedIndexType = "COLUMNSTORE" // NONCLUSTERED specifies the nonclustered state for recommended index - // types. - NONCLUSTERED RecommendedIndexTypes = "NONCLUSTERED" + // type. + NONCLUSTERED RecommendedIndexType = "NONCLUSTERED" ) // RestorePointTypes enumerates the values for restore point types. @@ -162,12 +180,32 @@ const ( DISCRETE RestorePointTypes = "DISCRETE" ) +// SampleName enumerates the values for sample name. +type SampleName string + +const ( + // AdventureWorksLT specifies the adventure works lt state for sample name. + AdventureWorksLT SampleName = "AdventureWorksLT" +) + +// ServerState enumerates the values for server state. +type ServerState string + +const ( + // ServerStateDisabled specifies the server state disabled state for server + // state. + ServerStateDisabled ServerState = "Disabled" + // ServerStateReady specifies the server state ready state for server + // state. + ServerStateReady ServerState = "Ready" +) + // ServerVersion enumerates the values for server version. type ServerVersion string const ( - // OneTwoFullStopZero specifies the one two full stop zero state for - // server version. + // OneTwoFullStopZero specifies the one two full stop zero state for server + // version. OneTwoFullStopZero ServerVersion = "12.0" // TwoFullStopZero specifies the two full stop zero state for server // version. @@ -181,142 +219,98 @@ const ( // ServiceObjectiveNameBasic specifies the service objective name basic // state for service objective name. ServiceObjectiveNameBasic ServiceObjectiveName = "Basic" - // ServiceObjectiveNameP1 specifies the service objective name p1 state - // for service objective name. + // ServiceObjectiveNameElasticPool specifies the service objective name + // elastic pool state for service objective name. + ServiceObjectiveNameElasticPool ServiceObjectiveName = "ElasticPool" + // ServiceObjectiveNameP1 specifies the service objective name p1 state for + // service objective name. ServiceObjectiveNameP1 ServiceObjectiveName = "P1" - // ServiceObjectiveNameP2 specifies the service objective name p2 state + // ServiceObjectiveNameP11 specifies the service objective name p11 state // for service objective name. - ServiceObjectiveNameP2 ServiceObjectiveName = "P2" - // ServiceObjectiveNameP3 specifies the service objective name p3 state + ServiceObjectiveNameP11 ServiceObjectiveName = "P11" + // ServiceObjectiveNameP15 specifies the service objective name p15 state // for service objective name. + ServiceObjectiveNameP15 ServiceObjectiveName = "P15" + // ServiceObjectiveNameP2 specifies the service objective name p2 state for + // service objective name. + ServiceObjectiveNameP2 ServiceObjectiveName = "P2" + // ServiceObjectiveNameP3 specifies the service objective name p3 state for + // service objective name. ServiceObjectiveNameP3 ServiceObjectiveName = "P3" - // ServiceObjectiveNameS0 specifies the service objective name s0 state - // for service objective name. + // ServiceObjectiveNameP4 specifies the service objective name p4 state for + // service objective name. + ServiceObjectiveNameP4 ServiceObjectiveName = "P4" + // ServiceObjectiveNameP6 specifies the service objective name p6 state for + // service objective name. + ServiceObjectiveNameP6 ServiceObjectiveName = "P6" + // ServiceObjectiveNameS0 specifies the service objective name s0 state for + // service objective name. ServiceObjectiveNameS0 ServiceObjectiveName = "S0" - // ServiceObjectiveNameS1 specifies the service objective name s1 state - // for service objective name. + // ServiceObjectiveNameS1 specifies the service objective name s1 state for + // service objective name. ServiceObjectiveNameS1 ServiceObjectiveName = "S1" - // ServiceObjectiveNameS2 specifies the service objective name s2 state - // for service objective name. + // ServiceObjectiveNameS2 specifies the service objective name s2 state for + // service objective name. ServiceObjectiveNameS2 ServiceObjectiveName = "S2" - // ServiceObjectiveNameS3 specifies the service objective name s3 state - // for service objective name. + // ServiceObjectiveNameS3 specifies the service objective name s3 state for + // service objective name. ServiceObjectiveNameS3 ServiceObjectiveName = "S3" + // ServiceObjectiveNameSystem specifies the service objective name system + // state for service objective name. + ServiceObjectiveNameSystem ServiceObjectiveName = "System" + // ServiceObjectiveNameSystem2 specifies the service objective name system + // 2 state for service objective name. + ServiceObjectiveNameSystem2 ServiceObjectiveName = "System2" ) -// TableType enumerates the values for table type. -type TableType string - -const ( - // BaseTable specifies the base table state for table type. - BaseTable TableType = "BaseTable" - // View specifies the view state for table type. - View TableType = "View" -) - -// TargetDatabaseEditions enumerates the values for target database editions. -type TargetDatabaseEditions string - -const ( - // TargetDatabaseEditionsBasic specifies the target database editions - // basic state for target database editions. - TargetDatabaseEditionsBasic TargetDatabaseEditions = "Basic" - // TargetDatabaseEditionsDataWarehouse specifies the target database - // editions data warehouse state for target database editions. - TargetDatabaseEditionsDataWarehouse TargetDatabaseEditions = "DataWarehouse" - // TargetDatabaseEditionsFree specifies the target database editions free - // state for target database editions. - TargetDatabaseEditionsFree TargetDatabaseEditions = "Free" - // TargetDatabaseEditionsPremium specifies the target database editions - // premium state for target database editions. - TargetDatabaseEditionsPremium TargetDatabaseEditions = "Premium" - // TargetDatabaseEditionsStandard specifies the target database editions - // standard state for target database editions. - TargetDatabaseEditionsStandard TargetDatabaseEditions = "Standard" - // TargetDatabaseEditionsStretch specifies the target database editions - // stretch state for target database editions. - TargetDatabaseEditionsStretch TargetDatabaseEditions = "Stretch" -) - -// TargetElasticPoolEditions enumerates the values for target elastic pool -// editions. -type TargetElasticPoolEditions string - -const ( - // TargetElasticPoolEditionsBasic specifies the target elastic pool - // editions basic state for target elastic pool editions. - TargetElasticPoolEditionsBasic TargetElasticPoolEditions = "Basic" - // TargetElasticPoolEditionsPremium specifies the target elastic pool - // editions premium state for target elastic pool editions. - TargetElasticPoolEditionsPremium TargetElasticPoolEditions = "Premium" - // TargetElasticPoolEditionsStandard specifies the target elastic pool - // editions standard state for target elastic pool editions. - TargetElasticPoolEditionsStandard TargetElasticPoolEditions = "Standard" -) - -// TransparentDataEncryptionActivityStates enumerates the values for -// transparent data encryption activity states. -type TransparentDataEncryptionActivityStates string +// TransparentDataEncryptionActivityStatus enumerates the values for +// transparent data encryption activity status. +type TransparentDataEncryptionActivityStatus string const ( // Decrypting specifies the decrypting state for transparent data - // encryption activity states. - Decrypting TransparentDataEncryptionActivityStates = "Decrypting" + // encryption activity status. + Decrypting TransparentDataEncryptionActivityStatus = "Decrypting" // Encrypting specifies the encrypting state for transparent data - // encryption activity states. - Encrypting TransparentDataEncryptionActivityStates = "Encrypting" + // encryption activity status. + Encrypting TransparentDataEncryptionActivityStatus = "Encrypting" ) -// TransparentDataEncryptionStates enumerates the values for transparent data -// encryption states. -type TransparentDataEncryptionStates string +// TransparentDataEncryptionStatus enumerates the values for transparent data +// encryption status. +type TransparentDataEncryptionStatus string const ( - // TransparentDataEncryptionStatesDisabled specifies the transparent data - // encryption states disabled state for transparent data encryption - // states. - TransparentDataEncryptionStatesDisabled TransparentDataEncryptionStates = "Disabled" - // TransparentDataEncryptionStatesEnabled specifies the transparent data - // encryption states enabled state for transparent data encryption states. - TransparentDataEncryptionStatesEnabled TransparentDataEncryptionStates = "Enabled" + // TransparentDataEncryptionStatusDisabled specifies the transparent data + // encryption status disabled state for transparent data encryption status. + TransparentDataEncryptionStatusDisabled TransparentDataEncryptionStatus = "Disabled" + // TransparentDataEncryptionStatusEnabled specifies the transparent data + // encryption status enabled state for transparent data encryption status. + TransparentDataEncryptionStatusEnabled TransparentDataEncryptionStatus = "Enabled" ) -// Column is represents an Azure SQL Database table column. -type Column struct { - Name *string `json:"name,omitempty"` - ID *string `json:"id,omitempty"` - Type *string `json:"type,omitempty"` - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - *ColumnProperties `json:"properties,omitempty"` -} - -// ColumnProperties is represents the properties of an Azure SQL Database -// table column. -type ColumnProperties struct { - ColumnType *string `json:"columnType,omitempty"` -} - -// Database is represents an Azure SQL Database. +// Database is represents a database. type Database struct { autorest.Response `json:"-"` - Name *string `json:"name,omitempty"` ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` Type *string `json:"type,omitempty"` - Location *string `json:"location,omitempty"` Tags *map[string]*string `json:"tags,omitempty"` + Location *string `json:"location,omitempty"` + Kind *string `json:"kind,omitempty"` *DatabaseProperties `json:"properties,omitempty"` } -// DatabaseListResult is represents the response to a List Azure SQL Database -// request. +// DatabaseListResult is represents the response to a list database request. type DatabaseListResult struct { autorest.Response `json:"-"` Value *[]Database `json:"value,omitempty"` } -// DatabaseMetric is represents Azure SQL Database metrics. +// DatabaseMetric is represents database metrics. type DatabaseMetric struct { + Name *string `json:"name,omitempty"` + ID *string `json:"id,omitempty"` ResourceName *string `json:"resourceName,omitempty"` DisplayName *string `json:"displayName,omitempty"` CurrentValue *float64 `json:"currentValue,omitempty"` @@ -325,107 +319,113 @@ type DatabaseMetric struct { NextResetTime *date.Time `json:"nextResetTime,omitempty"` } -// DatabaseMetricListResult is represents the response to a List Azure SQL -// Database metrics request. +// DatabaseMetricListResult is represents the response to a list database +// metrics request. type DatabaseMetricListResult struct { autorest.Response `json:"-"` Value *[]DatabaseMetric `json:"value,omitempty"` } -// DatabaseProperties is represents the properties of an Azure SQL Database. +// DatabaseProperties is represents the properties of a database. type DatabaseProperties struct { - Collation *string `json:"collation,omitempty"` - CreationDate *date.Time `json:"creationDate,omitempty"` - ContainmentState *int64 `json:"containmentState,omitempty"` - CurrentServiceObjectiveID *uuid.UUID `json:"currentServiceObjectiveId,omitempty"` - DatabaseID *string `json:"databaseId,omitempty"` - EarliestRestoreDate *date.Time `json:"earliestRestoreDate,omitempty"` - CreateMode CreateMode `json:"createMode,omitempty"` - SourceDatabaseID *string `json:"sourceDatabaseId,omitempty"` - Edition DatabaseEditions `json:"edition,omitempty"` - MaxSizeBytes *string `json:"maxSizeBytes,omitempty"` - RequestedServiceObjectiveID *uuid.UUID `json:"requestedServiceObjectiveId,omitempty"` - RequestedServiceObjectiveName ServiceObjectiveName `json:"requestedServiceObjectiveName,omitempty"` - ServiceLevelObjective ServiceObjectiveName `json:"serviceLevelObjective,omitempty"` - Status *string `json:"status,omitempty"` - ElasticPoolName *string `json:"elasticPoolName,omitempty"` - DefaultSecondaryLocation *string `json:"defaultSecondaryLocation,omitempty"` - ServiceTierAdvisors *[]ServiceTierAdvisor `json:"serviceTierAdvisors,omitempty"` - UpgradeHint *UpgradeHint `json:"upgradeHint,omitempty"` - Schemas *[]Schema `json:"schemas,omitempty"` - TransparentDataEncryption *[]TransparentDataEncryption `json:"transparentDataEncryption,omitempty"` - RecommendedIndex *[]RecommendedIndex `json:"recommendedIndex,omitempty"` -} - -// ElasticPool is represents an Azure SQL Database elastic pool. + Collation *string `json:"collation,omitempty"` + CreationDate *date.Time `json:"creationDate,omitempty"` + ContainmentState *int64 `json:"containmentState,omitempty"` + CurrentServiceObjectiveID *uuid.UUID `json:"currentServiceObjectiveId,omitempty"` + DatabaseID *string `json:"databaseId,omitempty"` + EarliestRestoreDate *date.Time `json:"earliestRestoreDate,omitempty"` + CreateMode CreateMode `json:"createMode,omitempty"` + SourceDatabaseID *string `json:"sourceDatabaseId,omitempty"` + SourceDatabaseDeletionDate *date.Time `json:"sourceDatabaseDeletionDate,omitempty"` + RestorePointInTime *date.Time `json:"restorePointInTime,omitempty"` + RecoveryServicesRecoveryPointResourceID *date.Time `json:"recoveryServicesRecoveryPointResourceId,omitempty"` + Edition DatabaseEdition `json:"edition,omitempty"` + MaxSizeBytes *string `json:"maxSizeBytes,omitempty"` + RequestedServiceObjectiveID *uuid.UUID `json:"requestedServiceObjectiveId,omitempty"` + RequestedServiceObjectiveName ServiceObjectiveName `json:"requestedServiceObjectiveName,omitempty"` + ServiceLevelObjective ServiceObjectiveName `json:"serviceLevelObjective,omitempty"` + Status *string `json:"status,omitempty"` + ElasticPoolName *string `json:"elasticPoolName,omitempty"` + DefaultSecondaryLocation *string `json:"defaultSecondaryLocation,omitempty"` + ServiceTierAdvisors *[]ServiceTierAdvisor `json:"serviceTierAdvisors,omitempty"` + TransparentDataEncryption *[]TransparentDataEncryption `json:"transparentDataEncryption,omitempty"` + RecommendedIndex *[]RecommendedIndex `json:"recommendedIndex,omitempty"` + FailoverGroupID *uuid.UUID `json:"failoverGroupId,omitempty"` + ReadScale ReadScale `json:"readScale,omitempty"` + SampleName SampleName `json:"sampleName,omitempty"` +} + +// ElasticPool is represents a database elastic pool. type ElasticPool struct { autorest.Response `json:"-"` - Name *string `json:"name,omitempty"` ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` Type *string `json:"type,omitempty"` - Location *string `json:"location,omitempty"` Tags *map[string]*string `json:"tags,omitempty"` + Location *string `json:"location,omitempty"` *ElasticPoolProperties `json:"properties,omitempty"` + Kind *string `json:"kind,omitempty"` } -// ElasticPoolActivity is represents the activity on an Azure SQL Elastic Pool. +// ElasticPoolActivity is represents the activity on an elastic pool. type ElasticPoolActivity struct { - Name *string `json:"name,omitempty"` - ID *string `json:"id,omitempty"` - Type *string `json:"type,omitempty"` - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Location *string `json:"location,omitempty"` *ElasticPoolActivityProperties `json:"properties,omitempty"` } -// ElasticPoolActivityListResult is represents the response to a List Azure -// SQL Elastic Pool Activity request. +// ElasticPoolActivityListResult is represents the response to a list elastic +// pool activity request. type ElasticPoolActivityListResult struct { autorest.Response `json:"-"` Value *[]ElasticPoolActivity `json:"value,omitempty"` } -// ElasticPoolActivityProperties is represents the properties of an Azure SQL -// Elastic Pool. +// ElasticPoolActivityProperties is represents the properties of an elastic +// pool. type ElasticPoolActivityProperties struct { - EndTime *date.Time `json:"endTime,omitempty"` - ErrorCode *int32 `json:"errorCode,omitempty"` - ErrorMessage *string `json:"errorMessage,omitempty"` - ErrorSeverity *int32 `json:"errorSeverity,omitempty"` - Operation *string `json:"operation,omitempty"` - OperationID *string `json:"operationId,omitempty"` - PercentComplete *int32 `json:"percentComplete,omitempty"` - RequestedDatabaseDtuMax *int32 `json:"requestedDatabaseDtuMax,omitempty"` - RequestedDatabaseDtuMin *int32 `json:"requestedDatabaseDtuMin,omitempty"` - RequestedDtu *int32 `json:"requestedDtu,omitempty"` - RequestedElasticPoolName *string `json:"requestedElasticPoolName,omitempty"` - RequestedStorageLimitInGB *int64 `json:"requestedStorageLimitInGB,omitempty"` - ElasticPoolName *string `json:"elasticPoolName,omitempty"` - ServerName *string `json:"serverName,omitempty"` - StartTime *date.Time `json:"startTime,omitempty"` - State *string `json:"state,omitempty"` -} - -// ElasticPoolDatabaseActivity is represents the activity on an Azure SQL -// Elastic Pool. + EndTime *date.Time `json:"endTime,omitempty"` + ErrorCode *int32 `json:"errorCode,omitempty"` + ErrorMessage *string `json:"errorMessage,omitempty"` + ErrorSeverity *int32 `json:"errorSeverity,omitempty"` + Operation *string `json:"operation,omitempty"` + OperationID *string `json:"operationId,omitempty"` + PercentComplete *int32 `json:"percentComplete,omitempty"` + RequestedDatabaseDtuMax *int32 `json:"requestedDatabaseDtuMax,omitempty"` + RequestedDatabaseDtuMin *int32 `json:"requestedDatabaseDtuMin,omitempty"` + RequestedDtu *int32 `json:"requestedDtu,omitempty"` + RequestedElasticPoolName *string `json:"requestedElasticPoolName,omitempty"` + RequestedStorageLimitInGB *int64 `json:"requestedStorageLimitInGB,omitempty"` + ElasticPoolName *string `json:"elasticPoolName,omitempty"` + ServerName *string `json:"serverName,omitempty"` + StartTime *date.Time `json:"startTime,omitempty"` + State *string `json:"state,omitempty"` + RequestedStorageLimitInMB *int32 `json:"requestedStorageLimitInMB,omitempty"` + RequestedDatabaseDtuGuarantee *int32 `json:"requestedDatabaseDtuGuarantee,omitempty"` + RequestedDatabaseDtuCap *int32 `json:"requestedDatabaseDtuCap,omitempty"` + RequestedDtuGuarantee *int32 `json:"requestedDtuGuarantee,omitempty"` +} + +// ElasticPoolDatabaseActivity is represents the activity on an elastic pool. type ElasticPoolDatabaseActivity struct { - Name *string `json:"name,omitempty"` - ID *string `json:"id,omitempty"` - Type *string `json:"type,omitempty"` - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Location *string `json:"location,omitempty"` *ElasticPoolDatabaseActivityProperties `json:"properties,omitempty"` } -// ElasticPoolDatabaseActivityListResult is represents the response to a List -// Azure SQL Elastic Pool Database Activity request. +// ElasticPoolDatabaseActivityListResult is represents the response to a list +// elastic pool database activity request. type ElasticPoolDatabaseActivityListResult struct { autorest.Response `json:"-"` Value *[]ElasticPoolDatabaseActivity `json:"value,omitempty"` } // ElasticPoolDatabaseActivityProperties is represents the properties of an -// Azure SQL Elastic Pool Database Activity. +// elastic pool database activity. type ElasticPoolDatabaseActivityProperties struct { DatabaseName *string `json:"databaseName,omitempty"` EndTime *date.Time `json:"endTime,omitempty"` @@ -433,7 +433,7 @@ type ElasticPoolDatabaseActivityProperties struct { ErrorMessage *string `json:"errorMessage,omitempty"` ErrorSeverity *int32 `json:"errorSeverity,omitempty"` Operation *string `json:"operation,omitempty"` - OperationID *string `json:"operationId,omitempty"` + OperationID *uuid.UUID `json:"operationId,omitempty"` PercentComplete *int32 `json:"percentComplete,omitempty"` RequestedElasticPoolName *string `json:"requestedElasticPoolName,omitempty"` CurrentElasticPoolName *string `json:"currentElasticPoolName,omitempty"` @@ -444,23 +444,35 @@ type ElasticPoolDatabaseActivityProperties struct { State *string `json:"state,omitempty"` } -// ElasticPoolListResult is represents the response to a List Azure SQL -// Elastic Pool request. +// ElasticPoolListResult is represents the response to a list elastic pool +// request. type ElasticPoolListResult struct { autorest.Response `json:"-"` Value *[]ElasticPool `json:"value,omitempty"` } -// ElasticPoolProperties is represents the properties of an Azure SQL Elastic -// Pool. +// ElasticPoolProperties is represents the properties of an elastic pool. type ElasticPoolProperties struct { - CreationDate *date.Time `json:"creationDate,omitempty"` - State ElasticPoolState `json:"state,omitempty"` - Edition ElasticPoolEditions `json:"edition,omitempty"` - Dtu *int32 `json:"dtu,omitempty"` - DatabaseDtuMax *int32 `json:"databaseDtuMax,omitempty"` - DatabaseDtuMin *int32 `json:"databaseDtuMin,omitempty"` - StorageMB *int32 `json:"storageMB,omitempty"` + CreationDate *date.Time `json:"creationDate,omitempty"` + State ElasticPoolState `json:"state,omitempty"` + Edition ElasticPoolEdition `json:"edition,omitempty"` + Dtu *int32 `json:"dtu,omitempty"` + DatabaseDtuMax *int32 `json:"databaseDtuMax,omitempty"` + DatabaseDtuMin *int32 `json:"databaseDtuMin,omitempty"` + StorageMB *int32 `json:"storageMB,omitempty"` +} + +// Operation is sQL REST API operation definition. +type Operation struct { + Name *string `json:"name,omitempty"` + Display *OperationDisplay `json:"display,omitempty"` +} + +// OperationDisplay is display metadata associated with the operation. +type OperationDisplay struct { + Provider *string `json:"provider,omitempty"` + Resource *string `json:"resource,omitempty"` + Operation *string `json:"operation,omitempty"` } // OperationImpact is represents impact of an operation, both in absolute and @@ -472,51 +484,55 @@ type OperationImpact struct { ChangeValueRelative *float64 `json:"changeValueRelative,omitempty"` } -// RecommendedDatabaseProperties is represents the properties of a recommended -// Azure SQL Database being upgraded. -type RecommendedDatabaseProperties struct { - Name *string `json:"Name,omitempty"` - TargetEdition TargetDatabaseEditions `json:"TargetEdition,omitempty"` - TargetServiceLevelObjective *string `json:"TargetServiceLevelObjective,omitempty"` +// OperationListResult is result of the request to list SQL 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 *[]Operation `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` } -// RecommendedElasticPool is represents an Azure SQL Recommended Elastic Pool. +// ProxyResource is aRM proxy resource. +type ProxyResource struct { + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` +} + +// RecommendedElasticPool is represents a recommented elastic pool. type RecommendedElasticPool struct { autorest.Response `json:"-"` - Name *string `json:"name,omitempty"` - ID *string `json:"id,omitempty"` - Type *string `json:"type,omitempty"` - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` *RecommendedElasticPoolProperties `json:"properties,omitempty"` } -// RecommendedElasticPoolListMetricsResult is represents the response to a -// List Azure SQL Recommended Elastic Pool metrics request. +// RecommendedElasticPoolListMetricsResult is represents the response to a list +// recommended elastic pool metrics request. type RecommendedElasticPoolListMetricsResult struct { autorest.Response `json:"-"` Value *[]RecommendedElasticPoolMetric `json:"value,omitempty"` } -// RecommendedElasticPoolListResult is represents the response to a List Azure -// SQL Recommended Elastic Pool request. +// RecommendedElasticPoolListResult is represents the response to a list +// recommended elastic pool request. type RecommendedElasticPoolListResult struct { autorest.Response `json:"-"` Value *[]RecommendedElasticPool `json:"value,omitempty"` } -// RecommendedElasticPoolMetric is represents Azure SQL recommended elastic -// pool metric. +// RecommendedElasticPoolMetric is represents recommended elastic pool metric. type RecommendedElasticPoolMetric struct { DateTime *date.Time `json:"dateTime,omitempty"` Dtu *float64 `json:"dtu,omitempty"` SizeGB *float64 `json:"sizeGB,omitempty"` } -// RecommendedElasticPoolProperties is represents the properties of an Azure -// SQL Recommended Elastic Pool. +// RecommendedElasticPoolProperties is represents the properties of a +// recommented elastic pool. type RecommendedElasticPoolProperties struct { - DatabaseEdition ElasticPoolEditions `json:"databaseEdition,omitempty"` + DatabaseEdition ElasticPoolEdition `json:"databaseEdition,omitempty"` Dtu *float64 `json:"dtu,omitempty"` DatabaseDtuMin *float64 `json:"databaseDtuMin,omitempty"` DatabaseDtuMax *float64 `json:"databaseDtuMax,omitempty"` @@ -529,103 +545,82 @@ type RecommendedElasticPoolProperties struct { Metrics *[]RecommendedElasticPoolMetric `json:"metrics,omitempty"` } -// RecommendedIndex is represents an Azure SQL Database recommended index. +// RecommendedIndex is represents a database recommended index. type RecommendedIndex struct { - Name *string `json:"name,omitempty"` - ID *string `json:"id,omitempty"` - Type *string `json:"type,omitempty"` - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` *RecommendedIndexProperties `json:"properties,omitempty"` } -// RecommendedIndexProperties is represents the properties of an Azure SQL -// Database recommended index. +// RecommendedIndexProperties is represents the properties of a database +// recommended index. type RecommendedIndexProperties struct { - Action RecommendedIndexActions `json:"action,omitempty"` - State RecommendedIndexStates `json:"state,omitempty"` - Created *date.Time `json:"created,omitempty"` - LastModified *date.Time `json:"lastModified,omitempty"` - IndexType RecommendedIndexTypes `json:"indexType,omitempty"` - Schema *string `json:"schema,omitempty"` - Table *string `json:"table,omitempty"` - Columns *[]string `json:"columns,omitempty"` - IncludedColumns *[]string `json:"includedColumns,omitempty"` - IndexScript *string `json:"indexScript,omitempty"` - EstimatedImpact *[]OperationImpact `json:"estimatedImpact,omitempty"` - ReportedImpact *[]OperationImpact `json:"reportedImpact,omitempty"` -} - -// Resource is resource properties + Action RecommendedIndexAction `json:"action,omitempty"` + State RecommendedIndexState `json:"state,omitempty"` + Created *date.Time `json:"created,omitempty"` + LastModified *date.Time `json:"lastModified,omitempty"` + IndexType RecommendedIndexType `json:"indexType,omitempty"` + Schema *string `json:"schema,omitempty"` + Table *string `json:"table,omitempty"` + Columns *[]string `json:"columns,omitempty"` + IncludedColumns *[]string `json:"includedColumns,omitempty"` + IndexScript *string `json:"indexScript,omitempty"` + EstimatedImpact *[]OperationImpact `json:"estimatedImpact,omitempty"` + ReportedImpact *[]OperationImpact `json:"reportedImpact,omitempty"` +} + +// Resource is aRM resource. type Resource struct { - Name *string `json:"name,omitempty"` - ID *string `json:"id,omitempty"` - Type *string `json:"type,omitempty"` - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` } -// RestorePoint is represents an Azure SQL Database restore point. +// RestorePoint is represents a database restore point. type RestorePoint struct { - Name *string `json:"name,omitempty"` - ID *string `json:"id,omitempty"` - Type *string `json:"type,omitempty"` - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` *RestorePointProperties `json:"properties,omitempty"` } -// RestorePointListResult is represents the response to a List Azure SQL -// Database restore points request. +// RestorePointListResult is represents the response to a list database restore +// points request. type RestorePointListResult struct { autorest.Response `json:"-"` Value *[]RestorePoint `json:"value,omitempty"` } -// RestorePointProperties is represents the properties of an Azure SQL -// Database restore point. +// RestorePointProperties is represents the properties of a database restore +// point. type RestorePointProperties struct { RestorePointType RestorePointTypes `json:"restorePointType,omitempty"` RestorePointCreationDate *date.Time `json:"restorePointCreationDate,omitempty"` EarliestRestoreDate *date.Time `json:"earliestRestoreDate,omitempty"` } -// Schema is represents an Azure SQL Database schema. -type Schema struct { - Name *string `json:"name,omitempty"` - ID *string `json:"id,omitempty"` - Type *string `json:"type,omitempty"` - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - *SchemaProperties `json:"properties,omitempty"` -} - -// SchemaProperties is represents the properties of an Azure SQL Database -// schema. -type SchemaProperties struct { - Tables *[]Table `json:"tables,omitempty"` -} - -// Server is represents an Azure SQL server. +// Server is represents a server. type Server struct { autorest.Response `json:"-"` - Name *string `json:"name,omitempty"` ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` Type *string `json:"type,omitempty"` - Location *string `json:"location,omitempty"` Tags *map[string]*string `json:"tags,omitempty"` + Location *string `json:"location,omitempty"` + Kind *string `json:"kind,omitempty"` *ServerProperties `json:"properties,omitempty"` } -// ServerListResult is represents the response to a Get Azure SQL server -// request. +// ServerListResult is represents the response to a get server request. type ServerListResult struct { autorest.Response `json:"-"` Value *[]Server `json:"value,omitempty"` } -// ServerMetric is represents Azure SQL server metrics. +// ServerMetric is represents server metrics. type ServerMetric struct { + Name *string `json:"name,omitempty"` ResourceName *string `json:"resourceName,omitempty"` DisplayName *string `json:"displayName,omitempty"` CurrentValue *float64 `json:"currentValue,omitempty"` @@ -634,22 +629,25 @@ type ServerMetric struct { NextResetTime *date.Time `json:"nextResetTime,omitempty"` } -// ServerMetricListResult is represents the response to a List Azure SQL -// server metrics request. +// ServerMetricListResult is represents the response to a list server metrics +// request. type ServerMetricListResult struct { autorest.Response `json:"-"` Value *[]ServerMetric `json:"value,omitempty"` } -// ServerProperties is represents the properties of an Azure SQL server. +// ServerProperties is represents the properties of a server. type ServerProperties struct { FullyQualifiedDomainName *string `json:"fullyQualifiedDomainName,omitempty"` Version ServerVersion `json:"version,omitempty"` AdministratorLogin *string `json:"administratorLogin,omitempty"` AdministratorLoginPassword *string `json:"administratorLoginPassword,omitempty"` + ExternalAdministratorSid *uuid.UUID `json:"externalAdministratorSid,omitempty"` + ExternalAdministratorLogin *string `json:"externalAdministratorLogin,omitempty"` + State ServerState `json:"state,omitempty"` } -// ServiceObjective is represents an Azure SQL Database Service Objective. +// ServiceObjective is represents a database service objective. type ServiceObjective struct { autorest.Response `json:"-"` Name *string `json:"name,omitempty"` @@ -657,15 +655,15 @@ type ServiceObjective struct { *ServiceObjectiveProperties `json:"properties,omitempty"` } -// ServiceObjectiveListResult is represents the response to a Get Azure SQL -// Database Service Objectives request. +// ServiceObjectiveListResult is represents the response to a get database +// service objectives request. type ServiceObjectiveListResult struct { autorest.Response `json:"-"` Value *[]ServiceObjective `json:"value,omitempty"` } -// ServiceObjectiveProperties is represents the properties of an Azure SQL -// Database Service Objective. +// ServiceObjectiveProperties is represents the properties of a database +// service objective. type ServiceObjectiveProperties struct { ServiceObjectiveName *string `json:"serviceObjectiveName,omitempty"` IsDefault *bool `json:"isDefault,omitempty"` @@ -700,7 +698,7 @@ type ServiceTierAdvisorProperties struct { MaxDtu *float64 `json:"maxDtu,omitempty"` MaxSizeInGB *float64 `json:"maxSizeInGB,omitempty"` ServiceLevelObjectiveUsageMetrics *[]SloUsageMetric `json:"serviceLevelObjectiveUsageMetrics,omitempty"` - CurrentServiceLevelObjective *uuid.UUID `json:"currentServiceLevelObjective,omitempty"` + CurrentServiceLevelObjective *string `json:"currentServiceLevelObjective,omitempty"` CurrentServiceLevelObjectiveID *uuid.UUID `json:"currentServiceLevelObjectiveId,omitempty"` UsageBasedRecommendationServiceLevelObjective *string `json:"usageBasedRecommendationServiceLevelObjective,omitempty"` UsageBasedRecommendationServiceLevelObjectiveID *uuid.UUID `json:"usageBasedRecommendationServiceLevelObjectiveId,omitempty"` @@ -715,11 +713,6 @@ type ServiceTierAdvisorProperties struct { // SloUsageMetric is represents a Slo Usage Metric. type SloUsageMetric struct { - Name *string `json:"name,omitempty"` - ID *string `json:"id,omitempty"` - Type *string `json:"type,omitempty"` - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` ServiceLevelObjective ServiceObjectiveName `json:"serviceLevelObjective,omitempty"` ServiceLevelObjectiveID *uuid.UUID `json:"serviceLevelObjectiveId,omitempty"` InRangeTimeRatio *float64 `json:"inRangeTimeRatio,omitempty"` @@ -731,25 +724,17 @@ type SubResource struct { ID *string `json:"id,omitempty"` } -// Table is represents an Azure SQL Database table. -type Table struct { - Name *string `json:"name,omitempty"` - ID *string `json:"id,omitempty"` - Type *string `json:"type,omitempty"` - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - *TableProperties `json:"properties,omitempty"` -} - -// TableProperties is represents the properties of an Azure SQL Database table. -type TableProperties struct { - TableType TableType `json:"tableType,omitempty"` - Columns *[]Column `json:"columns,omitempty"` - RecommendedIndexes *[]RecommendedIndex `json:"recommendedIndexes,omitempty"` +// TrackedResource is aRM tracked top level resource. +type TrackedResource struct { + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + Location *string `json:"location,omitempty"` } -// TransparentDataEncryption is represents an Azure SQL Database Transparent -// Data Encryption . +// TransparentDataEncryption is represents a database transparent data +// encryption . type TransparentDataEncryption struct { autorest.Response `json:"-"` Name *string `json:"name,omitempty"` @@ -757,8 +742,8 @@ type TransparentDataEncryption struct { *TransparentDataEncryptionProperties `json:"properties,omitempty"` } -// TransparentDataEncryptionActivity is represents an Azure SQL Database -// Transparent Data Encryption Scan. +// TransparentDataEncryptionActivity is represents a database transparent data +// encryption Scan. type TransparentDataEncryptionActivity struct { Name *string `json:"name,omitempty"` ID *string `json:"id,omitempty"` @@ -766,45 +751,21 @@ type TransparentDataEncryptionActivity struct { } // TransparentDataEncryptionActivityListResult is represents the response to a -// List Azure SQL Database Transparent Data Encryption Activity request. +// list database transparent data encryption activity request. type TransparentDataEncryptionActivityListResult struct { autorest.Response `json:"-"` Value *[]TransparentDataEncryptionActivity `json:"value,omitempty"` } // TransparentDataEncryptionActivityProperties is represents the properties of -// an Azure SQL Database Transparent Data Encryption Scan. +// a database transparent data encryption Scan. type TransparentDataEncryptionActivityProperties struct { - Status TransparentDataEncryptionActivityStates `json:"status,omitempty"` + Status TransparentDataEncryptionActivityStatus `json:"status,omitempty"` PercentComplete *float64 `json:"percentComplete,omitempty"` } -// TransparentDataEncryptionProperties is represents the properties of an -// Azure SQL Database Transparent Data Encryption. +// TransparentDataEncryptionProperties is represents the properties of a +// database transparent data encryption. type TransparentDataEncryptionProperties struct { - Status TransparentDataEncryptionStates `json:"status,omitempty"` -} - -// UpgradeHint is represents a Upgrade Hint. -type UpgradeHint struct { - Name *string `json:"name,omitempty"` - ID *string `json:"id,omitempty"` - Type *string `json:"type,omitempty"` - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - TargetServiceLevelObjective *string `json:"targetServiceLevelObjective,omitempty"` - TargetServiceLevelObjectiveID *uuid.UUID `json:"targetServiceLevelObjectiveId,omitempty"` -} - -// UpgradeRecommendedElasticPoolProperties is represents the properties of a -// Azure SQL Recommended Elastic Pool being upgraded. -type UpgradeRecommendedElasticPoolProperties struct { - Name *string `json:"Name,omitempty"` - Edition TargetElasticPoolEditions `json:"Edition,omitempty"` - Dtu *int32 `json:"Dtu,omitempty"` - StorageMb *int32 `json:"StorageMb,omitempty"` - DatabaseDtuMin *int32 `json:"DatabaseDtuMin,omitempty"` - DatabaseDtuMax *int32 `json:"DatabaseDtuMax,omitempty"` - DatabaseCollection *[]string `json:"DatabaseCollection,omitempty"` - IncludeAllDatabases *bool `json:"IncludeAllDatabases,omitempty"` + Status TransparentDataEncryptionStatus `json:"status,omitempty"` } diff --git a/arm/sql/recommendedelasticpools.go b/arm/sql/recommendedelasticpools.go old mode 100644 new mode 100755 index 2dbe6611e769..9bcbe7839b16 --- a/arm/sql/recommendedelasticpools.go +++ b/arm/sql/recommendedelasticpools.go @@ -14,7 +14,7 @@ package sql // See the License for the specific language governing permissions and // limitations under the License. // -// Code generated by Microsoft (R) AutoRest Code Generator 0.17.0.0 +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 // Changes may cause incorrect behavior and will be lost if the code is // regenerated. @@ -25,8 +25,8 @@ import ( ) // RecommendedElasticPoolsClient is the provides create, read, update and -// delete functionality for Azure SQL resources including servers, databases, -// elastic pools, recommendations, operations, and usage metrics. +// delete functionality for Azure SQL Database resources including servers, +// databases, elastic pools, recommendations, operations, and usage metrics. type RecommendedElasticPoolsClient struct { ManagementClient } @@ -43,13 +43,12 @@ func NewRecommendedElasticPoolsClientWithBaseURI(baseURI string, subscriptionID return RecommendedElasticPoolsClient{NewWithBaseURI(baseURI, subscriptionID)} } -// Get gets information about an Azure SQL Recommended Elastic Pool. +// Get gets a recommented elastic pool. // // resourceGroupName is the name of the resource group that contains the // resource. You can obtain this value from the Azure Resource Manager API or -// the portal. serverName is the name of the Azure SQL server. -// recommendedElasticPoolName is the name of the Azure SQL Recommended -// Elastic Pool to be retrieved. +// the portal. serverName is the name of the server. recommendedElasticPoolName +// is the name of the recommended elastic pool to be retrieved. func (client RecommendedElasticPoolsClient) Get(resourceGroupName string, serverName string, recommendedElasticPoolName string) (result RecommendedElasticPool, err error) { req, err := client.GetPreparer(resourceGroupName, serverName, recommendedElasticPoolName) if err != nil { @@ -79,8 +78,9 @@ func (client RecommendedElasticPoolsClient) GetPreparer(resourceGroupName string "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2014-04-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -110,15 +110,13 @@ func (client RecommendedElasticPoolsClient) GetResponder(resp *http.Response) (r return } -// GetDatabases gets information about an Azure SQL database inside of an -// Azure SQL Recommended Elastic Pool. +// GetDatabases gets a database inside of a recommented elastic pool. // // resourceGroupName is the name of the resource group that contains the // resource. You can obtain this value from the Azure Resource Manager API or -// the portal. serverName is the name of the Azure SQL server. -// recommendedElasticPoolName is the name of the Azure SQL Elastic Pool to be -// retrieved. databaseName is the name of the Azure SQL database to be -// retrieved. +// the portal. serverName is the name of the server. recommendedElasticPoolName +// is the name of the elastic pool to be retrieved. databaseName is the name of +// the database to be retrieved. func (client RecommendedElasticPoolsClient) GetDatabases(resourceGroupName string, serverName string, recommendedElasticPoolName string, databaseName string) (result Database, err error) { req, err := client.GetDatabasesPreparer(resourceGroupName, serverName, recommendedElasticPoolName, databaseName) if err != nil { @@ -149,8 +147,9 @@ func (client RecommendedElasticPoolsClient) GetDatabasesPreparer(resourceGroupNa "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2014-04-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -180,41 +179,42 @@ func (client RecommendedElasticPoolsClient) GetDatabasesResponder(resp *http.Res return } -// List returns information about Azure SQL Recommended Elastic Pools. +// ListByServer returns recommended elastic pools. // // resourceGroupName is the name of the resource group that contains the // resource. You can obtain this value from the Azure Resource Manager API or -// the portal. serverName is the name of the Azure SQL server. -func (client RecommendedElasticPoolsClient) List(resourceGroupName string, serverName string) (result RecommendedElasticPoolListResult, err error) { - req, err := client.ListPreparer(resourceGroupName, serverName) +// the portal. serverName is the name of the server. +func (client RecommendedElasticPoolsClient) ListByServer(resourceGroupName string, serverName string) (result RecommendedElasticPoolListResult, err error) { + req, err := client.ListByServerPreparer(resourceGroupName, serverName) if err != nil { - return result, autorest.NewErrorWithError(err, "sql.RecommendedElasticPoolsClient", "List", nil, "Failure preparing request") + return result, autorest.NewErrorWithError(err, "sql.RecommendedElasticPoolsClient", "ListByServer", nil, "Failure preparing request") } - resp, err := client.ListSender(req) + resp, err := client.ListByServerSender(req) if err != nil { result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "sql.RecommendedElasticPoolsClient", "List", resp, "Failure sending request") + return result, autorest.NewErrorWithError(err, "sql.RecommendedElasticPoolsClient", "ListByServer", resp, "Failure sending request") } - result, err = client.ListResponder(resp) + result, err = client.ListByServerResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "sql.RecommendedElasticPoolsClient", "List", resp, "Failure responding to request") + err = autorest.NewErrorWithError(err, "sql.RecommendedElasticPoolsClient", "ListByServer", resp, "Failure responding to request") } return } -// ListPreparer prepares the List request. -func (client RecommendedElasticPoolsClient) ListPreparer(resourceGroupName string, serverName string) (*http.Request, error) { +// ListByServerPreparer prepares the ListByServer request. +func (client RecommendedElasticPoolsClient) ListByServerPreparer(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": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -225,15 +225,15 @@ func (client RecommendedElasticPoolsClient) ListPreparer(resourceGroupName strin return preparer.Prepare(&http.Request{}) } -// ListSender sends the List request. The method will close the +// ListByServerSender sends the ListByServer request. The method will close the // http.Response Body if it receives an error. -func (client RecommendedElasticPoolsClient) ListSender(req *http.Request) (*http.Response, error) { +func (client RecommendedElasticPoolsClient) ListByServerSender(req *http.Request) (*http.Response, error) { return autorest.SendWithSender(client, req) } -// ListResponder handles the response to the List request. The method always +// ListByServerResponder handles the response to the ListByServer request. The method always // closes the http.Response Body. -func (client RecommendedElasticPoolsClient) ListResponder(resp *http.Response) (result RecommendedElasticPoolListResult, err error) { +func (client RecommendedElasticPoolsClient) ListByServerResponder(resp *http.Response) (result RecommendedElasticPoolListResult, err error) { err = autorest.Respond( resp, client.ByInspecting(), @@ -244,14 +244,12 @@ func (client RecommendedElasticPoolsClient) ListResponder(resp *http.Response) ( return } -// ListDatabases returns information about an Azure SQL database inside of an -// Azure SQL Recommended Elastic Pool. +// ListDatabases returns a list of databases inside a recommented elastic pool. // // resourceGroupName is the name of the resource group that contains the // resource. You can obtain this value from the Azure Resource Manager API or -// the portal. serverName is the name of the Azure SQL server. -// recommendedElasticPoolName is the name of the Azure SQL Recommended -// Elastic Pool to be retrieved. +// the portal. serverName is the name of the server. recommendedElasticPoolName +// is the name of the recommended elastic pool to be retrieved. func (client RecommendedElasticPoolsClient) ListDatabases(resourceGroupName string, serverName string, recommendedElasticPoolName string) (result DatabaseListResult, err error) { req, err := client.ListDatabasesPreparer(resourceGroupName, serverName, recommendedElasticPoolName) if err != nil { @@ -281,8 +279,9 @@ func (client RecommendedElasticPoolsClient) ListDatabasesPreparer(resourceGroupN "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2014-04-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -312,13 +311,12 @@ func (client RecommendedElasticPoolsClient) ListDatabasesResponder(resp *http.Re return } -// ListMetrics returns information about an recommended elastic pool metrics. +// ListMetrics returns a recommented elastic pool metrics. // // resourceGroupName is the name of the resource group that contains the // resource. You can obtain this value from the Azure Resource Manager API or -// the portal. serverName is the name of the Azure SQL server. -// recommendedElasticPoolName is the name of the Azure SQL Recommended -// Elastic Pool to be retrieved. +// the portal. serverName is the name of the server. recommendedElasticPoolName +// is the name of the recommended elastic pool to be retrieved. func (client RecommendedElasticPoolsClient) ListMetrics(resourceGroupName string, serverName string, recommendedElasticPoolName string) (result RecommendedElasticPoolListMetricsResult, err error) { req, err := client.ListMetricsPreparer(resourceGroupName, serverName, recommendedElasticPoolName) if err != nil { @@ -348,8 +346,9 @@ func (client RecommendedElasticPoolsClient) ListMetricsPreparer(resourceGroupNam "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2014-04-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( diff --git a/arm/sql/servers.go b/arm/sql/servers.go old mode 100644 new mode 100755 index 11e4a35e4faf..a969fa1e3746 --- a/arm/sql/servers.go +++ b/arm/sql/servers.go @@ -14,7 +14,7 @@ package sql // See the License for the specific language governing permissions and // limitations under the License. // -// Code generated by Microsoft (R) AutoRest Code Generator 0.17.0.0 +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 // Changes may cause incorrect behavior and will be lost if the code is // regenerated. @@ -25,8 +25,8 @@ import ( ) // ServersClient is the provides create, read, update and delete functionality -// for Azure SQL resources including servers, databases, elastic pools, -// recommendations, operations, and usage metrics. +// for Azure SQL Database resources including servers, databases, elastic +// pools, recommendations, operations, and usage metrics. type ServersClient struct { ManagementClient } @@ -41,12 +41,12 @@ func NewServersClientWithBaseURI(baseURI string, subscriptionID string) ServersC return ServersClient{NewWithBaseURI(baseURI, subscriptionID)} } -// CreateOrUpdate creates a new Azure SQL server. +// CreateOrUpdate creates or updates a new server. // // resourceGroupName is the name of the resource group that contains the // resource. You can obtain this value from the Azure Resource Manager API or -// the portal. serverName is the name of the Azure SQL server. parameters is -// the required parameters for creating or updating a server. +// the portal. serverName is the name of the server. parameters is the required +// parameters for creating or updating a server. func (client ServersClient) CreateOrUpdate(resourceGroupName string, serverName string, parameters Server) (result Server, err error) { req, err := client.CreateOrUpdatePreparer(resourceGroupName, serverName, parameters) if err != nil { @@ -75,8 +75,9 @@ func (client ServersClient) CreateOrUpdatePreparer(resourceGroupName string, ser "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2014-04-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -112,7 +113,7 @@ func (client ServersClient) CreateOrUpdateResponder(resp *http.Response) (result // // resourceGroupName is the name of the resource group that contains the // resource. You can obtain this value from the Azure Resource Manager API or -// the portal. serverName is the name of the Azure SQL server. +// the portal. serverName is the name of the server. func (client ServersClient) Delete(resourceGroupName string, serverName string) (result autorest.Response, err error) { req, err := client.DeletePreparer(resourceGroupName, serverName) if err != nil { @@ -141,8 +142,9 @@ func (client ServersClient) DeletePreparer(resourceGroupName string, serverName "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2014-04-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -171,41 +173,42 @@ func (client ServersClient) DeleteResponder(resp *http.Response) (result autores return } -// GetByResourceGroup gets information about an Azure SQL server. +// Get gets a server. // // resourceGroupName is the name of the resource group that contains the // resource. You can obtain this value from the Azure Resource Manager API or -// the portal. serverName is the name of the Azure SQL server. -func (client ServersClient) GetByResourceGroup(resourceGroupName string, serverName string) (result Server, err error) { - req, err := client.GetByResourceGroupPreparer(resourceGroupName, serverName) +// the portal. serverName is the name of the server. +func (client ServersClient) Get(resourceGroupName string, serverName string) (result Server, err error) { + req, err := client.GetPreparer(resourceGroupName, serverName) if err != nil { - return result, autorest.NewErrorWithError(err, "sql.ServersClient", "GetByResourceGroup", nil, "Failure preparing request") + return result, autorest.NewErrorWithError(err, "sql.ServersClient", "Get", nil, "Failure preparing request") } - resp, err := client.GetByResourceGroupSender(req) + resp, err := client.GetSender(req) if err != nil { result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "sql.ServersClient", "GetByResourceGroup", resp, "Failure sending request") + return result, autorest.NewErrorWithError(err, "sql.ServersClient", "Get", resp, "Failure sending request") } - result, err = client.GetByResourceGroupResponder(resp) + result, err = client.GetResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServersClient", "GetByResourceGroup", resp, "Failure responding to request") + err = autorest.NewErrorWithError(err, "sql.ServersClient", "Get", resp, "Failure responding to request") } return } -// GetByResourceGroupPreparer prepares the GetByResourceGroup request. -func (client ServersClient) GetByResourceGroupPreparer(resourceGroupName string, serverName string) (*http.Request, error) { +// GetPreparer prepares the Get request. +func (client ServersClient) GetPreparer(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": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -216,15 +219,15 @@ func (client ServersClient) GetByResourceGroupPreparer(resourceGroupName string, return preparer.Prepare(&http.Request{}) } -// GetByResourceGroupSender sends the GetByResourceGroup request. The method will close the +// GetSender sends the Get request. The method will close the // http.Response Body if it receives an error. -func (client ServersClient) GetByResourceGroupSender(req *http.Request) (*http.Response, error) { +func (client ServersClient) GetSender(req *http.Request) (*http.Response, error) { return autorest.SendWithSender(client, req) } -// GetByResourceGroupResponder handles the response to the GetByResourceGroup request. The method always +// GetResponder handles the response to the Get request. The method always // closes the http.Response Body. -func (client ServersClient) GetByResourceGroupResponder(resp *http.Response) (result Server, err error) { +func (client ServersClient) GetResponder(resp *http.Response) (result Server, err error) { err = autorest.Respond( resp, client.ByInspecting(), @@ -235,13 +238,12 @@ func (client ServersClient) GetByResourceGroupResponder(resp *http.Response) (re return } -// GetServiceObjective gets information about an Azure SQL database Service -// Objective. +// GetServiceObjective gets a database service objective. // // resourceGroupName is the name of the resource group that contains the // resource. You can obtain this value from the Azure Resource Manager API or -// the portal. serverName is the name of the Azure SQL server. -// serviceObjectiveName is the name of the service objective to retrieve. +// the portal. serverName is the name of the server. serviceObjectiveName is +// the name of the service objective to retrieve. func (client ServersClient) GetServiceObjective(resourceGroupName string, serverName string, serviceObjectiveName string) (result ServiceObjective, err error) { req, err := client.GetServiceObjectivePreparer(resourceGroupName, serverName, serviceObjectiveName) if err != nil { @@ -271,8 +273,9 @@ func (client ServersClient) GetServiceObjectivePreparer(resourceGroupName string "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2014-04-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -302,7 +305,7 @@ func (client ServersClient) GetServiceObjectiveResponder(resp *http.Response) (r return } -// List returns information about an Azure SQL server. +// List returns a list of servers. func (client ServersClient) List() (result ServerListResult, err error) { req, err := client.ListPreparer() if err != nil { @@ -329,8 +332,9 @@ func (client ServersClient) ListPreparer() (*http.Request, error) { "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2014-04-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -360,7 +364,7 @@ func (client ServersClient) ListResponder(resp *http.Response) (result ServerLis return } -// ListByResourceGroup returns information about an Azure SQL server. +// ListByResourceGroup returns a list of servers in a resource group. // // resourceGroupName is the name of the resource group that contains the // resource. You can obtain this value from the Azure Resource Manager API or @@ -392,8 +396,9 @@ func (client ServersClient) ListByResourceGroupPreparer(resourceGroupName string "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2014-04-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -423,12 +428,11 @@ func (client ServersClient) ListByResourceGroupResponder(resp *http.Response) (r return } -// ListServiceObjectives returns information about Azure SQL database Service -// Objectives. +// ListServiceObjectives returns database service objectives. // // resourceGroupName is the name of the resource group that contains the // resource. You can obtain this value from the Azure Resource Manager API or -// the portal. serverName is the name of the Azure SQL server. +// the portal. serverName is the name of the server. func (client ServersClient) ListServiceObjectives(resourceGroupName string, serverName string) (result ServiceObjectiveListResult, err error) { req, err := client.ListServiceObjectivesPreparer(resourceGroupName, serverName) if err != nil { @@ -457,8 +461,9 @@ func (client ServersClient) ListServiceObjectivesPreparer(resourceGroupName stri "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2014-04-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -488,11 +493,11 @@ func (client ServersClient) ListServiceObjectivesResponder(resp *http.Response) return } -// ListUsages returns information about Azure SQL server usage. +// ListUsages returns server usages. // // resourceGroupName is the name of the resource group that contains the // resource. You can obtain this value from the Azure Resource Manager API or -// the portal. serverName is the name of the Azure SQL server. +// the portal. serverName is the name of the server. func (client ServersClient) ListUsages(resourceGroupName string, serverName string) (result ServerMetricListResult, err error) { req, err := client.ListUsagesPreparer(resourceGroupName, serverName) if err != nil { @@ -521,8 +526,9 @@ func (client ServersClient) ListUsagesPreparer(resourceGroupName string, serverN "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2014-04-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( diff --git a/arm/sql/version.go b/arm/sql/version.go old mode 100644 new mode 100755 index 2fabb4531291..6c65768faa45 --- a/arm/sql/version.go +++ b/arm/sql/version.go @@ -18,43 +18,12 @@ package sql // Changes may cause incorrect behavior and will be lost if the code is // regenerated. -import ( - "bytes" - "fmt" - "strings" -) - -const ( - major = "8" - minor = "1" - patch = "0" - tag = "beta" - userAgentFormat = "Azure-SDK-For-Go/%s arm-%s/%s" -) - -// cached results of UserAgent and Version to prevent repeated operations. -var ( - userAgent string - version string -) - // UserAgent returns the UserAgent string to use when sending http.Requests. func UserAgent() string { - if userAgent == "" { - userAgent = fmt.Sprintf(userAgentFormat, Version(), "sql", "2014-04-01") - } - return userAgent + return "Azure-SDK-For-Go/v9.0.0-beta arm-sql/2014-04-01" } // Version returns the semantic version (see http://semver.org) of the client. func Version() string { - if version == "" { - versionBuilder := bytes.NewBufferString(fmt.Sprintf("%s.%s.%s", major, minor, patch)) - if tag != "" { - versionBuilder.WriteRune('-') - versionBuilder.WriteString(strings.TrimPrefix(tag, "-")) - } - version = string(versionBuilder.Bytes()) - } - return version + return "v9.0.0-beta" } diff --git a/arm/trafficmanager/client.go b/arm/trafficmanager/client.go old mode 100644 new mode 100755 index 6e481cbf0f59..332f0addca97 --- a/arm/trafficmanager/client.go +++ b/arm/trafficmanager/client.go @@ -27,9 +27,6 @@ import ( ) const ( - // APIVersion is the version of the Trafficmanager - APIVersion = "2015-11-01" - // DefaultBaseURI is the default URI used for the service Trafficmanager DefaultBaseURI = "https://management.azure.com" ) @@ -38,7 +35,6 @@ const ( type ManagementClient struct { autorest.Client BaseURI string - APIVersion string SubscriptionID string } @@ -52,7 +48,6 @@ func NewWithBaseURI(baseURI string, subscriptionID string) ManagementClient { return ManagementClient{ Client: autorest.NewClientWithUserAgent(UserAgent()), BaseURI: baseURI, - APIVersion: APIVersion, SubscriptionID: subscriptionID, } } diff --git a/arm/trafficmanager/endpoints.go b/arm/trafficmanager/endpoints.go old mode 100644 new mode 100755 index 6a496e85c5ff..1cd7958db3e1 --- a/arm/trafficmanager/endpoints.go +++ b/arm/trafficmanager/endpoints.go @@ -79,8 +79,9 @@ func (client EndpointsClient) CreateOrUpdatePreparer(resourceGroupName string, p "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2015-11-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -149,8 +150,9 @@ func (client EndpointsClient) DeletePreparer(resourceGroupName string, profileNa "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2015-11-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -215,8 +217,9 @@ func (client EndpointsClient) GetPreparer(resourceGroupName string, profileName "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2015-11-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -284,8 +287,9 @@ func (client EndpointsClient) UpdatePreparer(resourceGroupName string, profileNa "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2015-11-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( diff --git a/arm/trafficmanager/models.go b/arm/trafficmanager/models.go old mode 100644 new mode 100755 diff --git a/arm/trafficmanager/profiles.go b/arm/trafficmanager/profiles.go old mode 100644 new mode 100755 index 8550c9369374..81bc736079aa --- a/arm/trafficmanager/profiles.go +++ b/arm/trafficmanager/profiles.go @@ -72,8 +72,9 @@ func (client ProfilesClient) CheckTrafficManagerRelativeDNSNameAvailabilityPrepa "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2015-11-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -139,8 +140,9 @@ func (client ProfilesClient) CreateOrUpdatePreparer(resourceGroupName string, pr "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2015-11-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -205,8 +207,9 @@ func (client ProfilesClient) DeletePreparer(resourceGroupName string, profileNam "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2015-11-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -267,8 +270,9 @@ func (client ProfilesClient) GetPreparer(resourceGroupName string, profileName s "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2015-11-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -325,8 +329,9 @@ func (client ProfilesClient) ListAllPreparer() (*http.Request, error) { "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2015-11-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -388,8 +393,9 @@ func (client ProfilesClient) ListAllInResourceGroupPreparer(resourceGroupName st "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2015-11-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -453,8 +459,9 @@ func (client ProfilesClient) UpdatePreparer(resourceGroupName string, profileNam "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2015-11-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( diff --git a/arm/trafficmanager/version.go b/arm/trafficmanager/version.go old mode 100644 new mode 100755 index 5987777ce9c0..228a745d1fdc --- a/arm/trafficmanager/version.go +++ b/arm/trafficmanager/version.go @@ -18,43 +18,12 @@ package trafficmanager // Changes may cause incorrect behavior and will be lost if the code is // regenerated. -import ( - "bytes" - "fmt" - "strings" -) - -const ( - major = "8" - minor = "1" - patch = "0" - tag = "beta" - userAgentFormat = "Azure-SDK-For-Go/%s arm-%s/%s" -) - -// cached results of UserAgent and Version to prevent repeated operations. -var ( - userAgent string - version string -) - // UserAgent returns the UserAgent string to use when sending http.Requests. func UserAgent() string { - if userAgent == "" { - userAgent = fmt.Sprintf(userAgentFormat, Version(), "trafficmanager", "2015-11-01") - } - return userAgent + return "Azure-SDK-For-Go/v9.0.0-beta arm-trafficmanager/2015-11-01" } // Version returns the semantic version (see http://semver.org) of the client. func Version() string { - if version == "" { - versionBuilder := bytes.NewBufferString(fmt.Sprintf("%s.%s.%s", major, minor, patch)) - if tag != "" { - versionBuilder.WriteRune('-') - versionBuilder.WriteString(strings.TrimPrefix(tag, "-")) - } - version = string(versionBuilder.Bytes()) - } - return version + return "v9.0.0-beta" } diff --git a/arm/web/apps.go b/arm/web/apps.go new file mode 100755 index 000000000000..9c19108a807c --- /dev/null +++ b/arm/web/apps.go @@ -0,0 +1,16489 @@ +package web + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// 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/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// AppsClient is the composite Swagger for WebSite Management Client +type AppsClient struct { + ManagementClient +} + +// NewAppsClient creates an instance of the AppsClient client. +func NewAppsClient(subscriptionID string) AppsClient { + return NewAppsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewAppsClientWithBaseURI creates an instance of the AppsClient client. +func NewAppsClientWithBaseURI(baseURI string, subscriptionID string) AppsClient { + return AppsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// AddPremierAddOn updates a named add-on of an app. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. premierAddOnName is add-on name. +// premierAddOn is a JSON representation of the edited premier add-on. +func (client AppsClient) AddPremierAddOn(resourceGroupName string, name string, premierAddOnName string, premierAddOn PremierAddOn) (result PremierAddOn, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "AddPremierAddOn") + } + + req, err := client.AddPremierAddOnPreparer(resourceGroupName, name, premierAddOnName, premierAddOn) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "AddPremierAddOn", nil, "Failure preparing request") + } + + resp, err := client.AddPremierAddOnSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "AddPremierAddOn", resp, "Failure sending request") + } + + result, err = client.AddPremierAddOnResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "AddPremierAddOn", resp, "Failure responding to request") + } + + return +} + +// AddPremierAddOnPreparer prepares the AddPremierAddOn request. +func (client AppsClient) AddPremierAddOnPreparer(resourceGroupName string, name string, premierAddOnName string, premierAddOn PremierAddOn) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "premierAddOnName": autorest.Encode("path", premierAddOnName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/premieraddons/{premierAddOnName}", pathParameters), + autorest.WithJSON(premierAddOn), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// AddPremierAddOnSender sends the AddPremierAddOn request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) AddPremierAddOnSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// AddPremierAddOnResponder handles the response to the AddPremierAddOn request. The method always +// closes the http.Response Body. +func (client AppsClient) AddPremierAddOnResponder(resp *http.Response) (result PremierAddOn, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// AddPremierAddOnSlot updates a named add-on of an app. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. premierAddOnName is add-on name. +// premierAddOn is a JSON representation of the edited premier add-on. slot is +// name of the deployment slot. If a slot is not specified, the API will update +// the named add-on for the production slot. +func (client AppsClient) AddPremierAddOnSlot(resourceGroupName string, name string, premierAddOnName string, premierAddOn PremierAddOn, slot string) (result PremierAddOn, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "AddPremierAddOnSlot") + } + + req, err := client.AddPremierAddOnSlotPreparer(resourceGroupName, name, premierAddOnName, premierAddOn, slot) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "AddPremierAddOnSlot", nil, "Failure preparing request") + } + + resp, err := client.AddPremierAddOnSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "AddPremierAddOnSlot", resp, "Failure sending request") + } + + result, err = client.AddPremierAddOnSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "AddPremierAddOnSlot", resp, "Failure responding to request") + } + + return +} + +// AddPremierAddOnSlotPreparer prepares the AddPremierAddOnSlot request. +func (client AppsClient) AddPremierAddOnSlotPreparer(resourceGroupName string, name string, premierAddOnName string, premierAddOn PremierAddOn, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "premierAddOnName": autorest.Encode("path", premierAddOnName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/premieraddons/{premierAddOnName}", pathParameters), + autorest.WithJSON(premierAddOn), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// AddPremierAddOnSlotSender sends the AddPremierAddOnSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) AddPremierAddOnSlotSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// AddPremierAddOnSlotResponder handles the response to the AddPremierAddOnSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) AddPremierAddOnSlotResponder(resp *http.Response) (result PremierAddOn, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// AnalyzeCustomHostname analyze a custom hostname. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of web app hostName is custom hostname +func (client AppsClient) AnalyzeCustomHostname(resourceGroupName string, name string, hostName string) (result CustomHostnameAnalysisResult, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "AnalyzeCustomHostname") + } + + req, err := client.AnalyzeCustomHostnamePreparer(resourceGroupName, name, hostName) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "AnalyzeCustomHostname", nil, "Failure preparing request") + } + + resp, err := client.AnalyzeCustomHostnameSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "AnalyzeCustomHostname", resp, "Failure sending request") + } + + result, err = client.AnalyzeCustomHostnameResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "AnalyzeCustomHostname", resp, "Failure responding to request") + } + + return +} + +// AnalyzeCustomHostnamePreparer prepares the AnalyzeCustomHostname request. +func (client AppsClient) AnalyzeCustomHostnamePreparer(resourceGroupName string, name string, hostName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(hostName) > 0 { + queryParameters["hostName"] = autorest.Encode("query", hostName) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/analyzeCustomHostname", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// AnalyzeCustomHostnameSender sends the AnalyzeCustomHostname request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) AnalyzeCustomHostnameSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// AnalyzeCustomHostnameResponder handles the response to the AnalyzeCustomHostname request. The method always +// closes the http.Response Body. +func (client AppsClient) AnalyzeCustomHostnameResponder(resp *http.Response) (result CustomHostnameAnalysisResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// AnalyzeCustomHostnameSlot analyze a custom hostname. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of web app slot is name of web app slot. If not +// specified then will default to production slot. hostName is custom hostname +func (client AppsClient) AnalyzeCustomHostnameSlot(resourceGroupName string, name string, slot string, hostName string) (result CustomHostnameAnalysisResult, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "AnalyzeCustomHostnameSlot") + } + + req, err := client.AnalyzeCustomHostnameSlotPreparer(resourceGroupName, name, slot, hostName) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "AnalyzeCustomHostnameSlot", nil, "Failure preparing request") + } + + resp, err := client.AnalyzeCustomHostnameSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "AnalyzeCustomHostnameSlot", resp, "Failure sending request") + } + + result, err = client.AnalyzeCustomHostnameSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "AnalyzeCustomHostnameSlot", resp, "Failure responding to request") + } + + return +} + +// AnalyzeCustomHostnameSlotPreparer prepares the AnalyzeCustomHostnameSlot request. +func (client AppsClient) AnalyzeCustomHostnameSlotPreparer(resourceGroupName string, name string, slot string, hostName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(hostName) > 0 { + queryParameters["hostName"] = autorest.Encode("query", hostName) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/analyzeCustomHostname", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// AnalyzeCustomHostnameSlotSender sends the AnalyzeCustomHostnameSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) AnalyzeCustomHostnameSlotSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// AnalyzeCustomHostnameSlotResponder handles the response to the AnalyzeCustomHostnameSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) AnalyzeCustomHostnameSlotResponder(resp *http.Response) (result CustomHostnameAnalysisResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ApplySlotConfigToProduction applies the configuration settings from the +// target slot onto the current slot. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. slotSwapEntity is jSON object that +// contains the target slot name. See example. +func (client AppsClient) ApplySlotConfigToProduction(resourceGroupName string, name string, slotSwapEntity CsmSlotEntity) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}, + {TargetValue: slotSwapEntity, + Constraints: []validation.Constraint{{Target: "slotSwapEntity.TargetSlot", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "slotSwapEntity.PreserveVnet", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "ApplySlotConfigToProduction") + } + + req, err := client.ApplySlotConfigToProductionPreparer(resourceGroupName, name, slotSwapEntity) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ApplySlotConfigToProduction", nil, "Failure preparing request") + } + + resp, err := client.ApplySlotConfigToProductionSender(req) + if err != nil { + result.Response = resp + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ApplySlotConfigToProduction", resp, "Failure sending request") + } + + result, err = client.ApplySlotConfigToProductionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ApplySlotConfigToProduction", resp, "Failure responding to request") + } + + return +} + +// ApplySlotConfigToProductionPreparer prepares the ApplySlotConfigToProduction request. +func (client AppsClient) ApplySlotConfigToProductionPreparer(resourceGroupName string, name string, slotSwapEntity CsmSlotEntity) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/applySlotConfig", pathParameters), + autorest.WithJSON(slotSwapEntity), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ApplySlotConfigToProductionSender sends the ApplySlotConfigToProduction request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ApplySlotConfigToProductionSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ApplySlotConfigToProductionResponder handles the response to the ApplySlotConfigToProduction request. The method always +// closes the http.Response Body. +func (client AppsClient) ApplySlotConfigToProductionResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// ApplySlotConfigurationSlot applies the configuration settings from the +// target slot onto the current slot. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. slotSwapEntity is jSON object that +// contains the target slot name. See example. slot is name of the source slot. +// If a slot is not specified, the production slot is used as the source slot. +func (client AppsClient) ApplySlotConfigurationSlot(resourceGroupName string, name string, slotSwapEntity CsmSlotEntity, slot string) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}, + {TargetValue: slotSwapEntity, + Constraints: []validation.Constraint{{Target: "slotSwapEntity.TargetSlot", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "slotSwapEntity.PreserveVnet", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "ApplySlotConfigurationSlot") + } + + req, err := client.ApplySlotConfigurationSlotPreparer(resourceGroupName, name, slotSwapEntity, slot) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ApplySlotConfigurationSlot", nil, "Failure preparing request") + } + + resp, err := client.ApplySlotConfigurationSlotSender(req) + if err != nil { + result.Response = resp + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ApplySlotConfigurationSlot", resp, "Failure sending request") + } + + result, err = client.ApplySlotConfigurationSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ApplySlotConfigurationSlot", resp, "Failure responding to request") + } + + return +} + +// ApplySlotConfigurationSlotPreparer prepares the ApplySlotConfigurationSlot request. +func (client AppsClient) ApplySlotConfigurationSlotPreparer(resourceGroupName string, name string, slotSwapEntity CsmSlotEntity, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/applySlotConfig", pathParameters), + autorest.WithJSON(slotSwapEntity), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ApplySlotConfigurationSlotSender sends the ApplySlotConfigurationSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ApplySlotConfigurationSlotSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ApplySlotConfigurationSlotResponder handles the response to the ApplySlotConfigurationSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) ApplySlotConfigurationSlotResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Backup creates a backup of an app. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. request is backup configuration. You can +// use the JSON response from the POST action as input here. +func (client AppsClient) Backup(resourceGroupName string, name string, request BackupRequest) (result BackupItem, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}, + {TargetValue: request, + Constraints: []validation.Constraint{{Target: "request.BackupRequestProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "request.BackupRequestProperties.BackupSchedule", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "request.BackupRequestProperties.BackupSchedule.FrequencyInterval", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "request.BackupRequestProperties.BackupSchedule.KeepAtLeastOneBackup", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "request.BackupRequestProperties.BackupSchedule.RetentionPeriodInDays", Name: validation.Null, Rule: true, Chain: nil}, + }}, + }}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "Backup") + } + + req, err := client.BackupPreparer(resourceGroupName, name, request) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "Backup", nil, "Failure preparing request") + } + + resp, err := client.BackupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "Backup", resp, "Failure sending request") + } + + result, err = client.BackupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "Backup", resp, "Failure responding to request") + } + + return +} + +// BackupPreparer prepares the Backup request. +func (client AppsClient) BackupPreparer(resourceGroupName string, name string, request BackupRequest) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/backup", pathParameters), + autorest.WithJSON(request), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// BackupSender sends the Backup request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) BackupSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// BackupResponder handles the response to the Backup request. The method always +// closes the http.Response Body. +func (client AppsClient) BackupResponder(resp *http.Response) (result BackupItem, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// BackupSlot creates a backup of an app. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. request is backup configuration. You can +// use the JSON response from the POST action as input here. slot is name of +// the deployment slot. If a slot is not specified, the API will create a +// backup for the production slot. +func (client AppsClient) BackupSlot(resourceGroupName string, name string, request BackupRequest, slot string) (result BackupItem, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}, + {TargetValue: request, + Constraints: []validation.Constraint{{Target: "request.BackupRequestProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "request.BackupRequestProperties.BackupSchedule", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "request.BackupRequestProperties.BackupSchedule.FrequencyInterval", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "request.BackupRequestProperties.BackupSchedule.KeepAtLeastOneBackup", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "request.BackupRequestProperties.BackupSchedule.RetentionPeriodInDays", Name: validation.Null, Rule: true, Chain: nil}, + }}, + }}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "BackupSlot") + } + + req, err := client.BackupSlotPreparer(resourceGroupName, name, request, slot) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "BackupSlot", nil, "Failure preparing request") + } + + resp, err := client.BackupSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "BackupSlot", resp, "Failure sending request") + } + + result, err = client.BackupSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "BackupSlot", resp, "Failure responding to request") + } + + return +} + +// BackupSlotPreparer prepares the BackupSlot request. +func (client AppsClient) BackupSlotPreparer(resourceGroupName string, name string, request BackupRequest, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/backup", pathParameters), + autorest.WithJSON(request), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// BackupSlotSender sends the BackupSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) BackupSlotSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// BackupSlotResponder handles the response to the BackupSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) BackupSlotResponder(resp *http.Response) (result BackupItem, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// CreateDeployment create a deployment for an app, a specific deployment slot, +// and/or a specific scaled-out instance. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. id is iD of an existing deployment. +// deployment is deployment details. +func (client AppsClient) CreateDeployment(resourceGroupName string, name string, id string, deployment Deployment) (result Deployment, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "CreateDeployment") + } + + req, err := client.CreateDeploymentPreparer(resourceGroupName, name, id, deployment) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "CreateDeployment", nil, "Failure preparing request") + } + + resp, err := client.CreateDeploymentSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "CreateDeployment", resp, "Failure sending request") + } + + result, err = client.CreateDeploymentResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateDeployment", resp, "Failure responding to request") + } + + return +} + +// CreateDeploymentPreparer prepares the CreateDeployment request. +func (client AppsClient) CreateDeploymentPreparer(resourceGroupName string, name string, id string, deployment Deployment) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "id": autorest.Encode("path", id), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/deployments/{id}", pathParameters), + autorest.WithJSON(deployment), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CreateDeploymentSender sends the CreateDeployment request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) CreateDeploymentSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateDeploymentResponder handles the response to the CreateDeployment request. The method always +// closes the http.Response Body. +func (client AppsClient) CreateDeploymentResponder(resp *http.Response) (result Deployment, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// CreateDeploymentSlot create a deployment for an app, a specific deployment +// slot, and/or a specific scaled-out instance. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. id is iD of an existing deployment. slot +// is name of the deployment slot. If a slot is not specified, the API creates +// a deployment for the production slot. deployment is deployment details. +func (client AppsClient) CreateDeploymentSlot(resourceGroupName string, name string, id string, slot string, deployment Deployment) (result Deployment, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "CreateDeploymentSlot") + } + + req, err := client.CreateDeploymentSlotPreparer(resourceGroupName, name, id, slot, deployment) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "CreateDeploymentSlot", nil, "Failure preparing request") + } + + resp, err := client.CreateDeploymentSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "CreateDeploymentSlot", resp, "Failure sending request") + } + + result, err = client.CreateDeploymentSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateDeploymentSlot", resp, "Failure responding to request") + } + + return +} + +// CreateDeploymentSlotPreparer prepares the CreateDeploymentSlot request. +func (client AppsClient) CreateDeploymentSlotPreparer(resourceGroupName string, name string, id string, slot string, deployment Deployment) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "id": autorest.Encode("path", id), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/deployments/{id}", pathParameters), + autorest.WithJSON(deployment), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CreateDeploymentSlotSender sends the CreateDeploymentSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) CreateDeploymentSlotSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateDeploymentSlotResponder handles the response to the CreateDeploymentSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) CreateDeploymentSlotResponder(resp *http.Response) (result Deployment, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// CreateInstanceDeployment create a deployment for an app, a specific +// deployment slot, and/or a specific scaled-out instance. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. id is iD of an existing deployment. +// instanceID is iD of a specific scaled-out instance. This is the value of the +// name property in the JSON response from "GET api/sites/{siteName}/instances" +// deployment is deployment details. +func (client AppsClient) CreateInstanceDeployment(resourceGroupName string, name string, id string, instanceID string, deployment Deployment) (result Deployment, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "CreateInstanceDeployment") + } + + req, err := client.CreateInstanceDeploymentPreparer(resourceGroupName, name, id, instanceID, deployment) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "CreateInstanceDeployment", nil, "Failure preparing request") + } + + resp, err := client.CreateInstanceDeploymentSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "CreateInstanceDeployment", resp, "Failure sending request") + } + + result, err = client.CreateInstanceDeploymentResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateInstanceDeployment", resp, "Failure responding to request") + } + + return +} + +// CreateInstanceDeploymentPreparer prepares the CreateInstanceDeployment request. +func (client AppsClient) CreateInstanceDeploymentPreparer(resourceGroupName string, name string, id string, instanceID string, deployment Deployment) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "id": autorest.Encode("path", id), + "instanceId": autorest.Encode("path", instanceID), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/instances/{instanceId}/deployments/{id}", pathParameters), + autorest.WithJSON(deployment), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CreateInstanceDeploymentSender sends the CreateInstanceDeployment request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) CreateInstanceDeploymentSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateInstanceDeploymentResponder handles the response to the CreateInstanceDeployment request. The method always +// closes the http.Response Body. +func (client AppsClient) CreateInstanceDeploymentResponder(resp *http.Response) (result Deployment, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// CreateInstanceDeploymentSlot create a deployment for an app, a specific +// deployment slot, and/or a specific scaled-out instance. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. id is iD of an existing deployment. slot +// is name of the deployment slot. If a slot is not specified, the API creates +// a deployment for the production slot. instanceID is iD of a specific +// scaled-out instance. This is the value of the name property in the JSON +// response from "GET api/sites/{siteName}/instances" deployment is deployment +// details. +func (client AppsClient) CreateInstanceDeploymentSlot(resourceGroupName string, name string, id string, slot string, instanceID string, deployment Deployment) (result Deployment, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "CreateInstanceDeploymentSlot") + } + + req, err := client.CreateInstanceDeploymentSlotPreparer(resourceGroupName, name, id, slot, instanceID, deployment) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "CreateInstanceDeploymentSlot", nil, "Failure preparing request") + } + + resp, err := client.CreateInstanceDeploymentSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "CreateInstanceDeploymentSlot", resp, "Failure sending request") + } + + result, err = client.CreateInstanceDeploymentSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateInstanceDeploymentSlot", resp, "Failure responding to request") + } + + return +} + +// CreateInstanceDeploymentSlotPreparer prepares the CreateInstanceDeploymentSlot request. +func (client AppsClient) CreateInstanceDeploymentSlotPreparer(resourceGroupName string, name string, id string, slot string, instanceID string, deployment Deployment) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "id": autorest.Encode("path", id), + "instanceId": autorest.Encode("path", instanceID), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/instances/{instanceId}/deployments/{id}", pathParameters), + autorest.WithJSON(deployment), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CreateInstanceDeploymentSlotSender sends the CreateInstanceDeploymentSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) CreateInstanceDeploymentSlotSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateInstanceDeploymentSlotResponder handles the response to the CreateInstanceDeploymentSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) CreateInstanceDeploymentSlotResponder(resp *http.Response) (result Deployment, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// CreateOrUpdate creates a new web, mobile, or API app in an existing resource +// group, or updates an existing app. This method may poll for completion. +// Polling can be canceled by passing the cancel channel argument. The channel +// will be used to cancel polling and any outstanding HTTP requests. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is unique name of the app to create or update. To create or +// update a deployment slot, use the {slot} parameter. siteEnvelope is a JSON +// representation of the app properties. See example. skipDNSRegistration is if +// true web app hostname is not registered with DNS on creation. This parameter +// is +// only used for app creation skipCustomDomainVerification is if true, custom +// (non *.azurewebsites.net) domains associated with web app are not verified. +// forceDNSRegistration is if true, web app hostname is force registered with +// DNS ttlInSeconds is time to live in seconds for web app's default domain +// name +func (client AppsClient) CreateOrUpdate(resourceGroupName string, name string, siteEnvelope Site, skipDNSRegistration *bool, skipCustomDomainVerification *bool, forceDNSRegistration *bool, ttlInSeconds string, cancel <-chan struct{}) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}, + {TargetValue: siteEnvelope, + Constraints: []validation.Constraint{{Target: "siteEnvelope.SiteProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "siteEnvelope.SiteProperties.SiteConfig", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "siteEnvelope.SiteProperties.SiteConfig.Push", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "siteEnvelope.SiteProperties.SiteConfig.Push.IsPushEnabled", Name: validation.Null, Rule: true, Chain: nil}}}, + }}, + {Target: "siteEnvelope.SiteProperties.CloningInfo", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "siteEnvelope.SiteProperties.CloningInfo.SourceWebAppID", Name: validation.Null, Rule: true, Chain: nil}}}, + }}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "CreateOrUpdate") + } + + req, err := client.CreateOrUpdatePreparer(resourceGroupName, name, siteEnvelope, skipDNSRegistration, skipCustomDomainVerification, forceDNSRegistration, ttlInSeconds, cancel) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdate", nil, "Failure preparing request") + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = resp + return result, autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdate", resp, "Failure sending request") + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdate", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client AppsClient) CreateOrUpdatePreparer(resourceGroupName string, name string, siteEnvelope Site, skipDNSRegistration *bool, skipCustomDomainVerification *bool, forceDNSRegistration *bool, ttlInSeconds string, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if skipDNSRegistration != nil { + queryParameters["skipDnsRegistration"] = autorest.Encode("query", *skipDNSRegistration) + } + if skipCustomDomainVerification != nil { + queryParameters["skipCustomDomainVerification"] = autorest.Encode("query", *skipCustomDomainVerification) + } + if forceDNSRegistration != nil { + queryParameters["forceDnsRegistration"] = autorest.Encode("query", *forceDNSRegistration) + } + if len(ttlInSeconds) > 0 { + queryParameters["ttlInSeconds"] = autorest.Encode("query", ttlInSeconds) + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}", pathParameters), + autorest.WithJSON(siteEnvelope), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client AppsClient) CreateOrUpdateResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// CreateOrUpdateConfiguration updates the configuration of an app. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. siteConfig is jSON representation of a +// SiteConfig object. See example. +func (client AppsClient) CreateOrUpdateConfiguration(resourceGroupName string, name string, siteConfig SiteConfigResource) (result SiteConfigResource, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}, + {TargetValue: siteConfig, + Constraints: []validation.Constraint{{Target: "siteConfig.SiteConfig", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "siteConfig.SiteConfig.Push", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "siteConfig.SiteConfig.Push.IsPushEnabled", Name: validation.Null, Rule: true, Chain: nil}}}, + }}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "CreateOrUpdateConfiguration") + } + + req, err := client.CreateOrUpdateConfigurationPreparer(resourceGroupName, name, siteConfig) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdateConfiguration", nil, "Failure preparing request") + } + + resp, err := client.CreateOrUpdateConfigurationSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdateConfiguration", resp, "Failure sending request") + } + + result, err = client.CreateOrUpdateConfigurationResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdateConfiguration", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdateConfigurationPreparer prepares the CreateOrUpdateConfiguration request. +func (client AppsClient) CreateOrUpdateConfigurationPreparer(resourceGroupName string, name string, siteConfig SiteConfigResource) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/web", pathParameters), + autorest.WithJSON(siteConfig), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CreateOrUpdateConfigurationSender sends the CreateOrUpdateConfiguration request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) CreateOrUpdateConfigurationSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateOrUpdateConfigurationResponder handles the response to the CreateOrUpdateConfiguration request. The method always +// closes the http.Response Body. +func (client AppsClient) CreateOrUpdateConfigurationResponder(resp *http.Response) (result SiteConfigResource, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// CreateOrUpdateConfigurationSlot updates the configuration of an app. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. siteConfig is jSON representation of a +// SiteConfig object. See example. slot is name of the deployment slot. If a +// slot is not specified, the API will update configuration for the production +// slot. +func (client AppsClient) CreateOrUpdateConfigurationSlot(resourceGroupName string, name string, siteConfig SiteConfigResource, slot string) (result SiteConfigResource, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}, + {TargetValue: siteConfig, + Constraints: []validation.Constraint{{Target: "siteConfig.SiteConfig", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "siteConfig.SiteConfig.Push", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "siteConfig.SiteConfig.Push.IsPushEnabled", Name: validation.Null, Rule: true, Chain: nil}}}, + }}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "CreateOrUpdateConfigurationSlot") + } + + req, err := client.CreateOrUpdateConfigurationSlotPreparer(resourceGroupName, name, siteConfig, slot) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdateConfigurationSlot", nil, "Failure preparing request") + } + + resp, err := client.CreateOrUpdateConfigurationSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdateConfigurationSlot", resp, "Failure sending request") + } + + result, err = client.CreateOrUpdateConfigurationSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdateConfigurationSlot", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdateConfigurationSlotPreparer prepares the CreateOrUpdateConfigurationSlot request. +func (client AppsClient) CreateOrUpdateConfigurationSlotPreparer(resourceGroupName string, name string, siteConfig SiteConfigResource, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/web", pathParameters), + autorest.WithJSON(siteConfig), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CreateOrUpdateConfigurationSlotSender sends the CreateOrUpdateConfigurationSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) CreateOrUpdateConfigurationSlotSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateOrUpdateConfigurationSlotResponder handles the response to the CreateOrUpdateConfigurationSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) CreateOrUpdateConfigurationSlotResponder(resp *http.Response) (result SiteConfigResource, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// CreateOrUpdateDomainOwnershipIdentifier creates a domain ownership +// identifier for web app, or updates an existing ownership identifier. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. domainOwnershipIdentifierName is name of +// domain ownership identifier. domainOwnershipIdentifier is a JSON +// representation of the domain ownership properties. +func (client AppsClient) CreateOrUpdateDomainOwnershipIdentifier(resourceGroupName string, name string, domainOwnershipIdentifierName string, domainOwnershipIdentifier Identifier) (result Identifier, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "CreateOrUpdateDomainOwnershipIdentifier") + } + + req, err := client.CreateOrUpdateDomainOwnershipIdentifierPreparer(resourceGroupName, name, domainOwnershipIdentifierName, domainOwnershipIdentifier) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdateDomainOwnershipIdentifier", nil, "Failure preparing request") + } + + resp, err := client.CreateOrUpdateDomainOwnershipIdentifierSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdateDomainOwnershipIdentifier", resp, "Failure sending request") + } + + result, err = client.CreateOrUpdateDomainOwnershipIdentifierResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdateDomainOwnershipIdentifier", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdateDomainOwnershipIdentifierPreparer prepares the CreateOrUpdateDomainOwnershipIdentifier request. +func (client AppsClient) CreateOrUpdateDomainOwnershipIdentifierPreparer(resourceGroupName string, name string, domainOwnershipIdentifierName string, domainOwnershipIdentifier Identifier) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "domainOwnershipIdentifierName": autorest.Encode("path", domainOwnershipIdentifierName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/domainOwnershipIdentifiers/{domainOwnershipIdentifierName}", pathParameters), + autorest.WithJSON(domainOwnershipIdentifier), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CreateOrUpdateDomainOwnershipIdentifierSender sends the CreateOrUpdateDomainOwnershipIdentifier request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) CreateOrUpdateDomainOwnershipIdentifierSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateOrUpdateDomainOwnershipIdentifierResponder handles the response to the CreateOrUpdateDomainOwnershipIdentifier request. The method always +// closes the http.Response Body. +func (client AppsClient) CreateOrUpdateDomainOwnershipIdentifierResponder(resp *http.Response) (result Identifier, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// CreateOrUpdateDomainOwnershipIdentifierSlot creates a domain ownership +// identifier for web app, or updates an existing ownership identifier. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. domainOwnershipIdentifierName is name of +// domain ownership identifier. domainOwnershipIdentifier is a JSON +// representation of the domain ownership properties. slot is name of the +// deployment slot. If a slot is not specified, the API will delete the binding +// for the production slot. +func (client AppsClient) CreateOrUpdateDomainOwnershipIdentifierSlot(resourceGroupName string, name string, domainOwnershipIdentifierName string, domainOwnershipIdentifier Identifier, slot string) (result Identifier, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "CreateOrUpdateDomainOwnershipIdentifierSlot") + } + + req, err := client.CreateOrUpdateDomainOwnershipIdentifierSlotPreparer(resourceGroupName, name, domainOwnershipIdentifierName, domainOwnershipIdentifier, slot) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdateDomainOwnershipIdentifierSlot", nil, "Failure preparing request") + } + + resp, err := client.CreateOrUpdateDomainOwnershipIdentifierSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdateDomainOwnershipIdentifierSlot", resp, "Failure sending request") + } + + result, err = client.CreateOrUpdateDomainOwnershipIdentifierSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdateDomainOwnershipIdentifierSlot", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdateDomainOwnershipIdentifierSlotPreparer prepares the CreateOrUpdateDomainOwnershipIdentifierSlot request. +func (client AppsClient) CreateOrUpdateDomainOwnershipIdentifierSlotPreparer(resourceGroupName string, name string, domainOwnershipIdentifierName string, domainOwnershipIdentifier Identifier, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "domainOwnershipIdentifierName": autorest.Encode("path", domainOwnershipIdentifierName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/domainOwnershipIdentifiers/{domainOwnershipIdentifierName}", pathParameters), + autorest.WithJSON(domainOwnershipIdentifier), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CreateOrUpdateDomainOwnershipIdentifierSlotSender sends the CreateOrUpdateDomainOwnershipIdentifierSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) CreateOrUpdateDomainOwnershipIdentifierSlotSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateOrUpdateDomainOwnershipIdentifierSlotResponder handles the response to the CreateOrUpdateDomainOwnershipIdentifierSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) CreateOrUpdateDomainOwnershipIdentifierSlotResponder(resp *http.Response) (result Identifier, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// CreateOrUpdateHostNameBinding creates a hostname binding for an app. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. hostName is hostname in the hostname +// binding. hostNameBinding is binding details. This is the JSON representation +// of a HostNameBinding object. +func (client AppsClient) CreateOrUpdateHostNameBinding(resourceGroupName string, name string, hostName string, hostNameBinding HostNameBinding) (result HostNameBinding, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "CreateOrUpdateHostNameBinding") + } + + req, err := client.CreateOrUpdateHostNameBindingPreparer(resourceGroupName, name, hostName, hostNameBinding) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdateHostNameBinding", nil, "Failure preparing request") + } + + resp, err := client.CreateOrUpdateHostNameBindingSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdateHostNameBinding", resp, "Failure sending request") + } + + result, err = client.CreateOrUpdateHostNameBindingResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdateHostNameBinding", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdateHostNameBindingPreparer prepares the CreateOrUpdateHostNameBinding request. +func (client AppsClient) CreateOrUpdateHostNameBindingPreparer(resourceGroupName string, name string, hostName string, hostNameBinding HostNameBinding) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "hostName": autorest.Encode("path", hostName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/hostNameBindings/{hostName}", pathParameters), + autorest.WithJSON(hostNameBinding), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CreateOrUpdateHostNameBindingSender sends the CreateOrUpdateHostNameBinding request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) CreateOrUpdateHostNameBindingSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateOrUpdateHostNameBindingResponder handles the response to the CreateOrUpdateHostNameBinding request. The method always +// closes the http.Response Body. +func (client AppsClient) CreateOrUpdateHostNameBindingResponder(resp *http.Response) (result HostNameBinding, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// CreateOrUpdateHostNameBindingSlot creates a hostname binding for an app. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. hostName is hostname in the hostname +// binding. hostNameBinding is binding details. This is the JSON representation +// of a HostNameBinding object. slot is name of the deployment slot. If a slot +// is not specified, the API will create a binding for the production slot. +func (client AppsClient) CreateOrUpdateHostNameBindingSlot(resourceGroupName string, name string, hostName string, hostNameBinding HostNameBinding, slot string) (result HostNameBinding, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "CreateOrUpdateHostNameBindingSlot") + } + + req, err := client.CreateOrUpdateHostNameBindingSlotPreparer(resourceGroupName, name, hostName, hostNameBinding, slot) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdateHostNameBindingSlot", nil, "Failure preparing request") + } + + resp, err := client.CreateOrUpdateHostNameBindingSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdateHostNameBindingSlot", resp, "Failure sending request") + } + + result, err = client.CreateOrUpdateHostNameBindingSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdateHostNameBindingSlot", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdateHostNameBindingSlotPreparer prepares the CreateOrUpdateHostNameBindingSlot request. +func (client AppsClient) CreateOrUpdateHostNameBindingSlotPreparer(resourceGroupName string, name string, hostName string, hostNameBinding HostNameBinding, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "hostName": autorest.Encode("path", hostName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/hostNameBindings/{hostName}", pathParameters), + autorest.WithJSON(hostNameBinding), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CreateOrUpdateHostNameBindingSlotSender sends the CreateOrUpdateHostNameBindingSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) CreateOrUpdateHostNameBindingSlotSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateOrUpdateHostNameBindingSlotResponder handles the response to the CreateOrUpdateHostNameBindingSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) CreateOrUpdateHostNameBindingSlotResponder(resp *http.Response) (result HostNameBinding, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// CreateOrUpdateHybridConnection creates a new Hybrid Connection using a +// Service Bus relay. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is the name of the web app namespaceName is the namespace for +// this hybrid connection relayName is the relay name for this hybrid +// connection connectionEnvelope is the details of the hybrid connection +func (client AppsClient) CreateOrUpdateHybridConnection(resourceGroupName string, name string, namespaceName string, relayName string, connectionEnvelope HybridConnection) (result HybridConnection, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "CreateOrUpdateHybridConnection") + } + + req, err := client.CreateOrUpdateHybridConnectionPreparer(resourceGroupName, name, namespaceName, relayName, connectionEnvelope) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdateHybridConnection", nil, "Failure preparing request") + } + + resp, err := client.CreateOrUpdateHybridConnectionSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdateHybridConnection", resp, "Failure sending request") + } + + result, err = client.CreateOrUpdateHybridConnectionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdateHybridConnection", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdateHybridConnectionPreparer prepares the CreateOrUpdateHybridConnection request. +func (client AppsClient) CreateOrUpdateHybridConnectionPreparer(resourceGroupName string, name string, namespaceName string, relayName string, connectionEnvelope HybridConnection) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "namespaceName": autorest.Encode("path", namespaceName), + "relayName": autorest.Encode("path", relayName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/hybridConnectionNamespaces/{namespaceName}/relays/{relayName}", pathParameters), + autorest.WithJSON(connectionEnvelope), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CreateOrUpdateHybridConnectionSender sends the CreateOrUpdateHybridConnection request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) CreateOrUpdateHybridConnectionSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateOrUpdateHybridConnectionResponder handles the response to the CreateOrUpdateHybridConnection request. The method always +// closes the http.Response Body. +func (client AppsClient) CreateOrUpdateHybridConnectionResponder(resp *http.Response) (result HybridConnection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// CreateOrUpdateHybridConnectionSlot creates a new Hybrid Connection using a +// Service Bus relay. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is the name of the web app namespaceName is the namespace for +// this hybrid connection relayName is the relay name for this hybrid +// connection connectionEnvelope is the details of the hybrid connection slot +// is the name of the slot for the web app. +func (client AppsClient) CreateOrUpdateHybridConnectionSlot(resourceGroupName string, name string, namespaceName string, relayName string, connectionEnvelope HybridConnection, slot string) (result HybridConnection, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "CreateOrUpdateHybridConnectionSlot") + } + + req, err := client.CreateOrUpdateHybridConnectionSlotPreparer(resourceGroupName, name, namespaceName, relayName, connectionEnvelope, slot) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdateHybridConnectionSlot", nil, "Failure preparing request") + } + + resp, err := client.CreateOrUpdateHybridConnectionSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdateHybridConnectionSlot", resp, "Failure sending request") + } + + result, err = client.CreateOrUpdateHybridConnectionSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdateHybridConnectionSlot", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdateHybridConnectionSlotPreparer prepares the CreateOrUpdateHybridConnectionSlot request. +func (client AppsClient) CreateOrUpdateHybridConnectionSlotPreparer(resourceGroupName string, name string, namespaceName string, relayName string, connectionEnvelope HybridConnection, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "namespaceName": autorest.Encode("path", namespaceName), + "relayName": autorest.Encode("path", relayName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/hybridConnectionNamespaces/{namespaceName}/relays/{relayName}", pathParameters), + autorest.WithJSON(connectionEnvelope), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CreateOrUpdateHybridConnectionSlotSender sends the CreateOrUpdateHybridConnectionSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) CreateOrUpdateHybridConnectionSlotSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateOrUpdateHybridConnectionSlotResponder handles the response to the CreateOrUpdateHybridConnectionSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) CreateOrUpdateHybridConnectionSlotResponder(resp *http.Response) (result HybridConnection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// CreateOrUpdateRelayServiceConnection creates a new hybrid connection +// configuration (PUT), or updates an existing one (PATCH). +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. entityName is name of the hybrid +// connection configuration. connectionEnvelope is details of the hybrid +// connection configuration. +func (client AppsClient) CreateOrUpdateRelayServiceConnection(resourceGroupName string, name string, entityName string, connectionEnvelope RelayServiceConnectionEntity) (result RelayServiceConnectionEntity, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "CreateOrUpdateRelayServiceConnection") + } + + req, err := client.CreateOrUpdateRelayServiceConnectionPreparer(resourceGroupName, name, entityName, connectionEnvelope) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdateRelayServiceConnection", nil, "Failure preparing request") + } + + resp, err := client.CreateOrUpdateRelayServiceConnectionSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdateRelayServiceConnection", resp, "Failure sending request") + } + + result, err = client.CreateOrUpdateRelayServiceConnectionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdateRelayServiceConnection", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdateRelayServiceConnectionPreparer prepares the CreateOrUpdateRelayServiceConnection request. +func (client AppsClient) CreateOrUpdateRelayServiceConnectionPreparer(resourceGroupName string, name string, entityName string, connectionEnvelope RelayServiceConnectionEntity) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "entityName": autorest.Encode("path", entityName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/hybridconnection/{entityName}", pathParameters), + autorest.WithJSON(connectionEnvelope), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CreateOrUpdateRelayServiceConnectionSender sends the CreateOrUpdateRelayServiceConnection request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) CreateOrUpdateRelayServiceConnectionSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateOrUpdateRelayServiceConnectionResponder handles the response to the CreateOrUpdateRelayServiceConnection request. The method always +// closes the http.Response Body. +func (client AppsClient) CreateOrUpdateRelayServiceConnectionResponder(resp *http.Response) (result RelayServiceConnectionEntity, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// CreateOrUpdateRelayServiceConnectionSlot creates a new hybrid connection +// configuration (PUT), or updates an existing one (PATCH). +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. entityName is name of the hybrid +// connection configuration. connectionEnvelope is details of the hybrid +// connection configuration. slot is name of the deployment slot. If a slot is +// not specified, the API will create or update a hybrid connection for the +// production slot. +func (client AppsClient) CreateOrUpdateRelayServiceConnectionSlot(resourceGroupName string, name string, entityName string, connectionEnvelope RelayServiceConnectionEntity, slot string) (result RelayServiceConnectionEntity, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "CreateOrUpdateRelayServiceConnectionSlot") + } + + req, err := client.CreateOrUpdateRelayServiceConnectionSlotPreparer(resourceGroupName, name, entityName, connectionEnvelope, slot) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdateRelayServiceConnectionSlot", nil, "Failure preparing request") + } + + resp, err := client.CreateOrUpdateRelayServiceConnectionSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdateRelayServiceConnectionSlot", resp, "Failure sending request") + } + + result, err = client.CreateOrUpdateRelayServiceConnectionSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdateRelayServiceConnectionSlot", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdateRelayServiceConnectionSlotPreparer prepares the CreateOrUpdateRelayServiceConnectionSlot request. +func (client AppsClient) CreateOrUpdateRelayServiceConnectionSlotPreparer(resourceGroupName string, name string, entityName string, connectionEnvelope RelayServiceConnectionEntity, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "entityName": autorest.Encode("path", entityName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/hybridconnection/{entityName}", pathParameters), + autorest.WithJSON(connectionEnvelope), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CreateOrUpdateRelayServiceConnectionSlotSender sends the CreateOrUpdateRelayServiceConnectionSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) CreateOrUpdateRelayServiceConnectionSlotSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateOrUpdateRelayServiceConnectionSlotResponder handles the response to the CreateOrUpdateRelayServiceConnectionSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) CreateOrUpdateRelayServiceConnectionSlotResponder(resp *http.Response) (result RelayServiceConnectionEntity, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// CreateOrUpdateSlot creates a new web, mobile, or API app in an existing +// resource group, or updates an existing app. This method may poll for +// completion. Polling can be canceled by passing the cancel channel argument. +// The channel will be used to cancel polling and any outstanding HTTP +// requests. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is unique name of the app to create or update. To create or +// update a deployment slot, use the {slot} parameter. siteEnvelope is a JSON +// representation of the app properties. See example. slot is name of the +// deployment slot to create or update. By default, this API attempts to create +// or modify the production slot. skipDNSRegistration is if true web app +// hostname is not registered with DNS on creation. This parameter is +// only used for app creation skipCustomDomainVerification is if true, custom +// (non *.azurewebsites.net) domains associated with web app are not verified. +// forceDNSRegistration is if true, web app hostname is force registered with +// DNS ttlInSeconds is time to live in seconds for web app's default domain +// name +func (client AppsClient) CreateOrUpdateSlot(resourceGroupName string, name string, siteEnvelope Site, slot string, skipDNSRegistration *bool, skipCustomDomainVerification *bool, forceDNSRegistration *bool, ttlInSeconds string, cancel <-chan struct{}) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}, + {TargetValue: siteEnvelope, + Constraints: []validation.Constraint{{Target: "siteEnvelope.SiteProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "siteEnvelope.SiteProperties.SiteConfig", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "siteEnvelope.SiteProperties.SiteConfig.Push", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "siteEnvelope.SiteProperties.SiteConfig.Push.IsPushEnabled", Name: validation.Null, Rule: true, Chain: nil}}}, + }}, + {Target: "siteEnvelope.SiteProperties.CloningInfo", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "siteEnvelope.SiteProperties.CloningInfo.SourceWebAppID", Name: validation.Null, Rule: true, Chain: nil}}}, + }}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "CreateOrUpdateSlot") + } + + req, err := client.CreateOrUpdateSlotPreparer(resourceGroupName, name, siteEnvelope, slot, skipDNSRegistration, skipCustomDomainVerification, forceDNSRegistration, ttlInSeconds, cancel) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdateSlot", nil, "Failure preparing request") + } + + resp, err := client.CreateOrUpdateSlotSender(req) + if err != nil { + result.Response = resp + return result, autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdateSlot", resp, "Failure sending request") + } + + result, err = client.CreateOrUpdateSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdateSlot", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdateSlotPreparer prepares the CreateOrUpdateSlot request. +func (client AppsClient) CreateOrUpdateSlotPreparer(resourceGroupName string, name string, siteEnvelope Site, slot string, skipDNSRegistration *bool, skipCustomDomainVerification *bool, forceDNSRegistration *bool, ttlInSeconds string, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if skipDNSRegistration != nil { + queryParameters["skipDnsRegistration"] = autorest.Encode("query", *skipDNSRegistration) + } + if skipCustomDomainVerification != nil { + queryParameters["skipCustomDomainVerification"] = autorest.Encode("query", *skipCustomDomainVerification) + } + if forceDNSRegistration != nil { + queryParameters["forceDnsRegistration"] = autorest.Encode("query", *forceDNSRegistration) + } + if len(ttlInSeconds) > 0 { + queryParameters["ttlInSeconds"] = autorest.Encode("query", ttlInSeconds) + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}", pathParameters), + autorest.WithJSON(siteEnvelope), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// CreateOrUpdateSlotSender sends the CreateOrUpdateSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) CreateOrUpdateSlotSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// CreateOrUpdateSlotResponder handles the response to the CreateOrUpdateSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) CreateOrUpdateSlotResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// CreateOrUpdateSourceControl updates the source control configuration of an +// app. This method may poll for completion. Polling can be canceled by passing +// the cancel channel argument. The channel will be used to cancel polling and +// any outstanding HTTP requests. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. siteSourceControl is jSON representation +// of a SiteSourceControl object. See example. +func (client AppsClient) CreateOrUpdateSourceControl(resourceGroupName string, name string, siteSourceControl SiteSourceControl, cancel <-chan struct{}) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "CreateOrUpdateSourceControl") + } + + req, err := client.CreateOrUpdateSourceControlPreparer(resourceGroupName, name, siteSourceControl, cancel) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdateSourceControl", nil, "Failure preparing request") + } + + resp, err := client.CreateOrUpdateSourceControlSender(req) + if err != nil { + result.Response = resp + return result, autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdateSourceControl", resp, "Failure sending request") + } + + result, err = client.CreateOrUpdateSourceControlResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdateSourceControl", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdateSourceControlPreparer prepares the CreateOrUpdateSourceControl request. +func (client AppsClient) CreateOrUpdateSourceControlPreparer(resourceGroupName string, name string, siteSourceControl SiteSourceControl, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/sourcecontrols/web", pathParameters), + autorest.WithJSON(siteSourceControl), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// CreateOrUpdateSourceControlSender sends the CreateOrUpdateSourceControl request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) CreateOrUpdateSourceControlSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// CreateOrUpdateSourceControlResponder handles the response to the CreateOrUpdateSourceControl request. The method always +// closes the http.Response Body. +func (client AppsClient) CreateOrUpdateSourceControlResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByClosing()) + result.Response = resp + return +} + +// CreateOrUpdateSourceControlSlot updates the source control configuration of +// an app. This method may poll for completion. Polling can be canceled by +// passing the cancel channel argument. The channel will be used to cancel +// polling and any outstanding HTTP requests. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. siteSourceControl is jSON representation +// of a SiteSourceControl object. See example. slot is name of the deployment +// slot. If a slot is not specified, the API will update the source control +// configuration for the production slot. +func (client AppsClient) CreateOrUpdateSourceControlSlot(resourceGroupName string, name string, siteSourceControl SiteSourceControl, slot string, cancel <-chan struct{}) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "CreateOrUpdateSourceControlSlot") + } + + req, err := client.CreateOrUpdateSourceControlSlotPreparer(resourceGroupName, name, siteSourceControl, slot, cancel) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdateSourceControlSlot", nil, "Failure preparing request") + } + + resp, err := client.CreateOrUpdateSourceControlSlotSender(req) + if err != nil { + result.Response = resp + return result, autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdateSourceControlSlot", resp, "Failure sending request") + } + + result, err = client.CreateOrUpdateSourceControlSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdateSourceControlSlot", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdateSourceControlSlotPreparer prepares the CreateOrUpdateSourceControlSlot request. +func (client AppsClient) CreateOrUpdateSourceControlSlotPreparer(resourceGroupName string, name string, siteSourceControl SiteSourceControl, slot string, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/sourcecontrols/web", pathParameters), + autorest.WithJSON(siteSourceControl), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// CreateOrUpdateSourceControlSlotSender sends the CreateOrUpdateSourceControlSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) CreateOrUpdateSourceControlSlotSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// CreateOrUpdateSourceControlSlotResponder handles the response to the CreateOrUpdateSourceControlSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) CreateOrUpdateSourceControlSlotResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByClosing()) + result.Response = resp + return +} + +// CreateOrUpdateVnetConnection adds a Virtual Network connection to an app or +// slot (PUT) or updates the connection properties (PATCH). +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. vnetName is name of an existing Virtual +// Network. connectionEnvelope is properties of the Virtual Network connection. +// See example. +func (client AppsClient) CreateOrUpdateVnetConnection(resourceGroupName string, name string, vnetName string, connectionEnvelope VnetInfo) (result VnetInfo, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "CreateOrUpdateVnetConnection") + } + + req, err := client.CreateOrUpdateVnetConnectionPreparer(resourceGroupName, name, vnetName, connectionEnvelope) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdateVnetConnection", nil, "Failure preparing request") + } + + resp, err := client.CreateOrUpdateVnetConnectionSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdateVnetConnection", resp, "Failure sending request") + } + + result, err = client.CreateOrUpdateVnetConnectionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdateVnetConnection", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdateVnetConnectionPreparer prepares the CreateOrUpdateVnetConnection request. +func (client AppsClient) CreateOrUpdateVnetConnectionPreparer(resourceGroupName string, name string, vnetName string, connectionEnvelope VnetInfo) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vnetName": autorest.Encode("path", vnetName), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/virtualNetworkConnections/{vnetName}", pathParameters), + autorest.WithJSON(connectionEnvelope), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CreateOrUpdateVnetConnectionSender sends the CreateOrUpdateVnetConnection request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) CreateOrUpdateVnetConnectionSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateOrUpdateVnetConnectionResponder handles the response to the CreateOrUpdateVnetConnection request. The method always +// closes the http.Response Body. +func (client AppsClient) CreateOrUpdateVnetConnectionResponder(resp *http.Response) (result VnetInfo, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// CreateOrUpdateVnetConnectionGateway adds a gateway to a connected Virtual +// Network (PUT) or updates it (PATCH). +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. vnetName is name of the Virtual Network. +// gatewayName is name of the gateway. Currently, the only supported string is +// "primary". connectionEnvelope is the properties to update this gateway with. +func (client AppsClient) CreateOrUpdateVnetConnectionGateway(resourceGroupName string, name string, vnetName string, gatewayName string, connectionEnvelope VnetGateway) (result VnetGateway, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "CreateOrUpdateVnetConnectionGateway") + } + + req, err := client.CreateOrUpdateVnetConnectionGatewayPreparer(resourceGroupName, name, vnetName, gatewayName, connectionEnvelope) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdateVnetConnectionGateway", nil, "Failure preparing request") + } + + resp, err := client.CreateOrUpdateVnetConnectionGatewaySender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdateVnetConnectionGateway", resp, "Failure sending request") + } + + result, err = client.CreateOrUpdateVnetConnectionGatewayResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdateVnetConnectionGateway", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdateVnetConnectionGatewayPreparer prepares the CreateOrUpdateVnetConnectionGateway request. +func (client AppsClient) CreateOrUpdateVnetConnectionGatewayPreparer(resourceGroupName string, name string, vnetName string, gatewayName string, connectionEnvelope VnetGateway) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "gatewayName": autorest.Encode("path", gatewayName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vnetName": autorest.Encode("path", vnetName), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/virtualNetworkConnections/{vnetName}/gateways/{gatewayName}", pathParameters), + autorest.WithJSON(connectionEnvelope), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CreateOrUpdateVnetConnectionGatewaySender sends the CreateOrUpdateVnetConnectionGateway request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) CreateOrUpdateVnetConnectionGatewaySender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateOrUpdateVnetConnectionGatewayResponder handles the response to the CreateOrUpdateVnetConnectionGateway request. The method always +// closes the http.Response Body. +func (client AppsClient) CreateOrUpdateVnetConnectionGatewayResponder(resp *http.Response) (result VnetGateway, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// CreateOrUpdateVnetConnectionGatewaySlot adds a gateway to a connected +// Virtual Network (PUT) or updates it (PATCH). +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. vnetName is name of the Virtual Network. +// gatewayName is name of the gateway. Currently, the only supported string is +// "primary". connectionEnvelope is the properties to update this gateway with. +// slot is name of the deployment slot. If a slot is not specified, the API +// will add or update a gateway for the production slot's Virtual Network. +func (client AppsClient) CreateOrUpdateVnetConnectionGatewaySlot(resourceGroupName string, name string, vnetName string, gatewayName string, connectionEnvelope VnetGateway, slot string) (result VnetGateway, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "CreateOrUpdateVnetConnectionGatewaySlot") + } + + req, err := client.CreateOrUpdateVnetConnectionGatewaySlotPreparer(resourceGroupName, name, vnetName, gatewayName, connectionEnvelope, slot) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdateVnetConnectionGatewaySlot", nil, "Failure preparing request") + } + + resp, err := client.CreateOrUpdateVnetConnectionGatewaySlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdateVnetConnectionGatewaySlot", resp, "Failure sending request") + } + + result, err = client.CreateOrUpdateVnetConnectionGatewaySlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdateVnetConnectionGatewaySlot", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdateVnetConnectionGatewaySlotPreparer prepares the CreateOrUpdateVnetConnectionGatewaySlot request. +func (client AppsClient) CreateOrUpdateVnetConnectionGatewaySlotPreparer(resourceGroupName string, name string, vnetName string, gatewayName string, connectionEnvelope VnetGateway, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "gatewayName": autorest.Encode("path", gatewayName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vnetName": autorest.Encode("path", vnetName), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/virtualNetworkConnections/{vnetName}/gateways/{gatewayName}", pathParameters), + autorest.WithJSON(connectionEnvelope), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CreateOrUpdateVnetConnectionGatewaySlotSender sends the CreateOrUpdateVnetConnectionGatewaySlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) CreateOrUpdateVnetConnectionGatewaySlotSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateOrUpdateVnetConnectionGatewaySlotResponder handles the response to the CreateOrUpdateVnetConnectionGatewaySlot request. The method always +// closes the http.Response Body. +func (client AppsClient) CreateOrUpdateVnetConnectionGatewaySlotResponder(resp *http.Response) (result VnetGateway, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// CreateOrUpdateVnetConnectionSlot adds a Virtual Network connection to an app +// or slot (PUT) or updates the connection properties (PATCH). +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. vnetName is name of an existing Virtual +// Network. connectionEnvelope is properties of the Virtual Network connection. +// See example. slot is name of the deployment slot. If a slot is not +// specified, the API will add or update connections for the production slot. +func (client AppsClient) CreateOrUpdateVnetConnectionSlot(resourceGroupName string, name string, vnetName string, connectionEnvelope VnetInfo, slot string) (result VnetInfo, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "CreateOrUpdateVnetConnectionSlot") + } + + req, err := client.CreateOrUpdateVnetConnectionSlotPreparer(resourceGroupName, name, vnetName, connectionEnvelope, slot) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdateVnetConnectionSlot", nil, "Failure preparing request") + } + + resp, err := client.CreateOrUpdateVnetConnectionSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdateVnetConnectionSlot", resp, "Failure sending request") + } + + result, err = client.CreateOrUpdateVnetConnectionSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdateVnetConnectionSlot", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdateVnetConnectionSlotPreparer prepares the CreateOrUpdateVnetConnectionSlot request. +func (client AppsClient) CreateOrUpdateVnetConnectionSlotPreparer(resourceGroupName string, name string, vnetName string, connectionEnvelope VnetInfo, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vnetName": autorest.Encode("path", vnetName), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/virtualNetworkConnections/{vnetName}", pathParameters), + autorest.WithJSON(connectionEnvelope), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CreateOrUpdateVnetConnectionSlotSender sends the CreateOrUpdateVnetConnectionSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) CreateOrUpdateVnetConnectionSlotSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateOrUpdateVnetConnectionSlotResponder handles the response to the CreateOrUpdateVnetConnectionSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) CreateOrUpdateVnetConnectionSlotResponder(resp *http.Response) (result VnetInfo, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes a web, mobile, or API app, or one of the deployment slots. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app to delete. deleteMetrics is if true, web +// app metrics are also deleted deleteEmptyServerFarm is specify true if the +// App Service plan will be empty after app deletion and you want to delete the +// empty App Service plan. By default, the empty App Service plan is not +// deleted. skipDNSRegistration is if true, DNS registration is skipped +func (client AppsClient) Delete(resourceGroupName string, name string, deleteMetrics *bool, deleteEmptyServerFarm *bool, skipDNSRegistration *bool) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "Delete") + } + + req, err := client.DeletePreparer(resourceGroupName, name, deleteMetrics, deleteEmptyServerFarm, skipDNSRegistration) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "Delete", nil, "Failure preparing request") + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + return result, autorest.NewErrorWithError(err, "web.AppsClient", "Delete", resp, "Failure sending request") + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client AppsClient) DeletePreparer(resourceGroupName string, name string, deleteMetrics *bool, deleteEmptyServerFarm *bool, skipDNSRegistration *bool) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if deleteMetrics != nil { + queryParameters["deleteMetrics"] = autorest.Encode("query", *deleteMetrics) + } + if deleteEmptyServerFarm != nil { + queryParameters["deleteEmptyServerFarm"] = autorest.Encode("query", *deleteEmptyServerFarm) + } + if skipDNSRegistration != nil { + queryParameters["skipDnsRegistration"] = autorest.Encode("query", *skipDNSRegistration) + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client AppsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNotFound), + autorest.ByClosing()) + result.Response = resp + return +} + +// DeleteBackup deletes a backup of an app by its ID. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. backupID is iD of the backup. +func (client AppsClient) DeleteBackup(resourceGroupName string, name string, backupID string) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "DeleteBackup") + } + + req, err := client.DeleteBackupPreparer(resourceGroupName, name, backupID) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "DeleteBackup", nil, "Failure preparing request") + } + + resp, err := client.DeleteBackupSender(req) + if err != nil { + result.Response = resp + return result, autorest.NewErrorWithError(err, "web.AppsClient", "DeleteBackup", resp, "Failure sending request") + } + + result, err = client.DeleteBackupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteBackup", resp, "Failure responding to request") + } + + return +} + +// DeleteBackupPreparer prepares the DeleteBackup request. +func (client AppsClient) DeleteBackupPreparer(resourceGroupName string, name string, backupID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "backupId": autorest.Encode("path", backupID), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-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.Web/sites/{name}/backups/{backupId}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DeleteBackupSender sends the DeleteBackup request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) DeleteBackupSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteBackupResponder handles the response to the DeleteBackup request. The method always +// closes the http.Response Body. +func (client AppsClient) DeleteBackupResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNotFound), + autorest.ByClosing()) + result.Response = resp + return +} + +// DeleteBackupConfiguration deletes the backup configuration of an app. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. +func (client AppsClient) DeleteBackupConfiguration(resourceGroupName string, name string) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "DeleteBackupConfiguration") + } + + req, err := client.DeleteBackupConfigurationPreparer(resourceGroupName, name) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "DeleteBackupConfiguration", nil, "Failure preparing request") + } + + resp, err := client.DeleteBackupConfigurationSender(req) + if err != nil { + result.Response = resp + return result, autorest.NewErrorWithError(err, "web.AppsClient", "DeleteBackupConfiguration", resp, "Failure sending request") + } + + result, err = client.DeleteBackupConfigurationResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteBackupConfiguration", resp, "Failure responding to request") + } + + return +} + +// DeleteBackupConfigurationPreparer prepares the DeleteBackupConfiguration request. +func (client AppsClient) DeleteBackupConfigurationPreparer(resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-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.Web/sites/{name}/config/backup", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DeleteBackupConfigurationSender sends the DeleteBackupConfiguration request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) DeleteBackupConfigurationSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteBackupConfigurationResponder handles the response to the DeleteBackupConfiguration request. The method always +// closes the http.Response Body. +func (client AppsClient) DeleteBackupConfigurationResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// DeleteBackupConfigurationSlot deletes the backup configuration of an app. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. slot is name of the deployment slot. If a +// slot is not specified, the API will delete the backup configuration for the +// production slot. +func (client AppsClient) DeleteBackupConfigurationSlot(resourceGroupName string, name string, slot string) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "DeleteBackupConfigurationSlot") + } + + req, err := client.DeleteBackupConfigurationSlotPreparer(resourceGroupName, name, slot) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "DeleteBackupConfigurationSlot", nil, "Failure preparing request") + } + + resp, err := client.DeleteBackupConfigurationSlotSender(req) + if err != nil { + result.Response = resp + return result, autorest.NewErrorWithError(err, "web.AppsClient", "DeleteBackupConfigurationSlot", resp, "Failure sending request") + } + + result, err = client.DeleteBackupConfigurationSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteBackupConfigurationSlot", resp, "Failure responding to request") + } + + return +} + +// DeleteBackupConfigurationSlotPreparer prepares the DeleteBackupConfigurationSlot request. +func (client AppsClient) DeleteBackupConfigurationSlotPreparer(resourceGroupName string, name string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-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.Web/sites/{name}/slots/{slot}/config/backup", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DeleteBackupConfigurationSlotSender sends the DeleteBackupConfigurationSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) DeleteBackupConfigurationSlotSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteBackupConfigurationSlotResponder handles the response to the DeleteBackupConfigurationSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) DeleteBackupConfigurationSlotResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// DeleteBackupSlot deletes a backup of an app by its ID. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. backupID is iD of the backup. slot is name +// of the deployment slot. If a slot is not specified, the API will delete a +// backup of the production slot. +func (client AppsClient) DeleteBackupSlot(resourceGroupName string, name string, backupID string, slot string) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "DeleteBackupSlot") + } + + req, err := client.DeleteBackupSlotPreparer(resourceGroupName, name, backupID, slot) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "DeleteBackupSlot", nil, "Failure preparing request") + } + + resp, err := client.DeleteBackupSlotSender(req) + if err != nil { + result.Response = resp + return result, autorest.NewErrorWithError(err, "web.AppsClient", "DeleteBackupSlot", resp, "Failure sending request") + } + + result, err = client.DeleteBackupSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteBackupSlot", resp, "Failure responding to request") + } + + return +} + +// DeleteBackupSlotPreparer prepares the DeleteBackupSlot request. +func (client AppsClient) DeleteBackupSlotPreparer(resourceGroupName string, name string, backupID string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "backupId": autorest.Encode("path", backupID), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-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.Web/sites/{name}/slots/{slot}/backups/{backupId}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DeleteBackupSlotSender sends the DeleteBackupSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) DeleteBackupSlotSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteBackupSlotResponder handles the response to the DeleteBackupSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) DeleteBackupSlotResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNotFound), + autorest.ByClosing()) + result.Response = resp + return +} + +// DeleteDeployment delete a deployment by its ID for an app, a specific +// deployment slot, and/or a specific scaled-out instance. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. id is deployment ID. +func (client AppsClient) DeleteDeployment(resourceGroupName string, name string, id string) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "DeleteDeployment") + } + + req, err := client.DeleteDeploymentPreparer(resourceGroupName, name, id) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "DeleteDeployment", nil, "Failure preparing request") + } + + resp, err := client.DeleteDeploymentSender(req) + if err != nil { + result.Response = resp + return result, autorest.NewErrorWithError(err, "web.AppsClient", "DeleteDeployment", resp, "Failure sending request") + } + + result, err = client.DeleteDeploymentResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteDeployment", resp, "Failure responding to request") + } + + return +} + +// DeleteDeploymentPreparer prepares the DeleteDeployment request. +func (client AppsClient) DeleteDeploymentPreparer(resourceGroupName string, name string, id string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "id": autorest.Encode("path", id), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-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.Web/sites/{name}/deployments/{id}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DeleteDeploymentSender sends the DeleteDeployment request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) DeleteDeploymentSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteDeploymentResponder handles the response to the DeleteDeployment request. The method always +// closes the http.Response Body. +func (client AppsClient) DeleteDeploymentResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// DeleteDeploymentSlot delete a deployment by its ID for an app, a specific +// deployment slot, and/or a specific scaled-out instance. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. id is deployment ID. slot is name of the +// deployment slot. If a slot is not specified, the API deletes a deployment +// for the production slot. +func (client AppsClient) DeleteDeploymentSlot(resourceGroupName string, name string, id string, slot string) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "DeleteDeploymentSlot") + } + + req, err := client.DeleteDeploymentSlotPreparer(resourceGroupName, name, id, slot) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "DeleteDeploymentSlot", nil, "Failure preparing request") + } + + resp, err := client.DeleteDeploymentSlotSender(req) + if err != nil { + result.Response = resp + return result, autorest.NewErrorWithError(err, "web.AppsClient", "DeleteDeploymentSlot", resp, "Failure sending request") + } + + result, err = client.DeleteDeploymentSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteDeploymentSlot", resp, "Failure responding to request") + } + + return +} + +// DeleteDeploymentSlotPreparer prepares the DeleteDeploymentSlot request. +func (client AppsClient) DeleteDeploymentSlotPreparer(resourceGroupName string, name string, id string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "id": autorest.Encode("path", id), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-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.Web/sites/{name}/slots/{slot}/deployments/{id}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DeleteDeploymentSlotSender sends the DeleteDeploymentSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) DeleteDeploymentSlotSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteDeploymentSlotResponder handles the response to the DeleteDeploymentSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) DeleteDeploymentSlotResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// DeleteDomainOwnershipIdentifier deletes a domain ownership identifier for a +// web app. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. domainOwnershipIdentifierName is name of +// domain ownership identifier. +func (client AppsClient) DeleteDomainOwnershipIdentifier(resourceGroupName string, name string, domainOwnershipIdentifierName string) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "DeleteDomainOwnershipIdentifier") + } + + req, err := client.DeleteDomainOwnershipIdentifierPreparer(resourceGroupName, name, domainOwnershipIdentifierName) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "DeleteDomainOwnershipIdentifier", nil, "Failure preparing request") + } + + resp, err := client.DeleteDomainOwnershipIdentifierSender(req) + if err != nil { + result.Response = resp + return result, autorest.NewErrorWithError(err, "web.AppsClient", "DeleteDomainOwnershipIdentifier", resp, "Failure sending request") + } + + result, err = client.DeleteDomainOwnershipIdentifierResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteDomainOwnershipIdentifier", resp, "Failure responding to request") + } + + return +} + +// DeleteDomainOwnershipIdentifierPreparer prepares the DeleteDomainOwnershipIdentifier request. +func (client AppsClient) DeleteDomainOwnershipIdentifierPreparer(resourceGroupName string, name string, domainOwnershipIdentifierName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "domainOwnershipIdentifierName": autorest.Encode("path", domainOwnershipIdentifierName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-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.Web/sites/{name}/domainOwnershipIdentifiers/{domainOwnershipIdentifierName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DeleteDomainOwnershipIdentifierSender sends the DeleteDomainOwnershipIdentifier request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) DeleteDomainOwnershipIdentifierSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteDomainOwnershipIdentifierResponder handles the response to the DeleteDomainOwnershipIdentifier request. The method always +// closes the http.Response Body. +func (client AppsClient) DeleteDomainOwnershipIdentifierResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// DeleteDomainOwnershipIdentifierSlot deletes a domain ownership identifier +// for a web app. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. domainOwnershipIdentifierName is name of +// domain ownership identifier. slot is name of the deployment slot. If a slot +// is not specified, the API will delete the binding for the production slot. +func (client AppsClient) DeleteDomainOwnershipIdentifierSlot(resourceGroupName string, name string, domainOwnershipIdentifierName string, slot string) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "DeleteDomainOwnershipIdentifierSlot") + } + + req, err := client.DeleteDomainOwnershipIdentifierSlotPreparer(resourceGroupName, name, domainOwnershipIdentifierName, slot) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "DeleteDomainOwnershipIdentifierSlot", nil, "Failure preparing request") + } + + resp, err := client.DeleteDomainOwnershipIdentifierSlotSender(req) + if err != nil { + result.Response = resp + return result, autorest.NewErrorWithError(err, "web.AppsClient", "DeleteDomainOwnershipIdentifierSlot", resp, "Failure sending request") + } + + result, err = client.DeleteDomainOwnershipIdentifierSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteDomainOwnershipIdentifierSlot", resp, "Failure responding to request") + } + + return +} + +// DeleteDomainOwnershipIdentifierSlotPreparer prepares the DeleteDomainOwnershipIdentifierSlot request. +func (client AppsClient) DeleteDomainOwnershipIdentifierSlotPreparer(resourceGroupName string, name string, domainOwnershipIdentifierName string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "domainOwnershipIdentifierName": autorest.Encode("path", domainOwnershipIdentifierName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-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.Web/sites/{name}/slots/{slot}/domainOwnershipIdentifiers/{domainOwnershipIdentifierName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DeleteDomainOwnershipIdentifierSlotSender sends the DeleteDomainOwnershipIdentifierSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) DeleteDomainOwnershipIdentifierSlotSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteDomainOwnershipIdentifierSlotResponder handles the response to the DeleteDomainOwnershipIdentifierSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) DeleteDomainOwnershipIdentifierSlotResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// DeleteHostNameBinding deletes a hostname binding for an app. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. hostName is hostname in the hostname +// binding. +func (client AppsClient) DeleteHostNameBinding(resourceGroupName string, name string, hostName string) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "DeleteHostNameBinding") + } + + req, err := client.DeleteHostNameBindingPreparer(resourceGroupName, name, hostName) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "DeleteHostNameBinding", nil, "Failure preparing request") + } + + resp, err := client.DeleteHostNameBindingSender(req) + if err != nil { + result.Response = resp + return result, autorest.NewErrorWithError(err, "web.AppsClient", "DeleteHostNameBinding", resp, "Failure sending request") + } + + result, err = client.DeleteHostNameBindingResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteHostNameBinding", resp, "Failure responding to request") + } + + return +} + +// DeleteHostNameBindingPreparer prepares the DeleteHostNameBinding request. +func (client AppsClient) DeleteHostNameBindingPreparer(resourceGroupName string, name string, hostName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "hostName": autorest.Encode("path", hostName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-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.Web/sites/{name}/hostNameBindings/{hostName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DeleteHostNameBindingSender sends the DeleteHostNameBinding request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) DeleteHostNameBindingSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteHostNameBindingResponder handles the response to the DeleteHostNameBinding request. The method always +// closes the http.Response Body. +func (client AppsClient) DeleteHostNameBindingResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// DeleteHostNameBindingSlot deletes a hostname binding for an app. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. slot is name of the deployment slot. If a +// slot is not specified, the API will delete the binding for the production +// slot. hostName is hostname in the hostname binding. +func (client AppsClient) DeleteHostNameBindingSlot(resourceGroupName string, name string, slot string, hostName string) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "DeleteHostNameBindingSlot") + } + + req, err := client.DeleteHostNameBindingSlotPreparer(resourceGroupName, name, slot, hostName) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "DeleteHostNameBindingSlot", nil, "Failure preparing request") + } + + resp, err := client.DeleteHostNameBindingSlotSender(req) + if err != nil { + result.Response = resp + return result, autorest.NewErrorWithError(err, "web.AppsClient", "DeleteHostNameBindingSlot", resp, "Failure sending request") + } + + result, err = client.DeleteHostNameBindingSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteHostNameBindingSlot", resp, "Failure responding to request") + } + + return +} + +// DeleteHostNameBindingSlotPreparer prepares the DeleteHostNameBindingSlot request. +func (client AppsClient) DeleteHostNameBindingSlotPreparer(resourceGroupName string, name string, slot string, hostName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "hostName": autorest.Encode("path", hostName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-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.Web/sites/{name}/slots/{slot}/hostNameBindings/{hostName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DeleteHostNameBindingSlotSender sends the DeleteHostNameBindingSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) DeleteHostNameBindingSlotSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteHostNameBindingSlotResponder handles the response to the DeleteHostNameBindingSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) DeleteHostNameBindingSlotResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// DeleteHybridConnection removes a Hybrid Connection from this site. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is the name of the web app namespaceName is the namespace for +// this hybrid connection relayName is the relay name for this hybrid +// connection +func (client AppsClient) DeleteHybridConnection(resourceGroupName string, name string, namespaceName string, relayName string) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "DeleteHybridConnection") + } + + req, err := client.DeleteHybridConnectionPreparer(resourceGroupName, name, namespaceName, relayName) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "DeleteHybridConnection", nil, "Failure preparing request") + } + + resp, err := client.DeleteHybridConnectionSender(req) + if err != nil { + result.Response = resp + return result, autorest.NewErrorWithError(err, "web.AppsClient", "DeleteHybridConnection", resp, "Failure sending request") + } + + result, err = client.DeleteHybridConnectionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteHybridConnection", resp, "Failure responding to request") + } + + return +} + +// DeleteHybridConnectionPreparer prepares the DeleteHybridConnection request. +func (client AppsClient) DeleteHybridConnectionPreparer(resourceGroupName string, name string, namespaceName string, relayName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "namespaceName": autorest.Encode("path", namespaceName), + "relayName": autorest.Encode("path", relayName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-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.Web/sites/{name}/hybridConnectionNamespaces/{namespaceName}/relays/{relayName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DeleteHybridConnectionSender sends the DeleteHybridConnection request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) DeleteHybridConnectionSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteHybridConnectionResponder handles the response to the DeleteHybridConnection request. The method always +// closes the http.Response Body. +func (client AppsClient) DeleteHybridConnectionResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNotFound), + autorest.ByClosing()) + result.Response = resp + return +} + +// DeleteHybridConnectionSlot removes a Hybrid Connection from this site. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is the name of the web app namespaceName is the namespace for +// this hybrid connection relayName is the relay name for this hybrid +// connection slot is the name of the slot for the web app. +func (client AppsClient) DeleteHybridConnectionSlot(resourceGroupName string, name string, namespaceName string, relayName string, slot string) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "DeleteHybridConnectionSlot") + } + + req, err := client.DeleteHybridConnectionSlotPreparer(resourceGroupName, name, namespaceName, relayName, slot) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "DeleteHybridConnectionSlot", nil, "Failure preparing request") + } + + resp, err := client.DeleteHybridConnectionSlotSender(req) + if err != nil { + result.Response = resp + return result, autorest.NewErrorWithError(err, "web.AppsClient", "DeleteHybridConnectionSlot", resp, "Failure sending request") + } + + result, err = client.DeleteHybridConnectionSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteHybridConnectionSlot", resp, "Failure responding to request") + } + + return +} + +// DeleteHybridConnectionSlotPreparer prepares the DeleteHybridConnectionSlot request. +func (client AppsClient) DeleteHybridConnectionSlotPreparer(resourceGroupName string, name string, namespaceName string, relayName string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "namespaceName": autorest.Encode("path", namespaceName), + "relayName": autorest.Encode("path", relayName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-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.Web/sites/{name}/slots/{slot}/hybridConnectionNamespaces/{namespaceName}/relays/{relayName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DeleteHybridConnectionSlotSender sends the DeleteHybridConnectionSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) DeleteHybridConnectionSlotSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteHybridConnectionSlotResponder handles the response to the DeleteHybridConnectionSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) DeleteHybridConnectionSlotResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNotFound), + autorest.ByClosing()) + result.Response = resp + return +} + +// DeleteInstanceDeployment delete a deployment by its ID for an app, a +// specific deployment slot, and/or a specific scaled-out instance. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. id is deployment ID. instanceID is iD of a +// specific scaled-out instance. This is the value of the name property in the +// JSON response from "GET api/sites/{siteName}/instances" +func (client AppsClient) DeleteInstanceDeployment(resourceGroupName string, name string, id string, instanceID string) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "DeleteInstanceDeployment") + } + + req, err := client.DeleteInstanceDeploymentPreparer(resourceGroupName, name, id, instanceID) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "DeleteInstanceDeployment", nil, "Failure preparing request") + } + + resp, err := client.DeleteInstanceDeploymentSender(req) + if err != nil { + result.Response = resp + return result, autorest.NewErrorWithError(err, "web.AppsClient", "DeleteInstanceDeployment", resp, "Failure sending request") + } + + result, err = client.DeleteInstanceDeploymentResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteInstanceDeployment", resp, "Failure responding to request") + } + + return +} + +// DeleteInstanceDeploymentPreparer prepares the DeleteInstanceDeployment request. +func (client AppsClient) DeleteInstanceDeploymentPreparer(resourceGroupName string, name string, id string, instanceID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "id": autorest.Encode("path", id), + "instanceId": autorest.Encode("path", instanceID), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-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.Web/sites/{name}/instances/{instanceId}/deployments/{id}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DeleteInstanceDeploymentSender sends the DeleteInstanceDeployment request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) DeleteInstanceDeploymentSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteInstanceDeploymentResponder handles the response to the DeleteInstanceDeployment request. The method always +// closes the http.Response Body. +func (client AppsClient) DeleteInstanceDeploymentResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// DeleteInstanceDeploymentSlot delete a deployment by its ID for an app, a +// specific deployment slot, and/or a specific scaled-out instance. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. id is deployment ID. slot is name of the +// deployment slot. If a slot is not specified, the API deletes a deployment +// for the production slot. instanceID is iD of a specific scaled-out instance. +// This is the value of the name property in the JSON response from "GET +// api/sites/{siteName}/instances" +func (client AppsClient) DeleteInstanceDeploymentSlot(resourceGroupName string, name string, id string, slot string, instanceID string) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "DeleteInstanceDeploymentSlot") + } + + req, err := client.DeleteInstanceDeploymentSlotPreparer(resourceGroupName, name, id, slot, instanceID) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "DeleteInstanceDeploymentSlot", nil, "Failure preparing request") + } + + resp, err := client.DeleteInstanceDeploymentSlotSender(req) + if err != nil { + result.Response = resp + return result, autorest.NewErrorWithError(err, "web.AppsClient", "DeleteInstanceDeploymentSlot", resp, "Failure sending request") + } + + result, err = client.DeleteInstanceDeploymentSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteInstanceDeploymentSlot", resp, "Failure responding to request") + } + + return +} + +// DeleteInstanceDeploymentSlotPreparer prepares the DeleteInstanceDeploymentSlot request. +func (client AppsClient) DeleteInstanceDeploymentSlotPreparer(resourceGroupName string, name string, id string, slot string, instanceID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "id": autorest.Encode("path", id), + "instanceId": autorest.Encode("path", instanceID), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-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.Web/sites/{name}/slots/{slot}/instances/{instanceId}/deployments/{id}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DeleteInstanceDeploymentSlotSender sends the DeleteInstanceDeploymentSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) DeleteInstanceDeploymentSlotSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteInstanceDeploymentSlotResponder handles the response to the DeleteInstanceDeploymentSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) DeleteInstanceDeploymentSlotResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// DeletePremierAddOn delete a premier add-on from an app. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. premierAddOnName is add-on name. +func (client AppsClient) DeletePremierAddOn(resourceGroupName string, name string, premierAddOnName string) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "DeletePremierAddOn") + } + + req, err := client.DeletePremierAddOnPreparer(resourceGroupName, name, premierAddOnName) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "DeletePremierAddOn", nil, "Failure preparing request") + } + + resp, err := client.DeletePremierAddOnSender(req) + if err != nil { + result.Response = resp + return result, autorest.NewErrorWithError(err, "web.AppsClient", "DeletePremierAddOn", resp, "Failure sending request") + } + + result, err = client.DeletePremierAddOnResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "DeletePremierAddOn", resp, "Failure responding to request") + } + + return +} + +// DeletePremierAddOnPreparer prepares the DeletePremierAddOn request. +func (client AppsClient) DeletePremierAddOnPreparer(resourceGroupName string, name string, premierAddOnName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "premierAddOnName": autorest.Encode("path", premierAddOnName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-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.Web/sites/{name}/premieraddons/{premierAddOnName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DeletePremierAddOnSender sends the DeletePremierAddOn request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) DeletePremierAddOnSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeletePremierAddOnResponder handles the response to the DeletePremierAddOn request. The method always +// closes the http.Response Body. +func (client AppsClient) DeletePremierAddOnResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// DeletePremierAddOnSlot delete a premier add-on from an app. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. premierAddOnName is add-on name. slot is +// name of the deployment slot. If a slot is not specified, the API will delete +// the named add-on for the production slot. +func (client AppsClient) DeletePremierAddOnSlot(resourceGroupName string, name string, premierAddOnName string, slot string) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "DeletePremierAddOnSlot") + } + + req, err := client.DeletePremierAddOnSlotPreparer(resourceGroupName, name, premierAddOnName, slot) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "DeletePremierAddOnSlot", nil, "Failure preparing request") + } + + resp, err := client.DeletePremierAddOnSlotSender(req) + if err != nil { + result.Response = resp + return result, autorest.NewErrorWithError(err, "web.AppsClient", "DeletePremierAddOnSlot", resp, "Failure sending request") + } + + result, err = client.DeletePremierAddOnSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "DeletePremierAddOnSlot", resp, "Failure responding to request") + } + + return +} + +// DeletePremierAddOnSlotPreparer prepares the DeletePremierAddOnSlot request. +func (client AppsClient) DeletePremierAddOnSlotPreparer(resourceGroupName string, name string, premierAddOnName string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "premierAddOnName": autorest.Encode("path", premierAddOnName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-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.Web/sites/{name}/slots/{slot}/premieraddons/{premierAddOnName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DeletePremierAddOnSlotSender sends the DeletePremierAddOnSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) DeletePremierAddOnSlotSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeletePremierAddOnSlotResponder handles the response to the DeletePremierAddOnSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) DeletePremierAddOnSlotResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// DeleteRelayServiceConnection deletes a relay service connection by its name. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. entityName is name of the hybrid +// connection configuration. +func (client AppsClient) DeleteRelayServiceConnection(resourceGroupName string, name string, entityName string) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "DeleteRelayServiceConnection") + } + + req, err := client.DeleteRelayServiceConnectionPreparer(resourceGroupName, name, entityName) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "DeleteRelayServiceConnection", nil, "Failure preparing request") + } + + resp, err := client.DeleteRelayServiceConnectionSender(req) + if err != nil { + result.Response = resp + return result, autorest.NewErrorWithError(err, "web.AppsClient", "DeleteRelayServiceConnection", resp, "Failure sending request") + } + + result, err = client.DeleteRelayServiceConnectionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteRelayServiceConnection", resp, "Failure responding to request") + } + + return +} + +// DeleteRelayServiceConnectionPreparer prepares the DeleteRelayServiceConnection request. +func (client AppsClient) DeleteRelayServiceConnectionPreparer(resourceGroupName string, name string, entityName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "entityName": autorest.Encode("path", entityName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-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.Web/sites/{name}/hybridconnection/{entityName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DeleteRelayServiceConnectionSender sends the DeleteRelayServiceConnection request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) DeleteRelayServiceConnectionSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteRelayServiceConnectionResponder handles the response to the DeleteRelayServiceConnection request. The method always +// closes the http.Response Body. +func (client AppsClient) DeleteRelayServiceConnectionResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNotFound), + autorest.ByClosing()) + result.Response = resp + return +} + +// DeleteRelayServiceConnectionSlot deletes a relay service connection by its +// name. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. entityName is name of the hybrid +// connection configuration. slot is name of the deployment slot. If a slot is +// not specified, the API will delete a hybrid connection for the production +// slot. +func (client AppsClient) DeleteRelayServiceConnectionSlot(resourceGroupName string, name string, entityName string, slot string) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "DeleteRelayServiceConnectionSlot") + } + + req, err := client.DeleteRelayServiceConnectionSlotPreparer(resourceGroupName, name, entityName, slot) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "DeleteRelayServiceConnectionSlot", nil, "Failure preparing request") + } + + resp, err := client.DeleteRelayServiceConnectionSlotSender(req) + if err != nil { + result.Response = resp + return result, autorest.NewErrorWithError(err, "web.AppsClient", "DeleteRelayServiceConnectionSlot", resp, "Failure sending request") + } + + result, err = client.DeleteRelayServiceConnectionSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteRelayServiceConnectionSlot", resp, "Failure responding to request") + } + + return +} + +// DeleteRelayServiceConnectionSlotPreparer prepares the DeleteRelayServiceConnectionSlot request. +func (client AppsClient) DeleteRelayServiceConnectionSlotPreparer(resourceGroupName string, name string, entityName string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "entityName": autorest.Encode("path", entityName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-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.Web/sites/{name}/slots/{slot}/hybridconnection/{entityName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DeleteRelayServiceConnectionSlotSender sends the DeleteRelayServiceConnectionSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) DeleteRelayServiceConnectionSlotSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteRelayServiceConnectionSlotResponder handles the response to the DeleteRelayServiceConnectionSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) DeleteRelayServiceConnectionSlotResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNotFound), + autorest.ByClosing()) + result.Response = resp + return +} + +// DeleteSlot deletes a web, mobile, or API app, or one of the deployment +// slots. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app to delete. slot is name of the deployment +// slot to delete. By default, the API deletes the production slot. +// deleteMetrics is if true, web app metrics are also deleted +// deleteEmptyServerFarm is specify true if the App Service plan will be empty +// after app deletion and you want to delete the empty App Service plan. By +// default, the empty App Service plan is not deleted. skipDNSRegistration is +// if true, DNS registration is skipped +func (client AppsClient) DeleteSlot(resourceGroupName string, name string, slot string, deleteMetrics *bool, deleteEmptyServerFarm *bool, skipDNSRegistration *bool) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "DeleteSlot") + } + + req, err := client.DeleteSlotPreparer(resourceGroupName, name, slot, deleteMetrics, deleteEmptyServerFarm, skipDNSRegistration) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "DeleteSlot", nil, "Failure preparing request") + } + + resp, err := client.DeleteSlotSender(req) + if err != nil { + result.Response = resp + return result, autorest.NewErrorWithError(err, "web.AppsClient", "DeleteSlot", resp, "Failure sending request") + } + + result, err = client.DeleteSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteSlot", resp, "Failure responding to request") + } + + return +} + +// DeleteSlotPreparer prepares the DeleteSlot request. +func (client AppsClient) DeleteSlotPreparer(resourceGroupName string, name string, slot string, deleteMetrics *bool, deleteEmptyServerFarm *bool, skipDNSRegistration *bool) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if deleteMetrics != nil { + queryParameters["deleteMetrics"] = autorest.Encode("query", *deleteMetrics) + } + if deleteEmptyServerFarm != nil { + queryParameters["deleteEmptyServerFarm"] = autorest.Encode("query", *deleteEmptyServerFarm) + } + if skipDNSRegistration != nil { + queryParameters["skipDnsRegistration"] = autorest.Encode("query", *skipDNSRegistration) + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DeleteSlotSender sends the DeleteSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) DeleteSlotSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteSlotResponder handles the response to the DeleteSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) DeleteSlotResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNotFound), + autorest.ByClosing()) + result.Response = resp + return +} + +// DeleteSourceControl deletes the source control configuration of an app. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. +func (client AppsClient) DeleteSourceControl(resourceGroupName string, name string) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "DeleteSourceControl") + } + + req, err := client.DeleteSourceControlPreparer(resourceGroupName, name) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "DeleteSourceControl", nil, "Failure preparing request") + } + + resp, err := client.DeleteSourceControlSender(req) + if err != nil { + result.Response = resp + return result, autorest.NewErrorWithError(err, "web.AppsClient", "DeleteSourceControl", resp, "Failure sending request") + } + + result, err = client.DeleteSourceControlResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteSourceControl", resp, "Failure responding to request") + } + + return +} + +// DeleteSourceControlPreparer prepares the DeleteSourceControl request. +func (client AppsClient) DeleteSourceControlPreparer(resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-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.Web/sites/{name}/sourcecontrols/web", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DeleteSourceControlSender sends the DeleteSourceControl request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) DeleteSourceControlSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteSourceControlResponder handles the response to the DeleteSourceControl request. The method always +// closes the http.Response Body. +func (client AppsClient) DeleteSourceControlResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNotFound), + autorest.ByClosing()) + result.Response = resp + return +} + +// DeleteSourceControlSlot deletes the source control configuration of an app. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. slot is name of the deployment slot. If a +// slot is not specified, the API will delete the source control configuration +// for the production slot. +func (client AppsClient) DeleteSourceControlSlot(resourceGroupName string, name string, slot string) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "DeleteSourceControlSlot") + } + + req, err := client.DeleteSourceControlSlotPreparer(resourceGroupName, name, slot) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "DeleteSourceControlSlot", nil, "Failure preparing request") + } + + resp, err := client.DeleteSourceControlSlotSender(req) + if err != nil { + result.Response = resp + return result, autorest.NewErrorWithError(err, "web.AppsClient", "DeleteSourceControlSlot", resp, "Failure sending request") + } + + result, err = client.DeleteSourceControlSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteSourceControlSlot", resp, "Failure responding to request") + } + + return +} + +// DeleteSourceControlSlotPreparer prepares the DeleteSourceControlSlot request. +func (client AppsClient) DeleteSourceControlSlotPreparer(resourceGroupName string, name string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-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.Web/sites/{name}/slots/{slot}/sourcecontrols/web", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DeleteSourceControlSlotSender sends the DeleteSourceControlSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) DeleteSourceControlSlotSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteSourceControlSlotResponder handles the response to the DeleteSourceControlSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) DeleteSourceControlSlotResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNotFound), + autorest.ByClosing()) + result.Response = resp + return +} + +// DeleteVnetConnection deletes a connection from an app (or deployment slot to +// a named virtual network. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. vnetName is name of the virtual network. +func (client AppsClient) DeleteVnetConnection(resourceGroupName string, name string, vnetName string) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "DeleteVnetConnection") + } + + req, err := client.DeleteVnetConnectionPreparer(resourceGroupName, name, vnetName) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "DeleteVnetConnection", nil, "Failure preparing request") + } + + resp, err := client.DeleteVnetConnectionSender(req) + if err != nil { + result.Response = resp + return result, autorest.NewErrorWithError(err, "web.AppsClient", "DeleteVnetConnection", resp, "Failure sending request") + } + + result, err = client.DeleteVnetConnectionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteVnetConnection", resp, "Failure responding to request") + } + + return +} + +// DeleteVnetConnectionPreparer prepares the DeleteVnetConnection request. +func (client AppsClient) DeleteVnetConnectionPreparer(resourceGroupName string, name string, vnetName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vnetName": autorest.Encode("path", vnetName), + } + + const APIVersion = "2016-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.Web/sites/{name}/virtualNetworkConnections/{vnetName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DeleteVnetConnectionSender sends the DeleteVnetConnection request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) DeleteVnetConnectionSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteVnetConnectionResponder handles the response to the DeleteVnetConnection request. The method always +// closes the http.Response Body. +func (client AppsClient) DeleteVnetConnectionResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNotFound), + autorest.ByClosing()) + result.Response = resp + return +} + +// DeleteVnetConnectionSlot deletes a connection from an app (or deployment +// slot to a named virtual network. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. vnetName is name of the virtual network. +// slot is name of the deployment slot. If a slot is not specified, the API +// will delete the connection for the production slot. +func (client AppsClient) DeleteVnetConnectionSlot(resourceGroupName string, name string, vnetName string, slot string) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "DeleteVnetConnectionSlot") + } + + req, err := client.DeleteVnetConnectionSlotPreparer(resourceGroupName, name, vnetName, slot) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "DeleteVnetConnectionSlot", nil, "Failure preparing request") + } + + resp, err := client.DeleteVnetConnectionSlotSender(req) + if err != nil { + result.Response = resp + return result, autorest.NewErrorWithError(err, "web.AppsClient", "DeleteVnetConnectionSlot", resp, "Failure sending request") + } + + result, err = client.DeleteVnetConnectionSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteVnetConnectionSlot", resp, "Failure responding to request") + } + + return +} + +// DeleteVnetConnectionSlotPreparer prepares the DeleteVnetConnectionSlot request. +func (client AppsClient) DeleteVnetConnectionSlotPreparer(resourceGroupName string, name string, vnetName string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vnetName": autorest.Encode("path", vnetName), + } + + const APIVersion = "2016-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.Web/sites/{name}/slots/{slot}/virtualNetworkConnections/{vnetName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DeleteVnetConnectionSlotSender sends the DeleteVnetConnectionSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) DeleteVnetConnectionSlotSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteVnetConnectionSlotResponder handles the response to the DeleteVnetConnectionSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) DeleteVnetConnectionSlotResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNotFound), + autorest.ByClosing()) + result.Response = resp + return +} + +// DiscoverRestore discovers an existing app backup that can be restored from a +// blob in Azure storage. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. request is a RestoreRequest object that +// includes Azure storage URL and blog name for discovery of backup. +func (client AppsClient) DiscoverRestore(resourceGroupName string, name string, request RestoreRequest) (result RestoreRequest, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "DiscoverRestore") + } + + req, err := client.DiscoverRestorePreparer(resourceGroupName, name, request) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "DiscoverRestore", nil, "Failure preparing request") + } + + resp, err := client.DiscoverRestoreSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "DiscoverRestore", resp, "Failure sending request") + } + + result, err = client.DiscoverRestoreResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "DiscoverRestore", resp, "Failure responding to request") + } + + return +} + +// DiscoverRestorePreparer prepares the DiscoverRestore request. +func (client AppsClient) DiscoverRestorePreparer(resourceGroupName string, name string, request RestoreRequest) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/backups/discover", pathParameters), + autorest.WithJSON(request), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DiscoverRestoreSender sends the DiscoverRestore request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) DiscoverRestoreSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DiscoverRestoreResponder handles the response to the DiscoverRestore request. The method always +// closes the http.Response Body. +func (client AppsClient) DiscoverRestoreResponder(resp *http.Response) (result RestoreRequest, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// DiscoverRestoreSlot discovers an existing app backup that can be restored +// from a blob in Azure storage. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. request is a RestoreRequest object that +// includes Azure storage URL and blog name for discovery of backup. slot is +// name of the deployment slot. If a slot is not specified, the API will +// perform discovery for the production slot. +func (client AppsClient) DiscoverRestoreSlot(resourceGroupName string, name string, request RestoreRequest, slot string) (result RestoreRequest, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "DiscoverRestoreSlot") + } + + req, err := client.DiscoverRestoreSlotPreparer(resourceGroupName, name, request, slot) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "DiscoverRestoreSlot", nil, "Failure preparing request") + } + + resp, err := client.DiscoverRestoreSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "DiscoverRestoreSlot", resp, "Failure sending request") + } + + result, err = client.DiscoverRestoreSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "DiscoverRestoreSlot", resp, "Failure responding to request") + } + + return +} + +// DiscoverRestoreSlotPreparer prepares the DiscoverRestoreSlot request. +func (client AppsClient) DiscoverRestoreSlotPreparer(resourceGroupName string, name string, request RestoreRequest, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/backups/discover", pathParameters), + autorest.WithJSON(request), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DiscoverRestoreSlotSender sends the DiscoverRestoreSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) DiscoverRestoreSlotSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DiscoverRestoreSlotResponder handles the response to the DiscoverRestoreSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) DiscoverRestoreSlotResponder(resp *http.Response) (result RestoreRequest, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GenerateNewSitePublishingPassword generates a new publishing password for an +// app (or deployment slot, if specified). +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. +func (client AppsClient) GenerateNewSitePublishingPassword(resourceGroupName string, name string) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "GenerateNewSitePublishingPassword") + } + + req, err := client.GenerateNewSitePublishingPasswordPreparer(resourceGroupName, name) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "GenerateNewSitePublishingPassword", nil, "Failure preparing request") + } + + resp, err := client.GenerateNewSitePublishingPasswordSender(req) + if err != nil { + result.Response = resp + return result, autorest.NewErrorWithError(err, "web.AppsClient", "GenerateNewSitePublishingPassword", resp, "Failure sending request") + } + + result, err = client.GenerateNewSitePublishingPasswordResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GenerateNewSitePublishingPassword", resp, "Failure responding to request") + } + + return +} + +// GenerateNewSitePublishingPasswordPreparer prepares the GenerateNewSitePublishingPassword request. +func (client AppsClient) GenerateNewSitePublishingPasswordPreparer(resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-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.Web/sites/{name}/newpassword", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GenerateNewSitePublishingPasswordSender sends the GenerateNewSitePublishingPassword request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) GenerateNewSitePublishingPasswordSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GenerateNewSitePublishingPasswordResponder handles the response to the GenerateNewSitePublishingPassword request. The method always +// closes the http.Response Body. +func (client AppsClient) GenerateNewSitePublishingPasswordResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// GenerateNewSitePublishingPasswordSlot generates a new publishing password +// for an app (or deployment slot, if specified). +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. slot is name of the deployment slot. If a +// slot is not specified, the API generate a new publishing password for the +// production slot. +func (client AppsClient) GenerateNewSitePublishingPasswordSlot(resourceGroupName string, name string, slot string) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "GenerateNewSitePublishingPasswordSlot") + } + + req, err := client.GenerateNewSitePublishingPasswordSlotPreparer(resourceGroupName, name, slot) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "GenerateNewSitePublishingPasswordSlot", nil, "Failure preparing request") + } + + resp, err := client.GenerateNewSitePublishingPasswordSlotSender(req) + if err != nil { + result.Response = resp + return result, autorest.NewErrorWithError(err, "web.AppsClient", "GenerateNewSitePublishingPasswordSlot", resp, "Failure sending request") + } + + result, err = client.GenerateNewSitePublishingPasswordSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GenerateNewSitePublishingPasswordSlot", resp, "Failure responding to request") + } + + return +} + +// GenerateNewSitePublishingPasswordSlotPreparer prepares the GenerateNewSitePublishingPasswordSlot request. +func (client AppsClient) GenerateNewSitePublishingPasswordSlotPreparer(resourceGroupName string, name string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-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.Web/sites/{name}/slots/{slot}/newpassword", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GenerateNewSitePublishingPasswordSlotSender sends the GenerateNewSitePublishingPasswordSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) GenerateNewSitePublishingPasswordSlotSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GenerateNewSitePublishingPasswordSlotResponder handles the response to the GenerateNewSitePublishingPasswordSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) GenerateNewSitePublishingPasswordSlotResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets the details of a web, mobile, or API app. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. +func (client AppsClient) Get(resourceGroupName string, name string) (result Site, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "Get") + } + + req, err := client.GetPreparer(resourceGroupName, name) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "Get", nil, "Failure preparing request") + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "Get", resp, "Failure sending request") + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client AppsClient) GetPreparer(resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-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.Web/sites/{name}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client AppsClient) GetResponder(resp *http.Response) (result Site, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetAuthSettings gets the Authentication/Authorization settings of an app. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. +func (client AppsClient) GetAuthSettings(resourceGroupName string, name string) (result SiteAuthSettings, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "GetAuthSettings") + } + + req, err := client.GetAuthSettingsPreparer(resourceGroupName, name) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "GetAuthSettings", nil, "Failure preparing request") + } + + resp, err := client.GetAuthSettingsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "GetAuthSettings", resp, "Failure sending request") + } + + result, err = client.GetAuthSettingsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetAuthSettings", resp, "Failure responding to request") + } + + return +} + +// GetAuthSettingsPreparer prepares the GetAuthSettings request. +func (client AppsClient) GetAuthSettingsPreparer(resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-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.Web/sites/{name}/config/authsettings/list", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetAuthSettingsSender sends the GetAuthSettings request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) GetAuthSettingsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetAuthSettingsResponder handles the response to the GetAuthSettings request. The method always +// closes the http.Response Body. +func (client AppsClient) GetAuthSettingsResponder(resp *http.Response) (result SiteAuthSettings, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetAuthSettingsSlot gets the Authentication/Authorization settings of an +// app. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. slot is name of the deployment slot. If a +// slot is not specified, the API will get the settings for the production +// slot. +func (client AppsClient) GetAuthSettingsSlot(resourceGroupName string, name string, slot string) (result SiteAuthSettings, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "GetAuthSettingsSlot") + } + + req, err := client.GetAuthSettingsSlotPreparer(resourceGroupName, name, slot) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "GetAuthSettingsSlot", nil, "Failure preparing request") + } + + resp, err := client.GetAuthSettingsSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "GetAuthSettingsSlot", resp, "Failure sending request") + } + + result, err = client.GetAuthSettingsSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetAuthSettingsSlot", resp, "Failure responding to request") + } + + return +} + +// GetAuthSettingsSlotPreparer prepares the GetAuthSettingsSlot request. +func (client AppsClient) GetAuthSettingsSlotPreparer(resourceGroupName string, name string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-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.Web/sites/{name}/slots/{slot}/config/authsettings/list", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetAuthSettingsSlotSender sends the GetAuthSettingsSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) GetAuthSettingsSlotSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetAuthSettingsSlotResponder handles the response to the GetAuthSettingsSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) GetAuthSettingsSlotResponder(resp *http.Response) (result SiteAuthSettings, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetBackupConfiguration gets the backup configuration of an app. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. +func (client AppsClient) GetBackupConfiguration(resourceGroupName string, name string) (result BackupRequest, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "GetBackupConfiguration") + } + + req, err := client.GetBackupConfigurationPreparer(resourceGroupName, name) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "GetBackupConfiguration", nil, "Failure preparing request") + } + + resp, err := client.GetBackupConfigurationSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "GetBackupConfiguration", resp, "Failure sending request") + } + + result, err = client.GetBackupConfigurationResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetBackupConfiguration", resp, "Failure responding to request") + } + + return +} + +// GetBackupConfigurationPreparer prepares the GetBackupConfiguration request. +func (client AppsClient) GetBackupConfigurationPreparer(resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-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.Web/sites/{name}/config/backup/list", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetBackupConfigurationSender sends the GetBackupConfiguration request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) GetBackupConfigurationSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetBackupConfigurationResponder handles the response to the GetBackupConfiguration request. The method always +// closes the http.Response Body. +func (client AppsClient) GetBackupConfigurationResponder(resp *http.Response) (result BackupRequest, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetBackupConfigurationSlot gets the backup configuration of an app. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. slot is name of the deployment slot. If a +// slot is not specified, the API will get the backup configuration for the +// production slot. +func (client AppsClient) GetBackupConfigurationSlot(resourceGroupName string, name string, slot string) (result BackupRequest, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "GetBackupConfigurationSlot") + } + + req, err := client.GetBackupConfigurationSlotPreparer(resourceGroupName, name, slot) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "GetBackupConfigurationSlot", nil, "Failure preparing request") + } + + resp, err := client.GetBackupConfigurationSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "GetBackupConfigurationSlot", resp, "Failure sending request") + } + + result, err = client.GetBackupConfigurationSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetBackupConfigurationSlot", resp, "Failure responding to request") + } + + return +} + +// GetBackupConfigurationSlotPreparer prepares the GetBackupConfigurationSlot request. +func (client AppsClient) GetBackupConfigurationSlotPreparer(resourceGroupName string, name string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-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.Web/sites/{name}/slots/{slot}/config/backup/list", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetBackupConfigurationSlotSender sends the GetBackupConfigurationSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) GetBackupConfigurationSlotSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetBackupConfigurationSlotResponder handles the response to the GetBackupConfigurationSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) GetBackupConfigurationSlotResponder(resp *http.Response) (result BackupRequest, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetBackupStatus gets a backup of an app by its ID. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. backupID is iD of the backup. +func (client AppsClient) GetBackupStatus(resourceGroupName string, name string, backupID string) (result BackupItem, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "GetBackupStatus") + } + + req, err := client.GetBackupStatusPreparer(resourceGroupName, name, backupID) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "GetBackupStatus", nil, "Failure preparing request") + } + + resp, err := client.GetBackupStatusSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "GetBackupStatus", resp, "Failure sending request") + } + + result, err = client.GetBackupStatusResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetBackupStatus", resp, "Failure responding to request") + } + + return +} + +// GetBackupStatusPreparer prepares the GetBackupStatus request. +func (client AppsClient) GetBackupStatusPreparer(resourceGroupName string, name string, backupID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "backupId": autorest.Encode("path", backupID), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-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.Web/sites/{name}/backups/{backupId}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetBackupStatusSender sends the GetBackupStatus request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) GetBackupStatusSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetBackupStatusResponder handles the response to the GetBackupStatus request. The method always +// closes the http.Response Body. +func (client AppsClient) GetBackupStatusResponder(resp *http.Response) (result BackupItem, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetBackupStatusSlot gets a backup of an app by its ID. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. backupID is iD of the backup. slot is name +// of the deployment slot. If a slot is not specified, the API will get a +// backup of the production slot. +func (client AppsClient) GetBackupStatusSlot(resourceGroupName string, name string, backupID string, slot string) (result BackupItem, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "GetBackupStatusSlot") + } + + req, err := client.GetBackupStatusSlotPreparer(resourceGroupName, name, backupID, slot) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "GetBackupStatusSlot", nil, "Failure preparing request") + } + + resp, err := client.GetBackupStatusSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "GetBackupStatusSlot", resp, "Failure sending request") + } + + result, err = client.GetBackupStatusSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetBackupStatusSlot", resp, "Failure responding to request") + } + + return +} + +// GetBackupStatusSlotPreparer prepares the GetBackupStatusSlot request. +func (client AppsClient) GetBackupStatusSlotPreparer(resourceGroupName string, name string, backupID string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "backupId": autorest.Encode("path", backupID), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-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.Web/sites/{name}/slots/{slot}/backups/{backupId}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetBackupStatusSlotSender sends the GetBackupStatusSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) GetBackupStatusSlotSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetBackupStatusSlotResponder handles the response to the GetBackupStatusSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) GetBackupStatusSlotResponder(resp *http.Response) (result BackupItem, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetConfiguration gets the configuration of an app, such as platform version +// and bitness, default documents, virtual applications, Always On, etc. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. +func (client AppsClient) GetConfiguration(resourceGroupName string, name string) (result SiteConfigResource, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "GetConfiguration") + } + + req, err := client.GetConfigurationPreparer(resourceGroupName, name) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "GetConfiguration", nil, "Failure preparing request") + } + + resp, err := client.GetConfigurationSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "GetConfiguration", resp, "Failure sending request") + } + + result, err = client.GetConfigurationResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetConfiguration", resp, "Failure responding to request") + } + + return +} + +// GetConfigurationPreparer prepares the GetConfiguration request. +func (client AppsClient) GetConfigurationPreparer(resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-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.Web/sites/{name}/config/web", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetConfigurationSender sends the GetConfiguration request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) GetConfigurationSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetConfigurationResponder handles the response to the GetConfiguration request. The method always +// closes the http.Response Body. +func (client AppsClient) GetConfigurationResponder(resp *http.Response) (result SiteConfigResource, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetConfigurationSlot gets the configuration of an app, such as platform +// version and bitness, default documents, virtual applications, Always On, +// etc. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. slot is name of the deployment slot. If a +// slot is not specified, the API will return configuration for the production +// slot. +func (client AppsClient) GetConfigurationSlot(resourceGroupName string, name string, slot string) (result SiteConfigResource, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "GetConfigurationSlot") + } + + req, err := client.GetConfigurationSlotPreparer(resourceGroupName, name, slot) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "GetConfigurationSlot", nil, "Failure preparing request") + } + + resp, err := client.GetConfigurationSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "GetConfigurationSlot", resp, "Failure sending request") + } + + result, err = client.GetConfigurationSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetConfigurationSlot", resp, "Failure responding to request") + } + + return +} + +// GetConfigurationSlotPreparer prepares the GetConfigurationSlot request. +func (client AppsClient) GetConfigurationSlotPreparer(resourceGroupName string, name string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-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.Web/sites/{name}/slots/{slot}/config/web", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetConfigurationSlotSender sends the GetConfigurationSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) GetConfigurationSlotSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetConfigurationSlotResponder handles the response to the GetConfigurationSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) GetConfigurationSlotResponder(resp *http.Response) (result SiteConfigResource, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetConfigurationSnapshot gets a snapshot of the configuration of an app at a +// previous point in time. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. snapshotID is the ID of the snapshot to +// read. +func (client AppsClient) GetConfigurationSnapshot(resourceGroupName string, name string, snapshotID string) (result SiteConfigResource, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "GetConfigurationSnapshot") + } + + req, err := client.GetConfigurationSnapshotPreparer(resourceGroupName, name, snapshotID) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "GetConfigurationSnapshot", nil, "Failure preparing request") + } + + resp, err := client.GetConfigurationSnapshotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "GetConfigurationSnapshot", resp, "Failure sending request") + } + + result, err = client.GetConfigurationSnapshotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetConfigurationSnapshot", resp, "Failure responding to request") + } + + return +} + +// GetConfigurationSnapshotPreparer prepares the GetConfigurationSnapshot request. +func (client AppsClient) GetConfigurationSnapshotPreparer(resourceGroupName string, name string, snapshotID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "snapshotId": autorest.Encode("path", snapshotID), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-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.Web/sites/{name}/config/web/snapshots/{snapshotId}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetConfigurationSnapshotSender sends the GetConfigurationSnapshot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) GetConfigurationSnapshotSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetConfigurationSnapshotResponder handles the response to the GetConfigurationSnapshot request. The method always +// closes the http.Response Body. +func (client AppsClient) GetConfigurationSnapshotResponder(resp *http.Response) (result SiteConfigResource, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetConfigurationSnapshotSlot gets a snapshot of the configuration of an app +// at a previous point in time. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. snapshotID is the ID of the snapshot to +// read. slot is name of the deployment slot. If a slot is not specified, the +// API will return configuration for the production slot. +func (client AppsClient) GetConfigurationSnapshotSlot(resourceGroupName string, name string, snapshotID string, slot string) (result SiteConfigResource, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "GetConfigurationSnapshotSlot") + } + + req, err := client.GetConfigurationSnapshotSlotPreparer(resourceGroupName, name, snapshotID, slot) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "GetConfigurationSnapshotSlot", nil, "Failure preparing request") + } + + resp, err := client.GetConfigurationSnapshotSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "GetConfigurationSnapshotSlot", resp, "Failure sending request") + } + + result, err = client.GetConfigurationSnapshotSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetConfigurationSnapshotSlot", resp, "Failure responding to request") + } + + return +} + +// GetConfigurationSnapshotSlotPreparer prepares the GetConfigurationSnapshotSlot request. +func (client AppsClient) GetConfigurationSnapshotSlotPreparer(resourceGroupName string, name string, snapshotID string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "snapshotId": autorest.Encode("path", snapshotID), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-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.Web/sites/{name}/slots/{slot}/config/web/snapshots/{snapshotId}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetConfigurationSnapshotSlotSender sends the GetConfigurationSnapshotSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) GetConfigurationSnapshotSlotSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetConfigurationSnapshotSlotResponder handles the response to the GetConfigurationSnapshotSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) GetConfigurationSnapshotSlotResponder(resp *http.Response) (result SiteConfigResource, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetDeployment get a deployment by its ID for an app, a specific deployment +// slot, and/or a specific scaled-out instance. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. id is deployment ID. +func (client AppsClient) GetDeployment(resourceGroupName string, name string, id string) (result Deployment, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "GetDeployment") + } + + req, err := client.GetDeploymentPreparer(resourceGroupName, name, id) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "GetDeployment", nil, "Failure preparing request") + } + + resp, err := client.GetDeploymentSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "GetDeployment", resp, "Failure sending request") + } + + result, err = client.GetDeploymentResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetDeployment", resp, "Failure responding to request") + } + + return +} + +// GetDeploymentPreparer prepares the GetDeployment request. +func (client AppsClient) GetDeploymentPreparer(resourceGroupName string, name string, id string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "id": autorest.Encode("path", id), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-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.Web/sites/{name}/deployments/{id}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetDeploymentSender sends the GetDeployment request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) GetDeploymentSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetDeploymentResponder handles the response to the GetDeployment request. The method always +// closes the http.Response Body. +func (client AppsClient) GetDeploymentResponder(resp *http.Response) (result Deployment, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetDeploymentSlot get a deployment by its ID for an app, a specific +// deployment slot, and/or a specific scaled-out instance. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. id is deployment ID. slot is name of the +// deployment slot. If a slot is not specified, the API gets a deployment for +// the production slot. +func (client AppsClient) GetDeploymentSlot(resourceGroupName string, name string, id string, slot string) (result Deployment, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "GetDeploymentSlot") + } + + req, err := client.GetDeploymentSlotPreparer(resourceGroupName, name, id, slot) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "GetDeploymentSlot", nil, "Failure preparing request") + } + + resp, err := client.GetDeploymentSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "GetDeploymentSlot", resp, "Failure sending request") + } + + result, err = client.GetDeploymentSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetDeploymentSlot", resp, "Failure responding to request") + } + + return +} + +// GetDeploymentSlotPreparer prepares the GetDeploymentSlot request. +func (client AppsClient) GetDeploymentSlotPreparer(resourceGroupName string, name string, id string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "id": autorest.Encode("path", id), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-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.Web/sites/{name}/slots/{slot}/deployments/{id}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetDeploymentSlotSender sends the GetDeploymentSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) GetDeploymentSlotSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetDeploymentSlotResponder handles the response to the GetDeploymentSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) GetDeploymentSlotResponder(resp *http.Response) (result Deployment, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetDiagnosticLogsConfiguration gets the logging configuration of an app. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. +func (client AppsClient) GetDiagnosticLogsConfiguration(resourceGroupName string, name string) (result SiteLogsConfig, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "GetDiagnosticLogsConfiguration") + } + + req, err := client.GetDiagnosticLogsConfigurationPreparer(resourceGroupName, name) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "GetDiagnosticLogsConfiguration", nil, "Failure preparing request") + } + + resp, err := client.GetDiagnosticLogsConfigurationSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "GetDiagnosticLogsConfiguration", resp, "Failure sending request") + } + + result, err = client.GetDiagnosticLogsConfigurationResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetDiagnosticLogsConfiguration", resp, "Failure responding to request") + } + + return +} + +// GetDiagnosticLogsConfigurationPreparer prepares the GetDiagnosticLogsConfiguration request. +func (client AppsClient) GetDiagnosticLogsConfigurationPreparer(resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-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.Web/sites/{name}/config/logs", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetDiagnosticLogsConfigurationSender sends the GetDiagnosticLogsConfiguration request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) GetDiagnosticLogsConfigurationSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetDiagnosticLogsConfigurationResponder handles the response to the GetDiagnosticLogsConfiguration request. The method always +// closes the http.Response Body. +func (client AppsClient) GetDiagnosticLogsConfigurationResponder(resp *http.Response) (result SiteLogsConfig, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetDiagnosticLogsConfigurationSlot gets the logging configuration of an app. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. slot is name of the deployment slot. If a +// slot is not specified, the API will get the logging configuration for the +// production slot. +func (client AppsClient) GetDiagnosticLogsConfigurationSlot(resourceGroupName string, name string, slot string) (result SiteLogsConfig, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "GetDiagnosticLogsConfigurationSlot") + } + + req, err := client.GetDiagnosticLogsConfigurationSlotPreparer(resourceGroupName, name, slot) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "GetDiagnosticLogsConfigurationSlot", nil, "Failure preparing request") + } + + resp, err := client.GetDiagnosticLogsConfigurationSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "GetDiagnosticLogsConfigurationSlot", resp, "Failure sending request") + } + + result, err = client.GetDiagnosticLogsConfigurationSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetDiagnosticLogsConfigurationSlot", resp, "Failure responding to request") + } + + return +} + +// GetDiagnosticLogsConfigurationSlotPreparer prepares the GetDiagnosticLogsConfigurationSlot request. +func (client AppsClient) GetDiagnosticLogsConfigurationSlotPreparer(resourceGroupName string, name string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-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.Web/sites/{name}/slots/{slot}/config/logs", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetDiagnosticLogsConfigurationSlotSender sends the GetDiagnosticLogsConfigurationSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) GetDiagnosticLogsConfigurationSlotSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetDiagnosticLogsConfigurationSlotResponder handles the response to the GetDiagnosticLogsConfigurationSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) GetDiagnosticLogsConfigurationSlotResponder(resp *http.Response) (result SiteLogsConfig, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetDomainOwnershipIdentifier get domain ownership identifier for web app. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. domainOwnershipIdentifierName is name of +// domain ownership identifier. +func (client AppsClient) GetDomainOwnershipIdentifier(resourceGroupName string, name string, domainOwnershipIdentifierName string) (result Identifier, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "GetDomainOwnershipIdentifier") + } + + req, err := client.GetDomainOwnershipIdentifierPreparer(resourceGroupName, name, domainOwnershipIdentifierName) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "GetDomainOwnershipIdentifier", nil, "Failure preparing request") + } + + resp, err := client.GetDomainOwnershipIdentifierSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "GetDomainOwnershipIdentifier", resp, "Failure sending request") + } + + result, err = client.GetDomainOwnershipIdentifierResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetDomainOwnershipIdentifier", resp, "Failure responding to request") + } + + return +} + +// GetDomainOwnershipIdentifierPreparer prepares the GetDomainOwnershipIdentifier request. +func (client AppsClient) GetDomainOwnershipIdentifierPreparer(resourceGroupName string, name string, domainOwnershipIdentifierName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "domainOwnershipIdentifierName": autorest.Encode("path", domainOwnershipIdentifierName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-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.Web/sites/{name}/domainOwnershipIdentifiers/{domainOwnershipIdentifierName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetDomainOwnershipIdentifierSender sends the GetDomainOwnershipIdentifier request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) GetDomainOwnershipIdentifierSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetDomainOwnershipIdentifierResponder handles the response to the GetDomainOwnershipIdentifier request. The method always +// closes the http.Response Body. +func (client AppsClient) GetDomainOwnershipIdentifierResponder(resp *http.Response) (result Identifier, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetDomainOwnershipIdentifierSlot get domain ownership identifier for web +// app. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. domainOwnershipIdentifierName is name of +// domain ownership identifier. slot is name of the deployment slot. If a slot +// is not specified, the API will delete the binding for the production slot. +func (client AppsClient) GetDomainOwnershipIdentifierSlot(resourceGroupName string, name string, domainOwnershipIdentifierName string, slot string) (result Identifier, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "GetDomainOwnershipIdentifierSlot") + } + + req, err := client.GetDomainOwnershipIdentifierSlotPreparer(resourceGroupName, name, domainOwnershipIdentifierName, slot) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "GetDomainOwnershipIdentifierSlot", nil, "Failure preparing request") + } + + resp, err := client.GetDomainOwnershipIdentifierSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "GetDomainOwnershipIdentifierSlot", resp, "Failure sending request") + } + + result, err = client.GetDomainOwnershipIdentifierSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetDomainOwnershipIdentifierSlot", resp, "Failure responding to request") + } + + return +} + +// GetDomainOwnershipIdentifierSlotPreparer prepares the GetDomainOwnershipIdentifierSlot request. +func (client AppsClient) GetDomainOwnershipIdentifierSlotPreparer(resourceGroupName string, name string, domainOwnershipIdentifierName string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "domainOwnershipIdentifierName": autorest.Encode("path", domainOwnershipIdentifierName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-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.Web/sites/{name}/slots/{slot}/domainOwnershipIdentifiers/{domainOwnershipIdentifierName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetDomainOwnershipIdentifierSlotSender sends the GetDomainOwnershipIdentifierSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) GetDomainOwnershipIdentifierSlotSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetDomainOwnershipIdentifierSlotResponder handles the response to the GetDomainOwnershipIdentifierSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) GetDomainOwnershipIdentifierSlotResponder(resp *http.Response) (result Identifier, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetHostNameBinding get the named hostname binding for an app (or deployment +// slot, if specified). +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. hostName is hostname in the hostname +// binding. +func (client AppsClient) GetHostNameBinding(resourceGroupName string, name string, hostName string) (result HostNameBinding, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "GetHostNameBinding") + } + + req, err := client.GetHostNameBindingPreparer(resourceGroupName, name, hostName) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "GetHostNameBinding", nil, "Failure preparing request") + } + + resp, err := client.GetHostNameBindingSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "GetHostNameBinding", resp, "Failure sending request") + } + + result, err = client.GetHostNameBindingResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetHostNameBinding", resp, "Failure responding to request") + } + + return +} + +// GetHostNameBindingPreparer prepares the GetHostNameBinding request. +func (client AppsClient) GetHostNameBindingPreparer(resourceGroupName string, name string, hostName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "hostName": autorest.Encode("path", hostName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-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.Web/sites/{name}/hostNameBindings/{hostName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetHostNameBindingSender sends the GetHostNameBinding request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) GetHostNameBindingSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetHostNameBindingResponder handles the response to the GetHostNameBinding request. The method always +// closes the http.Response Body. +func (client AppsClient) GetHostNameBindingResponder(resp *http.Response) (result HostNameBinding, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetHostNameBindingSlot get the named hostname binding for an app (or +// deployment slot, if specified). +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. slot is name of the deployment slot. If a +// slot is not specified, the API the named binding for the production slot. +// hostName is hostname in the hostname binding. +func (client AppsClient) GetHostNameBindingSlot(resourceGroupName string, name string, slot string, hostName string) (result HostNameBinding, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "GetHostNameBindingSlot") + } + + req, err := client.GetHostNameBindingSlotPreparer(resourceGroupName, name, slot, hostName) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "GetHostNameBindingSlot", nil, "Failure preparing request") + } + + resp, err := client.GetHostNameBindingSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "GetHostNameBindingSlot", resp, "Failure sending request") + } + + result, err = client.GetHostNameBindingSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetHostNameBindingSlot", resp, "Failure responding to request") + } + + return +} + +// GetHostNameBindingSlotPreparer prepares the GetHostNameBindingSlot request. +func (client AppsClient) GetHostNameBindingSlotPreparer(resourceGroupName string, name string, slot string, hostName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "hostName": autorest.Encode("path", hostName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-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.Web/sites/{name}/slots/{slot}/hostNameBindings/{hostName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetHostNameBindingSlotSender sends the GetHostNameBindingSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) GetHostNameBindingSlotSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetHostNameBindingSlotResponder handles the response to the GetHostNameBindingSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) GetHostNameBindingSlotResponder(resp *http.Response) (result HostNameBinding, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetHybridConnection retrieves a specific Service Bus Hybrid Connection used +// by this Web App. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is the name of the web app namespaceName is the namespace for +// this hybrid connection relayName is the relay name for this hybrid +// connection +func (client AppsClient) GetHybridConnection(resourceGroupName string, name string, namespaceName string, relayName string) (result HybridConnection, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "GetHybridConnection") + } + + req, err := client.GetHybridConnectionPreparer(resourceGroupName, name, namespaceName, relayName) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "GetHybridConnection", nil, "Failure preparing request") + } + + resp, err := client.GetHybridConnectionSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "GetHybridConnection", resp, "Failure sending request") + } + + result, err = client.GetHybridConnectionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetHybridConnection", resp, "Failure responding to request") + } + + return +} + +// GetHybridConnectionPreparer prepares the GetHybridConnection request. +func (client AppsClient) GetHybridConnectionPreparer(resourceGroupName string, name string, namespaceName string, relayName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "namespaceName": autorest.Encode("path", namespaceName), + "relayName": autorest.Encode("path", relayName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-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.Web/sites/{name}/hybridConnectionNamespaces/{namespaceName}/relays/{relayName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetHybridConnectionSender sends the GetHybridConnection request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) GetHybridConnectionSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetHybridConnectionResponder handles the response to the GetHybridConnection request. The method always +// closes the http.Response Body. +func (client AppsClient) GetHybridConnectionResponder(resp *http.Response) (result HybridConnection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetHybridConnectionSlot retrieves a specific Service Bus Hybrid Connection +// used by this Web App. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is the name of the web app namespaceName is the namespace for +// this hybrid connection relayName is the relay name for this hybrid +// connection slot is the name of the slot for the web app. +func (client AppsClient) GetHybridConnectionSlot(resourceGroupName string, name string, namespaceName string, relayName string, slot string) (result HybridConnection, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "GetHybridConnectionSlot") + } + + req, err := client.GetHybridConnectionSlotPreparer(resourceGroupName, name, namespaceName, relayName, slot) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "GetHybridConnectionSlot", nil, "Failure preparing request") + } + + resp, err := client.GetHybridConnectionSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "GetHybridConnectionSlot", resp, "Failure sending request") + } + + result, err = client.GetHybridConnectionSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetHybridConnectionSlot", resp, "Failure responding to request") + } + + return +} + +// GetHybridConnectionSlotPreparer prepares the GetHybridConnectionSlot request. +func (client AppsClient) GetHybridConnectionSlotPreparer(resourceGroupName string, name string, namespaceName string, relayName string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "namespaceName": autorest.Encode("path", namespaceName), + "relayName": autorest.Encode("path", relayName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-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.Web/sites/{name}/slots/{slot}/hybridConnectionNamespaces/{namespaceName}/relays/{relayName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetHybridConnectionSlotSender sends the GetHybridConnectionSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) GetHybridConnectionSlotSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetHybridConnectionSlotResponder handles the response to the GetHybridConnectionSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) GetHybridConnectionSlotResponder(resp *http.Response) (result HybridConnection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetInstanceDeployment get a deployment by its ID for an app, a specific +// deployment slot, and/or a specific scaled-out instance. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. id is deployment ID. instanceID is iD of a +// specific scaled-out instance. This is the value of the name property in the +// JSON response from "GET api/sites/{siteName}/instances" +func (client AppsClient) GetInstanceDeployment(resourceGroupName string, name string, id string, instanceID string) (result Deployment, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "GetInstanceDeployment") + } + + req, err := client.GetInstanceDeploymentPreparer(resourceGroupName, name, id, instanceID) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "GetInstanceDeployment", nil, "Failure preparing request") + } + + resp, err := client.GetInstanceDeploymentSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "GetInstanceDeployment", resp, "Failure sending request") + } + + result, err = client.GetInstanceDeploymentResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetInstanceDeployment", resp, "Failure responding to request") + } + + return +} + +// GetInstanceDeploymentPreparer prepares the GetInstanceDeployment request. +func (client AppsClient) GetInstanceDeploymentPreparer(resourceGroupName string, name string, id string, instanceID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "id": autorest.Encode("path", id), + "instanceId": autorest.Encode("path", instanceID), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-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.Web/sites/{name}/instances/{instanceId}/deployments/{id}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetInstanceDeploymentSender sends the GetInstanceDeployment request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) GetInstanceDeploymentSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetInstanceDeploymentResponder handles the response to the GetInstanceDeployment request. The method always +// closes the http.Response Body. +func (client AppsClient) GetInstanceDeploymentResponder(resp *http.Response) (result Deployment, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetInstanceDeploymentSlot get a deployment by its ID for an app, a specific +// deployment slot, and/or a specific scaled-out instance. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. id is deployment ID. slot is name of the +// deployment slot. If a slot is not specified, the API gets a deployment for +// the production slot. instanceID is iD of a specific scaled-out instance. +// This is the value of the name property in the JSON response from "GET +// api/sites/{siteName}/instances" +func (client AppsClient) GetInstanceDeploymentSlot(resourceGroupName string, name string, id string, slot string, instanceID string) (result Deployment, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "GetInstanceDeploymentSlot") + } + + req, err := client.GetInstanceDeploymentSlotPreparer(resourceGroupName, name, id, slot, instanceID) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "GetInstanceDeploymentSlot", nil, "Failure preparing request") + } + + resp, err := client.GetInstanceDeploymentSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "GetInstanceDeploymentSlot", resp, "Failure sending request") + } + + result, err = client.GetInstanceDeploymentSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetInstanceDeploymentSlot", resp, "Failure responding to request") + } + + return +} + +// GetInstanceDeploymentSlotPreparer prepares the GetInstanceDeploymentSlot request. +func (client AppsClient) GetInstanceDeploymentSlotPreparer(resourceGroupName string, name string, id string, slot string, instanceID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "id": autorest.Encode("path", id), + "instanceId": autorest.Encode("path", instanceID), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-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.Web/sites/{name}/slots/{slot}/instances/{instanceId}/deployments/{id}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetInstanceDeploymentSlotSender sends the GetInstanceDeploymentSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) GetInstanceDeploymentSlotSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetInstanceDeploymentSlotResponder handles the response to the GetInstanceDeploymentSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) GetInstanceDeploymentSlotResponder(resp *http.Response) (result Deployment, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetMigrateMySQLStatus returns the status of MySql in app migration, if one +// is active, and whether or not MySql in app is enabled +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of web app +func (client AppsClient) GetMigrateMySQLStatus(resourceGroupName string, name string) (result MigrateMySQLStatus, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "GetMigrateMySQLStatus") + } + + req, err := client.GetMigrateMySQLStatusPreparer(resourceGroupName, name) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "GetMigrateMySQLStatus", nil, "Failure preparing request") + } + + resp, err := client.GetMigrateMySQLStatusSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "GetMigrateMySQLStatus", resp, "Failure sending request") + } + + result, err = client.GetMigrateMySQLStatusResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetMigrateMySQLStatus", resp, "Failure responding to request") + } + + return +} + +// GetMigrateMySQLStatusPreparer prepares the GetMigrateMySQLStatus request. +func (client AppsClient) GetMigrateMySQLStatusPreparer(resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-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.Web/sites/{name}/migratemysql/status", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetMigrateMySQLStatusSender sends the GetMigrateMySQLStatus request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) GetMigrateMySQLStatusSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetMigrateMySQLStatusResponder handles the response to the GetMigrateMySQLStatus request. The method always +// closes the http.Response Body. +func (client AppsClient) GetMigrateMySQLStatusResponder(resp *http.Response) (result MigrateMySQLStatus, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetMigrateMySQLStatusSlot returns the status of MySql in app migration, if +// one is active, and whether or not MySql in app is enabled +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of web app slot is name of the deployment slot +func (client AppsClient) GetMigrateMySQLStatusSlot(resourceGroupName string, name string, slot string) (result MigrateMySQLStatus, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "GetMigrateMySQLStatusSlot") + } + + req, err := client.GetMigrateMySQLStatusSlotPreparer(resourceGroupName, name, slot) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "GetMigrateMySQLStatusSlot", nil, "Failure preparing request") + } + + resp, err := client.GetMigrateMySQLStatusSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "GetMigrateMySQLStatusSlot", resp, "Failure sending request") + } + + result, err = client.GetMigrateMySQLStatusSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetMigrateMySQLStatusSlot", resp, "Failure responding to request") + } + + return +} + +// GetMigrateMySQLStatusSlotPreparer prepares the GetMigrateMySQLStatusSlot request. +func (client AppsClient) GetMigrateMySQLStatusSlotPreparer(resourceGroupName string, name string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-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.Web/sites/{name}/slots/{slot}/migratemysql/status", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetMigrateMySQLStatusSlotSender sends the GetMigrateMySQLStatusSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) GetMigrateMySQLStatusSlotSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetMigrateMySQLStatusSlotResponder handles the response to the GetMigrateMySQLStatusSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) GetMigrateMySQLStatusSlotResponder(resp *http.Response) (result MigrateMySQLStatus, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetPremierAddOn gets a named add-on of an app. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. premierAddOnName is add-on name. +func (client AppsClient) GetPremierAddOn(resourceGroupName string, name string, premierAddOnName string) (result PremierAddOn, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "GetPremierAddOn") + } + + req, err := client.GetPremierAddOnPreparer(resourceGroupName, name, premierAddOnName) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "GetPremierAddOn", nil, "Failure preparing request") + } + + resp, err := client.GetPremierAddOnSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "GetPremierAddOn", resp, "Failure sending request") + } + + result, err = client.GetPremierAddOnResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetPremierAddOn", resp, "Failure responding to request") + } + + return +} + +// GetPremierAddOnPreparer prepares the GetPremierAddOn request. +func (client AppsClient) GetPremierAddOnPreparer(resourceGroupName string, name string, premierAddOnName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "premierAddOnName": autorest.Encode("path", premierAddOnName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-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.Web/sites/{name}/premieraddons/{premierAddOnName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetPremierAddOnSender sends the GetPremierAddOn request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) GetPremierAddOnSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetPremierAddOnResponder handles the response to the GetPremierAddOn request. The method always +// closes the http.Response Body. +func (client AppsClient) GetPremierAddOnResponder(resp *http.Response) (result PremierAddOn, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetPremierAddOnSlot gets a named add-on of an app. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. premierAddOnName is add-on name. slot is +// name of the deployment slot. If a slot is not specified, the API will get +// the named add-on for the production slot. +func (client AppsClient) GetPremierAddOnSlot(resourceGroupName string, name string, premierAddOnName string, slot string) (result PremierAddOn, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "GetPremierAddOnSlot") + } + + req, err := client.GetPremierAddOnSlotPreparer(resourceGroupName, name, premierAddOnName, slot) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "GetPremierAddOnSlot", nil, "Failure preparing request") + } + + resp, err := client.GetPremierAddOnSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "GetPremierAddOnSlot", resp, "Failure sending request") + } + + result, err = client.GetPremierAddOnSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetPremierAddOnSlot", resp, "Failure responding to request") + } + + return +} + +// GetPremierAddOnSlotPreparer prepares the GetPremierAddOnSlot request. +func (client AppsClient) GetPremierAddOnSlotPreparer(resourceGroupName string, name string, premierAddOnName string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "premierAddOnName": autorest.Encode("path", premierAddOnName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-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.Web/sites/{name}/slots/{slot}/premieraddons/{premierAddOnName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetPremierAddOnSlotSender sends the GetPremierAddOnSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) GetPremierAddOnSlotSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetPremierAddOnSlotResponder handles the response to the GetPremierAddOnSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) GetPremierAddOnSlotResponder(resp *http.Response) (result PremierAddOn, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetRelayServiceConnection gets a hybrid connection configuration by its +// name. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. entityName is name of the hybrid +// connection. +func (client AppsClient) GetRelayServiceConnection(resourceGroupName string, name string, entityName string) (result RelayServiceConnectionEntity, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "GetRelayServiceConnection") + } + + req, err := client.GetRelayServiceConnectionPreparer(resourceGroupName, name, entityName) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "GetRelayServiceConnection", nil, "Failure preparing request") + } + + resp, err := client.GetRelayServiceConnectionSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "GetRelayServiceConnection", resp, "Failure sending request") + } + + result, err = client.GetRelayServiceConnectionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetRelayServiceConnection", resp, "Failure responding to request") + } + + return +} + +// GetRelayServiceConnectionPreparer prepares the GetRelayServiceConnection request. +func (client AppsClient) GetRelayServiceConnectionPreparer(resourceGroupName string, name string, entityName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "entityName": autorest.Encode("path", entityName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-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.Web/sites/{name}/hybridconnection/{entityName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetRelayServiceConnectionSender sends the GetRelayServiceConnection request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) GetRelayServiceConnectionSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetRelayServiceConnectionResponder handles the response to the GetRelayServiceConnection request. The method always +// closes the http.Response Body. +func (client AppsClient) GetRelayServiceConnectionResponder(resp *http.Response) (result RelayServiceConnectionEntity, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetRelayServiceConnectionSlot gets a hybrid connection configuration by its +// name. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. entityName is name of the hybrid +// connection. slot is name of the deployment slot. If a slot is not specified, +// the API will get a hybrid connection for the production slot. +func (client AppsClient) GetRelayServiceConnectionSlot(resourceGroupName string, name string, entityName string, slot string) (result RelayServiceConnectionEntity, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "GetRelayServiceConnectionSlot") + } + + req, err := client.GetRelayServiceConnectionSlotPreparer(resourceGroupName, name, entityName, slot) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "GetRelayServiceConnectionSlot", nil, "Failure preparing request") + } + + resp, err := client.GetRelayServiceConnectionSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "GetRelayServiceConnectionSlot", resp, "Failure sending request") + } + + result, err = client.GetRelayServiceConnectionSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetRelayServiceConnectionSlot", resp, "Failure responding to request") + } + + return +} + +// GetRelayServiceConnectionSlotPreparer prepares the GetRelayServiceConnectionSlot request. +func (client AppsClient) GetRelayServiceConnectionSlotPreparer(resourceGroupName string, name string, entityName string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "entityName": autorest.Encode("path", entityName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-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.Web/sites/{name}/slots/{slot}/hybridconnection/{entityName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetRelayServiceConnectionSlotSender sends the GetRelayServiceConnectionSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) GetRelayServiceConnectionSlotSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetRelayServiceConnectionSlotResponder handles the response to the GetRelayServiceConnectionSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) GetRelayServiceConnectionSlotResponder(resp *http.Response) (result RelayServiceConnectionEntity, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetSitePhpErrorLogFlag gets web app's event logs. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of web app +func (client AppsClient) GetSitePhpErrorLogFlag(resourceGroupName string, name string) (result SitePhpErrorLogFlag, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "GetSitePhpErrorLogFlag") + } + + req, err := client.GetSitePhpErrorLogFlagPreparer(resourceGroupName, name) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "GetSitePhpErrorLogFlag", nil, "Failure preparing request") + } + + resp, err := client.GetSitePhpErrorLogFlagSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "GetSitePhpErrorLogFlag", resp, "Failure sending request") + } + + result, err = client.GetSitePhpErrorLogFlagResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetSitePhpErrorLogFlag", resp, "Failure responding to request") + } + + return +} + +// GetSitePhpErrorLogFlagPreparer prepares the GetSitePhpErrorLogFlag request. +func (client AppsClient) GetSitePhpErrorLogFlagPreparer(resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-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.Web/sites/{name}/phplogging", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSitePhpErrorLogFlagSender sends the GetSitePhpErrorLogFlag request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) GetSitePhpErrorLogFlagSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetSitePhpErrorLogFlagResponder handles the response to the GetSitePhpErrorLogFlag request. The method always +// closes the http.Response Body. +func (client AppsClient) GetSitePhpErrorLogFlagResponder(resp *http.Response) (result SitePhpErrorLogFlag, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetSitePhpErrorLogFlagSlot gets web app's event logs. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of web app slot is name of web app slot. If not +// specified then will default to production slot. +func (client AppsClient) GetSitePhpErrorLogFlagSlot(resourceGroupName string, name string, slot string) (result SitePhpErrorLogFlag, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "GetSitePhpErrorLogFlagSlot") + } + + req, err := client.GetSitePhpErrorLogFlagSlotPreparer(resourceGroupName, name, slot) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "GetSitePhpErrorLogFlagSlot", nil, "Failure preparing request") + } + + resp, err := client.GetSitePhpErrorLogFlagSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "GetSitePhpErrorLogFlagSlot", resp, "Failure sending request") + } + + result, err = client.GetSitePhpErrorLogFlagSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetSitePhpErrorLogFlagSlot", resp, "Failure responding to request") + } + + return +} + +// GetSitePhpErrorLogFlagSlotPreparer prepares the GetSitePhpErrorLogFlagSlot request. +func (client AppsClient) GetSitePhpErrorLogFlagSlotPreparer(resourceGroupName string, name string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-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.Web/sites/{name}/slots/{slot}/phplogging", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSitePhpErrorLogFlagSlotSender sends the GetSitePhpErrorLogFlagSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) GetSitePhpErrorLogFlagSlotSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetSitePhpErrorLogFlagSlotResponder handles the response to the GetSitePhpErrorLogFlagSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) GetSitePhpErrorLogFlagSlotResponder(resp *http.Response) (result SitePhpErrorLogFlag, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetSlot gets the details of a web, mobile, or API app. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. slot is name of the deployment slot. By +// default, this API returns the production slot. +func (client AppsClient) GetSlot(resourceGroupName string, name string, slot string) (result Site, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "GetSlot") + } + + req, err := client.GetSlotPreparer(resourceGroupName, name, slot) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "GetSlot", nil, "Failure preparing request") + } + + resp, err := client.GetSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "GetSlot", resp, "Failure sending request") + } + + result, err = client.GetSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetSlot", resp, "Failure responding to request") + } + + return +} + +// GetSlotPreparer prepares the GetSlot request. +func (client AppsClient) GetSlotPreparer(resourceGroupName string, name string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-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.Web/sites/{name}/slots/{slot}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSlotSender sends the GetSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) GetSlotSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetSlotResponder handles the response to the GetSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) GetSlotResponder(resp *http.Response) (result Site, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetSourceControl gets the source control configuration of an app. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. +func (client AppsClient) GetSourceControl(resourceGroupName string, name string) (result SiteSourceControl, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "GetSourceControl") + } + + req, err := client.GetSourceControlPreparer(resourceGroupName, name) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "GetSourceControl", nil, "Failure preparing request") + } + + resp, err := client.GetSourceControlSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "GetSourceControl", resp, "Failure sending request") + } + + result, err = client.GetSourceControlResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetSourceControl", resp, "Failure responding to request") + } + + return +} + +// GetSourceControlPreparer prepares the GetSourceControl request. +func (client AppsClient) GetSourceControlPreparer(resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-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.Web/sites/{name}/sourcecontrols/web", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSourceControlSender sends the GetSourceControl request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) GetSourceControlSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetSourceControlResponder handles the response to the GetSourceControl request. The method always +// closes the http.Response Body. +func (client AppsClient) GetSourceControlResponder(resp *http.Response) (result SiteSourceControl, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetSourceControlSlot gets the source control configuration of an app. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. slot is name of the deployment slot. If a +// slot is not specified, the API will get the source control configuration for +// the production slot. +func (client AppsClient) GetSourceControlSlot(resourceGroupName string, name string, slot string) (result SiteSourceControl, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "GetSourceControlSlot") + } + + req, err := client.GetSourceControlSlotPreparer(resourceGroupName, name, slot) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "GetSourceControlSlot", nil, "Failure preparing request") + } + + resp, err := client.GetSourceControlSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "GetSourceControlSlot", resp, "Failure sending request") + } + + result, err = client.GetSourceControlSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetSourceControlSlot", resp, "Failure responding to request") + } + + return +} + +// GetSourceControlSlotPreparer prepares the GetSourceControlSlot request. +func (client AppsClient) GetSourceControlSlotPreparer(resourceGroupName string, name string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-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.Web/sites/{name}/slots/{slot}/sourcecontrols/web", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSourceControlSlotSender sends the GetSourceControlSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) GetSourceControlSlotSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetSourceControlSlotResponder handles the response to the GetSourceControlSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) GetSourceControlSlotResponder(resp *http.Response) (result SiteSourceControl, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetVnetConnection gets a virtual network the app (or deployment slot) is +// connected to by name. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. vnetName is name of the virtual network. +func (client AppsClient) GetVnetConnection(resourceGroupName string, name string, vnetName string) (result VnetInfo, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "GetVnetConnection") + } + + req, err := client.GetVnetConnectionPreparer(resourceGroupName, name, vnetName) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "GetVnetConnection", nil, "Failure preparing request") + } + + resp, err := client.GetVnetConnectionSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "GetVnetConnection", resp, "Failure sending request") + } + + result, err = client.GetVnetConnectionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetVnetConnection", resp, "Failure responding to request") + } + + return +} + +// GetVnetConnectionPreparer prepares the GetVnetConnection request. +func (client AppsClient) GetVnetConnectionPreparer(resourceGroupName string, name string, vnetName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vnetName": autorest.Encode("path", vnetName), + } + + const APIVersion = "2016-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.Web/sites/{name}/virtualNetworkConnections/{vnetName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetVnetConnectionSender sends the GetVnetConnection request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) GetVnetConnectionSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetVnetConnectionResponder handles the response to the GetVnetConnection request. The method always +// closes the http.Response Body. +func (client AppsClient) GetVnetConnectionResponder(resp *http.Response) (result VnetInfo, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetVnetConnectionGateway gets an app's Virtual Network gateway. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. vnetName is name of the Virtual Network. +// gatewayName is name of the gateway. Currently, the only supported string is +// "primary". +func (client AppsClient) GetVnetConnectionGateway(resourceGroupName string, name string, vnetName string, gatewayName string) (result VnetGateway, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "GetVnetConnectionGateway") + } + + req, err := client.GetVnetConnectionGatewayPreparer(resourceGroupName, name, vnetName, gatewayName) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "GetVnetConnectionGateway", nil, "Failure preparing request") + } + + resp, err := client.GetVnetConnectionGatewaySender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "GetVnetConnectionGateway", resp, "Failure sending request") + } + + result, err = client.GetVnetConnectionGatewayResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetVnetConnectionGateway", resp, "Failure responding to request") + } + + return +} + +// GetVnetConnectionGatewayPreparer prepares the GetVnetConnectionGateway request. +func (client AppsClient) GetVnetConnectionGatewayPreparer(resourceGroupName string, name string, vnetName string, gatewayName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "gatewayName": autorest.Encode("path", gatewayName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vnetName": autorest.Encode("path", vnetName), + } + + const APIVersion = "2016-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.Web/sites/{name}/virtualNetworkConnections/{vnetName}/gateways/{gatewayName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetVnetConnectionGatewaySender sends the GetVnetConnectionGateway request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) GetVnetConnectionGatewaySender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetVnetConnectionGatewayResponder handles the response to the GetVnetConnectionGateway request. The method always +// closes the http.Response Body. +func (client AppsClient) GetVnetConnectionGatewayResponder(resp *http.Response) (result VnetGateway, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNotFound), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetVnetConnectionGatewaySlot gets an app's Virtual Network gateway. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. vnetName is name of the Virtual Network. +// gatewayName is name of the gateway. Currently, the only supported string is +// "primary". slot is name of the deployment slot. If a slot is not specified, +// the API will get a gateway for the production slot's Virtual Network. +func (client AppsClient) GetVnetConnectionGatewaySlot(resourceGroupName string, name string, vnetName string, gatewayName string, slot string) (result VnetGateway, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "GetVnetConnectionGatewaySlot") + } + + req, err := client.GetVnetConnectionGatewaySlotPreparer(resourceGroupName, name, vnetName, gatewayName, slot) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "GetVnetConnectionGatewaySlot", nil, "Failure preparing request") + } + + resp, err := client.GetVnetConnectionGatewaySlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "GetVnetConnectionGatewaySlot", resp, "Failure sending request") + } + + result, err = client.GetVnetConnectionGatewaySlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetVnetConnectionGatewaySlot", resp, "Failure responding to request") + } + + return +} + +// GetVnetConnectionGatewaySlotPreparer prepares the GetVnetConnectionGatewaySlot request. +func (client AppsClient) GetVnetConnectionGatewaySlotPreparer(resourceGroupName string, name string, vnetName string, gatewayName string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "gatewayName": autorest.Encode("path", gatewayName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vnetName": autorest.Encode("path", vnetName), + } + + const APIVersion = "2016-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.Web/sites/{name}/slots/{slot}/virtualNetworkConnections/{vnetName}/gateways/{gatewayName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetVnetConnectionGatewaySlotSender sends the GetVnetConnectionGatewaySlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) GetVnetConnectionGatewaySlotSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetVnetConnectionGatewaySlotResponder handles the response to the GetVnetConnectionGatewaySlot request. The method always +// closes the http.Response Body. +func (client AppsClient) GetVnetConnectionGatewaySlotResponder(resp *http.Response) (result VnetGateway, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNotFound), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetVnetConnectionSlot gets a virtual network the app (or deployment slot) is +// connected to by name. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. vnetName is name of the virtual network. +// slot is name of the deployment slot. If a slot is not specified, the API +// will get the named virtual network for the production slot. +func (client AppsClient) GetVnetConnectionSlot(resourceGroupName string, name string, vnetName string, slot string) (result VnetInfo, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "GetVnetConnectionSlot") + } + + req, err := client.GetVnetConnectionSlotPreparer(resourceGroupName, name, vnetName, slot) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "GetVnetConnectionSlot", nil, "Failure preparing request") + } + + resp, err := client.GetVnetConnectionSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "GetVnetConnectionSlot", resp, "Failure sending request") + } + + result, err = client.GetVnetConnectionSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetVnetConnectionSlot", resp, "Failure responding to request") + } + + return +} + +// GetVnetConnectionSlotPreparer prepares the GetVnetConnectionSlot request. +func (client AppsClient) GetVnetConnectionSlotPreparer(resourceGroupName string, name string, vnetName string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vnetName": autorest.Encode("path", vnetName), + } + + const APIVersion = "2016-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.Web/sites/{name}/slots/{slot}/virtualNetworkConnections/{vnetName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetVnetConnectionSlotSender sends the GetVnetConnectionSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) GetVnetConnectionSlotSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetVnetConnectionSlotResponder handles the response to the GetVnetConnectionSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) GetVnetConnectionSlotResponder(resp *http.Response) (result VnetInfo, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// IsCloneable shows whether an app can be cloned to another resource group or +// subscription. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. +func (client AppsClient) IsCloneable(resourceGroupName string, name string) (result SiteCloneability, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "IsCloneable") + } + + req, err := client.IsCloneablePreparer(resourceGroupName, name) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "IsCloneable", nil, "Failure preparing request") + } + + resp, err := client.IsCloneableSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "IsCloneable", resp, "Failure sending request") + } + + result, err = client.IsCloneableResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "IsCloneable", resp, "Failure responding to request") + } + + return +} + +// IsCloneablePreparer prepares the IsCloneable request. +func (client AppsClient) IsCloneablePreparer(resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-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.Web/sites/{name}/iscloneable", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// IsCloneableSender sends the IsCloneable request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) IsCloneableSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// IsCloneableResponder handles the response to the IsCloneable request. The method always +// closes the http.Response Body. +func (client AppsClient) IsCloneableResponder(resp *http.Response) (result SiteCloneability, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// IsCloneableSlot shows whether an app can be cloned to another resource group +// or subscription. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. slot is name of the deployment slot. By +// default, this API returns information on the production slot. +func (client AppsClient) IsCloneableSlot(resourceGroupName string, name string, slot string) (result SiteCloneability, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "IsCloneableSlot") + } + + req, err := client.IsCloneableSlotPreparer(resourceGroupName, name, slot) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "IsCloneableSlot", nil, "Failure preparing request") + } + + resp, err := client.IsCloneableSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "IsCloneableSlot", resp, "Failure sending request") + } + + result, err = client.IsCloneableSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "IsCloneableSlot", resp, "Failure responding to request") + } + + return +} + +// IsCloneableSlotPreparer prepares the IsCloneableSlot request. +func (client AppsClient) IsCloneableSlotPreparer(resourceGroupName string, name string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-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.Web/sites/{name}/slots/{slot}/iscloneable", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// IsCloneableSlotSender sends the IsCloneableSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) IsCloneableSlotSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// IsCloneableSlotResponder handles the response to the IsCloneableSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) IsCloneableSlotResponder(resp *http.Response) (result SiteCloneability, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List get all apps for a subscription. +func (client AppsClient) List() (result AppCollection, err error) { + req, err := client.ListPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "List", nil, "Failure preparing request") + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "List", resp, "Failure sending request") + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client AppsClient) ListPreparer() (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Web/sites", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client AppsClient) ListResponder(resp *http.Response) (result AppCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + 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 AppsClient) ListNextResults(lastResults AppCollection) (result AppCollection, err error) { + req, err := lastResults.AppCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "List", 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, "web.AppsClient", "List", resp, "Failure sending next results request") + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "List", resp, "Failure responding to next results request") + } + + return +} + +// ListApplicationSettings gets the application settings of an app. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. +func (client AppsClient) ListApplicationSettings(resourceGroupName string, name string) (result StringDictionary, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "ListApplicationSettings") + } + + req, err := client.ListApplicationSettingsPreparer(resourceGroupName, name) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListApplicationSettings", nil, "Failure preparing request") + } + + resp, err := client.ListApplicationSettingsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListApplicationSettings", resp, "Failure sending request") + } + + result, err = client.ListApplicationSettingsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListApplicationSettings", resp, "Failure responding to request") + } + + return +} + +// ListApplicationSettingsPreparer prepares the ListApplicationSettings request. +func (client AppsClient) ListApplicationSettingsPreparer(resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-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.Web/sites/{name}/config/appsettings/list", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListApplicationSettingsSender sends the ListApplicationSettings request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListApplicationSettingsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListApplicationSettingsResponder handles the response to the ListApplicationSettings request. The method always +// closes the http.Response Body. +func (client AppsClient) ListApplicationSettingsResponder(resp *http.Response) (result StringDictionary, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListApplicationSettingsSlot gets the application settings of an app. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. slot is name of the deployment slot. If a +// slot is not specified, the API will get the application settings for the +// production slot. +func (client AppsClient) ListApplicationSettingsSlot(resourceGroupName string, name string, slot string) (result StringDictionary, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "ListApplicationSettingsSlot") + } + + req, err := client.ListApplicationSettingsSlotPreparer(resourceGroupName, name, slot) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListApplicationSettingsSlot", nil, "Failure preparing request") + } + + resp, err := client.ListApplicationSettingsSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListApplicationSettingsSlot", resp, "Failure sending request") + } + + result, err = client.ListApplicationSettingsSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListApplicationSettingsSlot", resp, "Failure responding to request") + } + + return +} + +// ListApplicationSettingsSlotPreparer prepares the ListApplicationSettingsSlot request. +func (client AppsClient) ListApplicationSettingsSlotPreparer(resourceGroupName string, name string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-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.Web/sites/{name}/slots/{slot}/config/appsettings/list", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListApplicationSettingsSlotSender sends the ListApplicationSettingsSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListApplicationSettingsSlotSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListApplicationSettingsSlotResponder handles the response to the ListApplicationSettingsSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) ListApplicationSettingsSlotResponder(resp *http.Response) (result StringDictionary, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListBackups gets existing backups of an app. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. +func (client AppsClient) ListBackups(resourceGroupName string, name string) (result BackupItemCollection, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "ListBackups") + } + + req, err := client.ListBackupsPreparer(resourceGroupName, name) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListBackups", nil, "Failure preparing request") + } + + resp, err := client.ListBackupsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListBackups", resp, "Failure sending request") + } + + result, err = client.ListBackupsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListBackups", resp, "Failure responding to request") + } + + return +} + +// ListBackupsPreparer prepares the ListBackups request. +func (client AppsClient) ListBackupsPreparer(resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-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.Web/sites/{name}/backups", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListBackupsSender sends the ListBackups request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListBackupsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListBackupsResponder handles the response to the ListBackups request. The method always +// closes the http.Response Body. +func (client AppsClient) ListBackupsResponder(resp *http.Response) (result BackupItemCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListBackupsNextResults retrieves the next set of results, if any. +func (client AppsClient) ListBackupsNextResults(lastResults BackupItemCollection) (result BackupItemCollection, err error) { + req, err := lastResults.BackupItemCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListBackups", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListBackupsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListBackups", resp, "Failure sending next results request") + } + + result, err = client.ListBackupsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListBackups", resp, "Failure responding to next results request") + } + + return +} + +// ListBackupsSlot gets existing backups of an app. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. slot is name of the deployment slot. If a +// slot is not specified, the API will get backups of the production slot. +func (client AppsClient) ListBackupsSlot(resourceGroupName string, name string, slot string) (result BackupItemCollection, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "ListBackupsSlot") + } + + req, err := client.ListBackupsSlotPreparer(resourceGroupName, name, slot) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListBackupsSlot", nil, "Failure preparing request") + } + + resp, err := client.ListBackupsSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListBackupsSlot", resp, "Failure sending request") + } + + result, err = client.ListBackupsSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListBackupsSlot", resp, "Failure responding to request") + } + + return +} + +// ListBackupsSlotPreparer prepares the ListBackupsSlot request. +func (client AppsClient) ListBackupsSlotPreparer(resourceGroupName string, name string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-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.Web/sites/{name}/slots/{slot}/backups", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListBackupsSlotSender sends the ListBackupsSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListBackupsSlotSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListBackupsSlotResponder handles the response to the ListBackupsSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) ListBackupsSlotResponder(resp *http.Response) (result BackupItemCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListBackupsSlotNextResults retrieves the next set of results, if any. +func (client AppsClient) ListBackupsSlotNextResults(lastResults BackupItemCollection) (result BackupItemCollection, err error) { + req, err := lastResults.BackupItemCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListBackupsSlot", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListBackupsSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListBackupsSlot", resp, "Failure sending next results request") + } + + result, err = client.ListBackupsSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListBackupsSlot", resp, "Failure responding to next results request") + } + + return +} + +// ListBackupStatusSecrets gets status of a web app backup that may be in +// progress, including secrets associated with the backup, such as the Azure +// Storage SAS URL. Also can be used to update the SAS URL for the backup if a +// new URL is passed in the request body. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of web app backupID is id of backup request is +// information on backup request +func (client AppsClient) ListBackupStatusSecrets(resourceGroupName string, name string, backupID string, request BackupRequest) (result BackupItem, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}, + {TargetValue: request, + Constraints: []validation.Constraint{{Target: "request.BackupRequestProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "request.BackupRequestProperties.BackupSchedule", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "request.BackupRequestProperties.BackupSchedule.FrequencyInterval", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "request.BackupRequestProperties.BackupSchedule.KeepAtLeastOneBackup", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "request.BackupRequestProperties.BackupSchedule.RetentionPeriodInDays", Name: validation.Null, Rule: true, Chain: nil}, + }}, + }}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "ListBackupStatusSecrets") + } + + req, err := client.ListBackupStatusSecretsPreparer(resourceGroupName, name, backupID, request) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListBackupStatusSecrets", nil, "Failure preparing request") + } + + resp, err := client.ListBackupStatusSecretsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListBackupStatusSecrets", resp, "Failure sending request") + } + + result, err = client.ListBackupStatusSecretsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListBackupStatusSecrets", resp, "Failure responding to request") + } + + return +} + +// ListBackupStatusSecretsPreparer prepares the ListBackupStatusSecrets request. +func (client AppsClient) ListBackupStatusSecretsPreparer(resourceGroupName string, name string, backupID string, request BackupRequest) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "backupId": autorest.Encode("path", backupID), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/backups/{backupId}/list", pathParameters), + autorest.WithJSON(request), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListBackupStatusSecretsSender sends the ListBackupStatusSecrets request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListBackupStatusSecretsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListBackupStatusSecretsResponder handles the response to the ListBackupStatusSecrets request. The method always +// closes the http.Response Body. +func (client AppsClient) ListBackupStatusSecretsResponder(resp *http.Response) (result BackupItem, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListBackupStatusSecretsSlot gets status of a web app backup that may be in +// progress, including secrets associated with the backup, such as the Azure +// Storage SAS URL. Also can be used to update the SAS URL for the backup if a +// new URL is passed in the request body. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of web app backupID is id of backup request is +// information on backup request slot is name of web app slot. If not specified +// then will default to production slot. +func (client AppsClient) ListBackupStatusSecretsSlot(resourceGroupName string, name string, backupID string, request BackupRequest, slot string) (result BackupItem, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}, + {TargetValue: request, + Constraints: []validation.Constraint{{Target: "request.BackupRequestProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "request.BackupRequestProperties.BackupSchedule", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "request.BackupRequestProperties.BackupSchedule.FrequencyInterval", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "request.BackupRequestProperties.BackupSchedule.KeepAtLeastOneBackup", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "request.BackupRequestProperties.BackupSchedule.RetentionPeriodInDays", Name: validation.Null, Rule: true, Chain: nil}, + }}, + }}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "ListBackupStatusSecretsSlot") + } + + req, err := client.ListBackupStatusSecretsSlotPreparer(resourceGroupName, name, backupID, request, slot) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListBackupStatusSecretsSlot", nil, "Failure preparing request") + } + + resp, err := client.ListBackupStatusSecretsSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListBackupStatusSecretsSlot", resp, "Failure sending request") + } + + result, err = client.ListBackupStatusSecretsSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListBackupStatusSecretsSlot", resp, "Failure responding to request") + } + + return +} + +// ListBackupStatusSecretsSlotPreparer prepares the ListBackupStatusSecretsSlot request. +func (client AppsClient) ListBackupStatusSecretsSlotPreparer(resourceGroupName string, name string, backupID string, request BackupRequest, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "backupId": autorest.Encode("path", backupID), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/backups/{backupId}/list", pathParameters), + autorest.WithJSON(request), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListBackupStatusSecretsSlotSender sends the ListBackupStatusSecretsSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListBackupStatusSecretsSlotSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListBackupStatusSecretsSlotResponder handles the response to the ListBackupStatusSecretsSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) ListBackupStatusSecretsSlotResponder(resp *http.Response) (result BackupItem, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByResourceGroup gets all web, mobile, and API apps in the specified +// resource group. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. includeSlots is specify true to include deployment +// slots in results. The default is false, which only gives you the production +// slot of all apps. +func (client AppsClient) ListByResourceGroup(resourceGroupName string, includeSlots *bool) (result AppCollection, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "ListByResourceGroup") + } + + req, err := client.ListByResourceGroupPreparer(resourceGroupName, includeSlots) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListByResourceGroup", nil, "Failure preparing request") + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListByResourceGroup", resp, "Failure sending request") + } + + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListByResourceGroup", resp, "Failure responding to request") + } + + return +} + +// ListByResourceGroupPreparer prepares the ListByResourceGroup request. +func (client AppsClient) ListByResourceGroupPreparer(resourceGroupName string, includeSlots *bool) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if includeSlots != nil { + queryParameters["includeSlots"] = autorest.Encode("query", *includeSlots) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (client AppsClient) ListByResourceGroupResponder(resp *http.Response) (result AppCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + 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 AppsClient) ListByResourceGroupNextResults(lastResults AppCollection) (result AppCollection, err error) { + req, err := lastResults.AppCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListByResourceGroup", 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, "web.AppsClient", "ListByResourceGroup", resp, "Failure sending next results request") + } + + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListByResourceGroup", resp, "Failure responding to next results request") + } + + return +} + +// ListConfigurationSnapshotInfo gets a list of web app configuration snapshots +// identifiers. Each element of the list contains a timestamp and the ID of the +// snapshot. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. +func (client AppsClient) ListConfigurationSnapshotInfo(resourceGroupName string, name string) (result ListSiteConfigurationSnapshotInfo, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "ListConfigurationSnapshotInfo") + } + + req, err := client.ListConfigurationSnapshotInfoPreparer(resourceGroupName, name) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListConfigurationSnapshotInfo", nil, "Failure preparing request") + } + + resp, err := client.ListConfigurationSnapshotInfoSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListConfigurationSnapshotInfo", resp, "Failure sending request") + } + + result, err = client.ListConfigurationSnapshotInfoResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListConfigurationSnapshotInfo", resp, "Failure responding to request") + } + + return +} + +// ListConfigurationSnapshotInfoPreparer prepares the ListConfigurationSnapshotInfo request. +func (client AppsClient) ListConfigurationSnapshotInfoPreparer(resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-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.Web/sites/{name}/config/web/snapshots", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListConfigurationSnapshotInfoSender sends the ListConfigurationSnapshotInfo request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListConfigurationSnapshotInfoSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListConfigurationSnapshotInfoResponder handles the response to the ListConfigurationSnapshotInfo request. The method always +// closes the http.Response Body. +func (client AppsClient) ListConfigurationSnapshotInfoResponder(resp *http.Response) (result ListSiteConfigurationSnapshotInfo, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListConfigurationSnapshotInfoSlot gets a list of web app configuration +// snapshots identifiers. Each element of the list contains a timestamp and the +// ID of the snapshot. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. slot is name of the deployment slot. If a +// slot is not specified, the API will return configuration for the production +// slot. +func (client AppsClient) ListConfigurationSnapshotInfoSlot(resourceGroupName string, name string, slot string) (result ListSiteConfigurationSnapshotInfo, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "ListConfigurationSnapshotInfoSlot") + } + + req, err := client.ListConfigurationSnapshotInfoSlotPreparer(resourceGroupName, name, slot) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListConfigurationSnapshotInfoSlot", nil, "Failure preparing request") + } + + resp, err := client.ListConfigurationSnapshotInfoSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListConfigurationSnapshotInfoSlot", resp, "Failure sending request") + } + + result, err = client.ListConfigurationSnapshotInfoSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListConfigurationSnapshotInfoSlot", resp, "Failure responding to request") + } + + return +} + +// ListConfigurationSnapshotInfoSlotPreparer prepares the ListConfigurationSnapshotInfoSlot request. +func (client AppsClient) ListConfigurationSnapshotInfoSlotPreparer(resourceGroupName string, name string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-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.Web/sites/{name}/slots/{slot}/config/web/snapshots", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListConfigurationSnapshotInfoSlotSender sends the ListConfigurationSnapshotInfoSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListConfigurationSnapshotInfoSlotSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListConfigurationSnapshotInfoSlotResponder handles the response to the ListConfigurationSnapshotInfoSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) ListConfigurationSnapshotInfoSlotResponder(resp *http.Response) (result ListSiteConfigurationSnapshotInfo, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListConnectionStrings gets the connection strings of an app. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. +func (client AppsClient) ListConnectionStrings(resourceGroupName string, name string) (result ConnectionStringDictionary, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "ListConnectionStrings") + } + + req, err := client.ListConnectionStringsPreparer(resourceGroupName, name) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListConnectionStrings", nil, "Failure preparing request") + } + + resp, err := client.ListConnectionStringsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListConnectionStrings", resp, "Failure sending request") + } + + result, err = client.ListConnectionStringsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListConnectionStrings", resp, "Failure responding to request") + } + + return +} + +// ListConnectionStringsPreparer prepares the ListConnectionStrings request. +func (client AppsClient) ListConnectionStringsPreparer(resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-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.Web/sites/{name}/config/connectionstrings/list", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListConnectionStringsSender sends the ListConnectionStrings request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListConnectionStringsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListConnectionStringsResponder handles the response to the ListConnectionStrings request. The method always +// closes the http.Response Body. +func (client AppsClient) ListConnectionStringsResponder(resp *http.Response) (result ConnectionStringDictionary, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListConnectionStringsSlot gets the connection strings of an app. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. slot is name of the deployment slot. If a +// slot is not specified, the API will get the connection settings for the +// production slot. +func (client AppsClient) ListConnectionStringsSlot(resourceGroupName string, name string, slot string) (result ConnectionStringDictionary, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "ListConnectionStringsSlot") + } + + req, err := client.ListConnectionStringsSlotPreparer(resourceGroupName, name, slot) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListConnectionStringsSlot", nil, "Failure preparing request") + } + + resp, err := client.ListConnectionStringsSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListConnectionStringsSlot", resp, "Failure sending request") + } + + result, err = client.ListConnectionStringsSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListConnectionStringsSlot", resp, "Failure responding to request") + } + + return +} + +// ListConnectionStringsSlotPreparer prepares the ListConnectionStringsSlot request. +func (client AppsClient) ListConnectionStringsSlotPreparer(resourceGroupName string, name string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-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.Web/sites/{name}/slots/{slot}/config/connectionstrings/list", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListConnectionStringsSlotSender sends the ListConnectionStringsSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListConnectionStringsSlotSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListConnectionStringsSlotResponder handles the response to the ListConnectionStringsSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) ListConnectionStringsSlotResponder(resp *http.Response) (result ConnectionStringDictionary, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListDeployments list deployments for an app, or a deployment slot, or for an +// instance of a scaled-out app. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. +func (client AppsClient) ListDeployments(resourceGroupName string, name string) (result DeploymentCollection, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "ListDeployments") + } + + req, err := client.ListDeploymentsPreparer(resourceGroupName, name) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListDeployments", nil, "Failure preparing request") + } + + resp, err := client.ListDeploymentsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListDeployments", resp, "Failure sending request") + } + + result, err = client.ListDeploymentsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListDeployments", resp, "Failure responding to request") + } + + return +} + +// ListDeploymentsPreparer prepares the ListDeployments request. +func (client AppsClient) ListDeploymentsPreparer(resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-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.Web/sites/{name}/deployments", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListDeploymentsSender sends the ListDeployments request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListDeploymentsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListDeploymentsResponder handles the response to the ListDeployments request. The method always +// closes the http.Response Body. +func (client AppsClient) ListDeploymentsResponder(resp *http.Response) (result DeploymentCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListDeploymentsNextResults retrieves the next set of results, if any. +func (client AppsClient) ListDeploymentsNextResults(lastResults DeploymentCollection) (result DeploymentCollection, err error) { + req, err := lastResults.DeploymentCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListDeployments", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListDeploymentsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListDeployments", resp, "Failure sending next results request") + } + + result, err = client.ListDeploymentsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListDeployments", resp, "Failure responding to next results request") + } + + return +} + +// ListDeploymentsSlot list deployments for an app, or a deployment slot, or +// for an instance of a scaled-out app. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. slot is name of the deployment slot. If a +// slot is not specified, the API returns deployments for the production slot. +func (client AppsClient) ListDeploymentsSlot(resourceGroupName string, name string, slot string) (result DeploymentCollection, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "ListDeploymentsSlot") + } + + req, err := client.ListDeploymentsSlotPreparer(resourceGroupName, name, slot) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListDeploymentsSlot", nil, "Failure preparing request") + } + + resp, err := client.ListDeploymentsSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListDeploymentsSlot", resp, "Failure sending request") + } + + result, err = client.ListDeploymentsSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListDeploymentsSlot", resp, "Failure responding to request") + } + + return +} + +// ListDeploymentsSlotPreparer prepares the ListDeploymentsSlot request. +func (client AppsClient) ListDeploymentsSlotPreparer(resourceGroupName string, name string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-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.Web/sites/{name}/slots/{slot}/deployments", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListDeploymentsSlotSender sends the ListDeploymentsSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListDeploymentsSlotSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListDeploymentsSlotResponder handles the response to the ListDeploymentsSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) ListDeploymentsSlotResponder(resp *http.Response) (result DeploymentCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListDeploymentsSlotNextResults retrieves the next set of results, if any. +func (client AppsClient) ListDeploymentsSlotNextResults(lastResults DeploymentCollection) (result DeploymentCollection, err error) { + req, err := lastResults.DeploymentCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListDeploymentsSlot", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListDeploymentsSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListDeploymentsSlot", resp, "Failure sending next results request") + } + + result, err = client.ListDeploymentsSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListDeploymentsSlot", resp, "Failure responding to next results request") + } + + return +} + +// ListDomainOwnershipIdentifiers lists ownership identifiers for domain +// associated with web app. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. +func (client AppsClient) ListDomainOwnershipIdentifiers(resourceGroupName string, name string) (result IdentifierCollection, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "ListDomainOwnershipIdentifiers") + } + + req, err := client.ListDomainOwnershipIdentifiersPreparer(resourceGroupName, name) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListDomainOwnershipIdentifiers", nil, "Failure preparing request") + } + + resp, err := client.ListDomainOwnershipIdentifiersSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListDomainOwnershipIdentifiers", resp, "Failure sending request") + } + + result, err = client.ListDomainOwnershipIdentifiersResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListDomainOwnershipIdentifiers", resp, "Failure responding to request") + } + + return +} + +// ListDomainOwnershipIdentifiersPreparer prepares the ListDomainOwnershipIdentifiers request. +func (client AppsClient) ListDomainOwnershipIdentifiersPreparer(resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-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.Web/sites/{name}/domainOwnershipIdentifiers", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListDomainOwnershipIdentifiersSender sends the ListDomainOwnershipIdentifiers request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListDomainOwnershipIdentifiersSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListDomainOwnershipIdentifiersResponder handles the response to the ListDomainOwnershipIdentifiers request. The method always +// closes the http.Response Body. +func (client AppsClient) ListDomainOwnershipIdentifiersResponder(resp *http.Response) (result IdentifierCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListDomainOwnershipIdentifiersNextResults retrieves the next set of results, if any. +func (client AppsClient) ListDomainOwnershipIdentifiersNextResults(lastResults IdentifierCollection) (result IdentifierCollection, err error) { + req, err := lastResults.IdentifierCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListDomainOwnershipIdentifiers", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListDomainOwnershipIdentifiersSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListDomainOwnershipIdentifiers", resp, "Failure sending next results request") + } + + result, err = client.ListDomainOwnershipIdentifiersResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListDomainOwnershipIdentifiers", resp, "Failure responding to next results request") + } + + return +} + +// ListDomainOwnershipIdentifiersSlot lists ownership identifiers for domain +// associated with web app. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. slot is name of the deployment slot. If a +// slot is not specified, the API will delete the binding for the production +// slot. +func (client AppsClient) ListDomainOwnershipIdentifiersSlot(resourceGroupName string, name string, slot string) (result IdentifierCollection, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "ListDomainOwnershipIdentifiersSlot") + } + + req, err := client.ListDomainOwnershipIdentifiersSlotPreparer(resourceGroupName, name, slot) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListDomainOwnershipIdentifiersSlot", nil, "Failure preparing request") + } + + resp, err := client.ListDomainOwnershipIdentifiersSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListDomainOwnershipIdentifiersSlot", resp, "Failure sending request") + } + + result, err = client.ListDomainOwnershipIdentifiersSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListDomainOwnershipIdentifiersSlot", resp, "Failure responding to request") + } + + return +} + +// ListDomainOwnershipIdentifiersSlotPreparer prepares the ListDomainOwnershipIdentifiersSlot request. +func (client AppsClient) ListDomainOwnershipIdentifiersSlotPreparer(resourceGroupName string, name string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-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.Web/sites/{name}/slots/{slot}/domainOwnershipIdentifiers", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListDomainOwnershipIdentifiersSlotSender sends the ListDomainOwnershipIdentifiersSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListDomainOwnershipIdentifiersSlotSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListDomainOwnershipIdentifiersSlotResponder handles the response to the ListDomainOwnershipIdentifiersSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) ListDomainOwnershipIdentifiersSlotResponder(resp *http.Response) (result IdentifierCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListDomainOwnershipIdentifiersSlotNextResults retrieves the next set of results, if any. +func (client AppsClient) ListDomainOwnershipIdentifiersSlotNextResults(lastResults IdentifierCollection) (result IdentifierCollection, err error) { + req, err := lastResults.IdentifierCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListDomainOwnershipIdentifiersSlot", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListDomainOwnershipIdentifiersSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListDomainOwnershipIdentifiersSlot", resp, "Failure sending next results request") + } + + result, err = client.ListDomainOwnershipIdentifiersSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListDomainOwnershipIdentifiersSlot", resp, "Failure responding to next results request") + } + + return +} + +// ListHostNameBindings get hostname bindings for an app or a deployment slot. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. +func (client AppsClient) ListHostNameBindings(resourceGroupName string, name string) (result HostNameBindingCollection, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "ListHostNameBindings") + } + + req, err := client.ListHostNameBindingsPreparer(resourceGroupName, name) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListHostNameBindings", nil, "Failure preparing request") + } + + resp, err := client.ListHostNameBindingsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListHostNameBindings", resp, "Failure sending request") + } + + result, err = client.ListHostNameBindingsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListHostNameBindings", resp, "Failure responding to request") + } + + return +} + +// ListHostNameBindingsPreparer prepares the ListHostNameBindings request. +func (client AppsClient) ListHostNameBindingsPreparer(resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-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.Web/sites/{name}/hostNameBindings", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListHostNameBindingsSender sends the ListHostNameBindings request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListHostNameBindingsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListHostNameBindingsResponder handles the response to the ListHostNameBindings request. The method always +// closes the http.Response Body. +func (client AppsClient) ListHostNameBindingsResponder(resp *http.Response) (result HostNameBindingCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListHostNameBindingsNextResults retrieves the next set of results, if any. +func (client AppsClient) ListHostNameBindingsNextResults(lastResults HostNameBindingCollection) (result HostNameBindingCollection, err error) { + req, err := lastResults.HostNameBindingCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListHostNameBindings", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListHostNameBindingsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListHostNameBindings", resp, "Failure sending next results request") + } + + result, err = client.ListHostNameBindingsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListHostNameBindings", resp, "Failure responding to next results request") + } + + return +} + +// ListHostNameBindingsSlot get hostname bindings for an app or a deployment +// slot. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. slot is name of the deployment slot. If a +// slot is not specified, the API gets hostname bindings for the production +// slot. +func (client AppsClient) ListHostNameBindingsSlot(resourceGroupName string, name string, slot string) (result HostNameBindingCollection, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "ListHostNameBindingsSlot") + } + + req, err := client.ListHostNameBindingsSlotPreparer(resourceGroupName, name, slot) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListHostNameBindingsSlot", nil, "Failure preparing request") + } + + resp, err := client.ListHostNameBindingsSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListHostNameBindingsSlot", resp, "Failure sending request") + } + + result, err = client.ListHostNameBindingsSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListHostNameBindingsSlot", resp, "Failure responding to request") + } + + return +} + +// ListHostNameBindingsSlotPreparer prepares the ListHostNameBindingsSlot request. +func (client AppsClient) ListHostNameBindingsSlotPreparer(resourceGroupName string, name string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-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.Web/sites/{name}/slots/{slot}/hostNameBindings", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListHostNameBindingsSlotSender sends the ListHostNameBindingsSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListHostNameBindingsSlotSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListHostNameBindingsSlotResponder handles the response to the ListHostNameBindingsSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) ListHostNameBindingsSlotResponder(resp *http.Response) (result HostNameBindingCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListHostNameBindingsSlotNextResults retrieves the next set of results, if any. +func (client AppsClient) ListHostNameBindingsSlotNextResults(lastResults HostNameBindingCollection) (result HostNameBindingCollection, err error) { + req, err := lastResults.HostNameBindingCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListHostNameBindingsSlot", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListHostNameBindingsSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListHostNameBindingsSlot", resp, "Failure sending next results request") + } + + result, err = client.ListHostNameBindingsSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListHostNameBindingsSlot", resp, "Failure responding to next results request") + } + + return +} + +// ListHybridConnectionKeys gets the send key name and value for a Hybrid +// Connection. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is the name of the web app namespaceName is the namespace for +// this hybrid connection relayName is the relay name for this hybrid +// connection +func (client AppsClient) ListHybridConnectionKeys(resourceGroupName string, name string, namespaceName string, relayName string) (result HybridConnectionKey, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "ListHybridConnectionKeys") + } + + req, err := client.ListHybridConnectionKeysPreparer(resourceGroupName, name, namespaceName, relayName) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListHybridConnectionKeys", nil, "Failure preparing request") + } + + resp, err := client.ListHybridConnectionKeysSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListHybridConnectionKeys", resp, "Failure sending request") + } + + result, err = client.ListHybridConnectionKeysResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListHybridConnectionKeys", resp, "Failure responding to request") + } + + return +} + +// ListHybridConnectionKeysPreparer prepares the ListHybridConnectionKeys request. +func (client AppsClient) ListHybridConnectionKeysPreparer(resourceGroupName string, name string, namespaceName string, relayName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "namespaceName": autorest.Encode("path", namespaceName), + "relayName": autorest.Encode("path", relayName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-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.Web/sites/{name}/hybridConnectionNamespaces/{namespaceName}/relays/{relayName}/listKeys", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListHybridConnectionKeysSender sends the ListHybridConnectionKeys request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListHybridConnectionKeysSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListHybridConnectionKeysResponder handles the response to the ListHybridConnectionKeys request. The method always +// closes the http.Response Body. +func (client AppsClient) ListHybridConnectionKeysResponder(resp *http.Response) (result HybridConnectionKey, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListHybridConnectionKeysSlot gets the send key name and value for a Hybrid +// Connection. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is the name of the web app namespaceName is the namespace for +// this hybrid connection relayName is the relay name for this hybrid +// connection slot is the name of the slot for the web app. +func (client AppsClient) ListHybridConnectionKeysSlot(resourceGroupName string, name string, namespaceName string, relayName string, slot string) (result HybridConnectionKey, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "ListHybridConnectionKeysSlot") + } + + req, err := client.ListHybridConnectionKeysSlotPreparer(resourceGroupName, name, namespaceName, relayName, slot) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListHybridConnectionKeysSlot", nil, "Failure preparing request") + } + + resp, err := client.ListHybridConnectionKeysSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListHybridConnectionKeysSlot", resp, "Failure sending request") + } + + result, err = client.ListHybridConnectionKeysSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListHybridConnectionKeysSlot", resp, "Failure responding to request") + } + + return +} + +// ListHybridConnectionKeysSlotPreparer prepares the ListHybridConnectionKeysSlot request. +func (client AppsClient) ListHybridConnectionKeysSlotPreparer(resourceGroupName string, name string, namespaceName string, relayName string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "namespaceName": autorest.Encode("path", namespaceName), + "relayName": autorest.Encode("path", relayName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-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.Web/sites/{name}/slots/{slot}/hybridConnectionNamespaces/{namespaceName}/relays/{relayName}/listKeys", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListHybridConnectionKeysSlotSender sends the ListHybridConnectionKeysSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListHybridConnectionKeysSlotSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListHybridConnectionKeysSlotResponder handles the response to the ListHybridConnectionKeysSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) ListHybridConnectionKeysSlotResponder(resp *http.Response) (result HybridConnectionKey, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListHybridConnections retrieves all Service Bus Hybrid Connections used by +// this Web App. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is the name of the web app +func (client AppsClient) ListHybridConnections(resourceGroupName string, name string) (result HybridConnection, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "ListHybridConnections") + } + + req, err := client.ListHybridConnectionsPreparer(resourceGroupName, name) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListHybridConnections", nil, "Failure preparing request") + } + + resp, err := client.ListHybridConnectionsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListHybridConnections", resp, "Failure sending request") + } + + result, err = client.ListHybridConnectionsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListHybridConnections", resp, "Failure responding to request") + } + + return +} + +// ListHybridConnectionsPreparer prepares the ListHybridConnections request. +func (client AppsClient) ListHybridConnectionsPreparer(resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-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.Web/sites/{name}/hybridConnectionRelays", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListHybridConnectionsSender sends the ListHybridConnections request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListHybridConnectionsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListHybridConnectionsResponder handles the response to the ListHybridConnections request. The method always +// closes the http.Response Body. +func (client AppsClient) ListHybridConnectionsResponder(resp *http.Response) (result HybridConnection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListHybridConnectionsSlot retrieves all Service Bus Hybrid Connections used +// by this Web App. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is the name of the web app slot is the name of the slot for +// the web app. +func (client AppsClient) ListHybridConnectionsSlot(resourceGroupName string, name string, slot string) (result HybridConnection, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "ListHybridConnectionsSlot") + } + + req, err := client.ListHybridConnectionsSlotPreparer(resourceGroupName, name, slot) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListHybridConnectionsSlot", nil, "Failure preparing request") + } + + resp, err := client.ListHybridConnectionsSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListHybridConnectionsSlot", resp, "Failure sending request") + } + + result, err = client.ListHybridConnectionsSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListHybridConnectionsSlot", resp, "Failure responding to request") + } + + return +} + +// ListHybridConnectionsSlotPreparer prepares the ListHybridConnectionsSlot request. +func (client AppsClient) ListHybridConnectionsSlotPreparer(resourceGroupName string, name string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-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.Web/sites/{name}/slots/{slot}/hybridConnectionRelays", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListHybridConnectionsSlotSender sends the ListHybridConnectionsSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListHybridConnectionsSlotSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListHybridConnectionsSlotResponder handles the response to the ListHybridConnectionsSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) ListHybridConnectionsSlotResponder(resp *http.Response) (result HybridConnection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListInstanceDeployments list deployments for an app, or a deployment slot, +// or for an instance of a scaled-out app. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. instanceID is the ID of a specific +// scaled-out instance. This is the value of the name property in the JSON +// response from "GET api/sites/{siteName}/instances" +func (client AppsClient) ListInstanceDeployments(resourceGroupName string, name string, instanceID string) (result DeploymentCollection, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "ListInstanceDeployments") + } + + req, err := client.ListInstanceDeploymentsPreparer(resourceGroupName, name, instanceID) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListInstanceDeployments", nil, "Failure preparing request") + } + + resp, err := client.ListInstanceDeploymentsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListInstanceDeployments", resp, "Failure sending request") + } + + result, err = client.ListInstanceDeploymentsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListInstanceDeployments", resp, "Failure responding to request") + } + + return +} + +// ListInstanceDeploymentsPreparer prepares the ListInstanceDeployments request. +func (client AppsClient) ListInstanceDeploymentsPreparer(resourceGroupName string, name string, instanceID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "instanceId": autorest.Encode("path", instanceID), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-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.Web/sites/{name}/instances/{instanceId}/deployments", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListInstanceDeploymentsSender sends the ListInstanceDeployments request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListInstanceDeploymentsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListInstanceDeploymentsResponder handles the response to the ListInstanceDeployments request. The method always +// closes the http.Response Body. +func (client AppsClient) ListInstanceDeploymentsResponder(resp *http.Response) (result DeploymentCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListInstanceDeploymentsNextResults retrieves the next set of results, if any. +func (client AppsClient) ListInstanceDeploymentsNextResults(lastResults DeploymentCollection) (result DeploymentCollection, err error) { + req, err := lastResults.DeploymentCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListInstanceDeployments", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListInstanceDeploymentsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListInstanceDeployments", resp, "Failure sending next results request") + } + + result, err = client.ListInstanceDeploymentsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListInstanceDeployments", resp, "Failure responding to next results request") + } + + return +} + +// ListInstanceDeploymentsSlot list deployments for an app, or a deployment +// slot, or for an instance of a scaled-out app. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. slot is name of the deployment slot. If a +// slot is not specified, the API returns deployments for the production slot. +// instanceID is the ID of a specific scaled-out instance. This is the value of +// the name property in the JSON response from "GET +// api/sites/{siteName}/instances" +func (client AppsClient) ListInstanceDeploymentsSlot(resourceGroupName string, name string, slot string, instanceID string) (result DeploymentCollection, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "ListInstanceDeploymentsSlot") + } + + req, err := client.ListInstanceDeploymentsSlotPreparer(resourceGroupName, name, slot, instanceID) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListInstanceDeploymentsSlot", nil, "Failure preparing request") + } + + resp, err := client.ListInstanceDeploymentsSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListInstanceDeploymentsSlot", resp, "Failure sending request") + } + + result, err = client.ListInstanceDeploymentsSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListInstanceDeploymentsSlot", resp, "Failure responding to request") + } + + return +} + +// ListInstanceDeploymentsSlotPreparer prepares the ListInstanceDeploymentsSlot request. +func (client AppsClient) ListInstanceDeploymentsSlotPreparer(resourceGroupName string, name string, slot string, instanceID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "instanceId": autorest.Encode("path", instanceID), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-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.Web/sites/{name}/slots/{slot}/instances/{instanceId}/deployments", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListInstanceDeploymentsSlotSender sends the ListInstanceDeploymentsSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListInstanceDeploymentsSlotSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListInstanceDeploymentsSlotResponder handles the response to the ListInstanceDeploymentsSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) ListInstanceDeploymentsSlotResponder(resp *http.Response) (result DeploymentCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListInstanceDeploymentsSlotNextResults retrieves the next set of results, if any. +func (client AppsClient) ListInstanceDeploymentsSlotNextResults(lastResults DeploymentCollection) (result DeploymentCollection, err error) { + req, err := lastResults.DeploymentCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListInstanceDeploymentsSlot", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListInstanceDeploymentsSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListInstanceDeploymentsSlot", resp, "Failure sending next results request") + } + + result, err = client.ListInstanceDeploymentsSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListInstanceDeploymentsSlot", resp, "Failure responding to next results request") + } + + return +} + +// ListInstanceIdentifiers gets all scale-out instances of an app. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. +func (client AppsClient) ListInstanceIdentifiers(resourceGroupName string, name string) (result AppInstanceCollection, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "ListInstanceIdentifiers") + } + + req, err := client.ListInstanceIdentifiersPreparer(resourceGroupName, name) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListInstanceIdentifiers", nil, "Failure preparing request") + } + + resp, err := client.ListInstanceIdentifiersSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListInstanceIdentifiers", resp, "Failure sending request") + } + + result, err = client.ListInstanceIdentifiersResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListInstanceIdentifiers", resp, "Failure responding to request") + } + + return +} + +// ListInstanceIdentifiersPreparer prepares the ListInstanceIdentifiers request. +func (client AppsClient) ListInstanceIdentifiersPreparer(resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-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.Web/sites/{name}/instances", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListInstanceIdentifiersSender sends the ListInstanceIdentifiers request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListInstanceIdentifiersSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListInstanceIdentifiersResponder handles the response to the ListInstanceIdentifiers request. The method always +// closes the http.Response Body. +func (client AppsClient) ListInstanceIdentifiersResponder(resp *http.Response) (result AppInstanceCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListInstanceIdentifiersNextResults retrieves the next set of results, if any. +func (client AppsClient) ListInstanceIdentifiersNextResults(lastResults AppInstanceCollection) (result AppInstanceCollection, err error) { + req, err := lastResults.AppInstanceCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListInstanceIdentifiers", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListInstanceIdentifiersSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListInstanceIdentifiers", resp, "Failure sending next results request") + } + + result, err = client.ListInstanceIdentifiersResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListInstanceIdentifiers", resp, "Failure responding to next results request") + } + + return +} + +// ListInstanceIdentifiersSlot gets all scale-out instances of an app. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. slot is name of the deployment slot. If a +// slot is not specified, the API gets the production slot instances. +func (client AppsClient) ListInstanceIdentifiersSlot(resourceGroupName string, name string, slot string) (result AppInstanceCollection, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "ListInstanceIdentifiersSlot") + } + + req, err := client.ListInstanceIdentifiersSlotPreparer(resourceGroupName, name, slot) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListInstanceIdentifiersSlot", nil, "Failure preparing request") + } + + resp, err := client.ListInstanceIdentifiersSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListInstanceIdentifiersSlot", resp, "Failure sending request") + } + + result, err = client.ListInstanceIdentifiersSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListInstanceIdentifiersSlot", resp, "Failure responding to request") + } + + return +} + +// ListInstanceIdentifiersSlotPreparer prepares the ListInstanceIdentifiersSlot request. +func (client AppsClient) ListInstanceIdentifiersSlotPreparer(resourceGroupName string, name string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-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.Web/sites/{name}/slots/{slot}/instances", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListInstanceIdentifiersSlotSender sends the ListInstanceIdentifiersSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListInstanceIdentifiersSlotSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListInstanceIdentifiersSlotResponder handles the response to the ListInstanceIdentifiersSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) ListInstanceIdentifiersSlotResponder(resp *http.Response) (result AppInstanceCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListInstanceIdentifiersSlotNextResults retrieves the next set of results, if any. +func (client AppsClient) ListInstanceIdentifiersSlotNextResults(lastResults AppInstanceCollection) (result AppInstanceCollection, err error) { + req, err := lastResults.AppInstanceCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListInstanceIdentifiersSlot", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListInstanceIdentifiersSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListInstanceIdentifiersSlot", resp, "Failure sending next results request") + } + + result, err = client.ListInstanceIdentifiersSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListInstanceIdentifiersSlot", resp, "Failure responding to next results request") + } + + return +} + +// ListMetadata gets the metadata of an app. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. +func (client AppsClient) ListMetadata(resourceGroupName string, name string) (result StringDictionary, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "ListMetadata") + } + + req, err := client.ListMetadataPreparer(resourceGroupName, name) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListMetadata", nil, "Failure preparing request") + } + + resp, err := client.ListMetadataSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListMetadata", resp, "Failure sending request") + } + + result, err = client.ListMetadataResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListMetadata", resp, "Failure responding to request") + } + + return +} + +// ListMetadataPreparer prepares the ListMetadata request. +func (client AppsClient) ListMetadataPreparer(resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-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.Web/sites/{name}/config/metadata/list", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListMetadataSender sends the ListMetadata request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListMetadataSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListMetadataResponder handles the response to the ListMetadata request. The method always +// closes the http.Response Body. +func (client AppsClient) ListMetadataResponder(resp *http.Response) (result StringDictionary, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListMetadataSlot gets the metadata of an app. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. slot is name of the deployment slot. If a +// slot is not specified, the API will get the metadata for the production +// slot. +func (client AppsClient) ListMetadataSlot(resourceGroupName string, name string, slot string) (result StringDictionary, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "ListMetadataSlot") + } + + req, err := client.ListMetadataSlotPreparer(resourceGroupName, name, slot) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListMetadataSlot", nil, "Failure preparing request") + } + + resp, err := client.ListMetadataSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListMetadataSlot", resp, "Failure sending request") + } + + result, err = client.ListMetadataSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListMetadataSlot", resp, "Failure responding to request") + } + + return +} + +// ListMetadataSlotPreparer prepares the ListMetadataSlot request. +func (client AppsClient) ListMetadataSlotPreparer(resourceGroupName string, name string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-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.Web/sites/{name}/slots/{slot}/config/metadata/list", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListMetadataSlotSender sends the ListMetadataSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListMetadataSlotSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListMetadataSlotResponder handles the response to the ListMetadataSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) ListMetadataSlotResponder(resp *http.Response) (result StringDictionary, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListMetricDefinitions gets all metric definitions of an app (or deployment +// slot, if specified). +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. +func (client AppsClient) ListMetricDefinitions(resourceGroupName string, name string) (result ResourceMetricDefinitionCollection, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "ListMetricDefinitions") + } + + req, err := client.ListMetricDefinitionsPreparer(resourceGroupName, name) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListMetricDefinitions", nil, "Failure preparing request") + } + + resp, err := client.ListMetricDefinitionsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListMetricDefinitions", resp, "Failure sending request") + } + + result, err = client.ListMetricDefinitionsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListMetricDefinitions", resp, "Failure responding to request") + } + + return +} + +// ListMetricDefinitionsPreparer prepares the ListMetricDefinitions request. +func (client AppsClient) ListMetricDefinitionsPreparer(resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-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.Web/sites/{name}/metricdefinitions", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListMetricDefinitionsSender sends the ListMetricDefinitions request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListMetricDefinitionsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListMetricDefinitionsResponder handles the response to the ListMetricDefinitions request. The method always +// closes the http.Response Body. +func (client AppsClient) ListMetricDefinitionsResponder(resp *http.Response) (result ResourceMetricDefinitionCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListMetricDefinitionsNextResults retrieves the next set of results, if any. +func (client AppsClient) ListMetricDefinitionsNextResults(lastResults ResourceMetricDefinitionCollection) (result ResourceMetricDefinitionCollection, err error) { + req, err := lastResults.ResourceMetricDefinitionCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListMetricDefinitions", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListMetricDefinitionsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListMetricDefinitions", resp, "Failure sending next results request") + } + + result, err = client.ListMetricDefinitionsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListMetricDefinitions", resp, "Failure responding to next results request") + } + + return +} + +// ListMetricDefinitionsSlot gets all metric definitions of an app (or +// deployment slot, if specified). +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. slot is name of the deployment slot. If a +// slot is not specified, the API will get metric definitions of the production +// slot. +func (client AppsClient) ListMetricDefinitionsSlot(resourceGroupName string, name string, slot string) (result ResourceMetricDefinitionCollection, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "ListMetricDefinitionsSlot") + } + + req, err := client.ListMetricDefinitionsSlotPreparer(resourceGroupName, name, slot) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListMetricDefinitionsSlot", nil, "Failure preparing request") + } + + resp, err := client.ListMetricDefinitionsSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListMetricDefinitionsSlot", resp, "Failure sending request") + } + + result, err = client.ListMetricDefinitionsSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListMetricDefinitionsSlot", resp, "Failure responding to request") + } + + return +} + +// ListMetricDefinitionsSlotPreparer prepares the ListMetricDefinitionsSlot request. +func (client AppsClient) ListMetricDefinitionsSlotPreparer(resourceGroupName string, name string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-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.Web/sites/{name}/slots/{slot}/metricdefinitions", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListMetricDefinitionsSlotSender sends the ListMetricDefinitionsSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListMetricDefinitionsSlotSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListMetricDefinitionsSlotResponder handles the response to the ListMetricDefinitionsSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) ListMetricDefinitionsSlotResponder(resp *http.Response) (result ResourceMetricDefinitionCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListMetricDefinitionsSlotNextResults retrieves the next set of results, if any. +func (client AppsClient) ListMetricDefinitionsSlotNextResults(lastResults ResourceMetricDefinitionCollection) (result ResourceMetricDefinitionCollection, err error) { + req, err := lastResults.ResourceMetricDefinitionCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListMetricDefinitionsSlot", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListMetricDefinitionsSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListMetricDefinitionsSlot", resp, "Failure sending next results request") + } + + result, err = client.ListMetricDefinitionsSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListMetricDefinitionsSlot", resp, "Failure responding to next results request") + } + + return +} + +// ListMetrics gets performance metrics of an app (or deployment slot, if +// specified). +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. details is specify "true" to include +// metric details in the response. It is "false" by default. filter is return +// only metrics specified in the filter (using OData syntax). For example: +// $filter=(name.value eq 'Metric1' or name.value eq 'Metric2') and startTime +// eq '2014-01-01T00:00:00Z' and endTime eq '2014-12-31T23:59:59Z' and +// timeGrain eq duration'[Hour|Minute|Day]'. +func (client AppsClient) ListMetrics(resourceGroupName string, name string, details *bool, filter string) (result ResourceMetricCollection, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "ListMetrics") + } + + req, err := client.ListMetricsPreparer(resourceGroupName, name, details, filter) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListMetrics", nil, "Failure preparing request") + } + + resp, err := client.ListMetricsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListMetrics", resp, "Failure sending request") + } + + result, err = client.ListMetricsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListMetrics", resp, "Failure responding to request") + } + + return +} + +// ListMetricsPreparer prepares the ListMetrics request. +func (client AppsClient) ListMetricsPreparer(resourceGroupName string, name string, details *bool, filter string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if details != nil { + queryParameters["details"] = autorest.Encode("query", *details) + } + if len(filter) > 0 { + queryParameters["$filter"] = filter + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/metrics", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListMetricsSender sends the ListMetrics request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListMetricsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListMetricsResponder handles the response to the ListMetrics request. The method always +// closes the http.Response Body. +func (client AppsClient) ListMetricsResponder(resp *http.Response) (result ResourceMetricCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListMetricsNextResults retrieves the next set of results, if any. +func (client AppsClient) ListMetricsNextResults(lastResults ResourceMetricCollection) (result ResourceMetricCollection, err error) { + req, err := lastResults.ResourceMetricCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListMetrics", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListMetricsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListMetrics", resp, "Failure sending next results request") + } + + result, err = client.ListMetricsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListMetrics", resp, "Failure responding to next results request") + } + + return +} + +// ListMetricsSlot gets performance metrics of an app (or deployment slot, if +// specified). +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. slot is name of the deployment slot. If a +// slot is not specified, the API will get metrics of the production slot. +// details is specify "true" to include metric details in the response. It is +// "false" by default. filter is return only metrics specified in the filter +// (using OData syntax). For example: $filter=(name.value eq 'Metric1' or +// name.value eq 'Metric2') and startTime eq '2014-01-01T00:00:00Z' and endTime +// eq '2014-12-31T23:59:59Z' and timeGrain eq duration'[Hour|Minute|Day]'. +func (client AppsClient) ListMetricsSlot(resourceGroupName string, name string, slot string, details *bool, filter string) (result ResourceMetricCollection, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "ListMetricsSlot") + } + + req, err := client.ListMetricsSlotPreparer(resourceGroupName, name, slot, details, filter) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListMetricsSlot", nil, "Failure preparing request") + } + + resp, err := client.ListMetricsSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListMetricsSlot", resp, "Failure sending request") + } + + result, err = client.ListMetricsSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListMetricsSlot", resp, "Failure responding to request") + } + + return +} + +// ListMetricsSlotPreparer prepares the ListMetricsSlot request. +func (client AppsClient) ListMetricsSlotPreparer(resourceGroupName string, name string, slot string, details *bool, filter string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if details != nil { + queryParameters["details"] = autorest.Encode("query", *details) + } + if len(filter) > 0 { + queryParameters["$filter"] = filter + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/metrics", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListMetricsSlotSender sends the ListMetricsSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListMetricsSlotSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListMetricsSlotResponder handles the response to the ListMetricsSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) ListMetricsSlotResponder(resp *http.Response) (result ResourceMetricCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListMetricsSlotNextResults retrieves the next set of results, if any. +func (client AppsClient) ListMetricsSlotNextResults(lastResults ResourceMetricCollection) (result ResourceMetricCollection, err error) { + req, err := lastResults.ResourceMetricCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListMetricsSlot", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListMetricsSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListMetricsSlot", resp, "Failure sending next results request") + } + + result, err = client.ListMetricsSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListMetricsSlot", resp, "Failure responding to next results request") + } + + return +} + +// ListNetworkFeatures gets all network features used by the app (or deployment +// slot, if specified). +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. view is the type of view. This can either +// be "summary" or "detailed". +func (client AppsClient) ListNetworkFeatures(resourceGroupName string, name string, view string) (result NetworkFeatures, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "ListNetworkFeatures") + } + + req, err := client.ListNetworkFeaturesPreparer(resourceGroupName, name, view) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListNetworkFeatures", nil, "Failure preparing request") + } + + resp, err := client.ListNetworkFeaturesSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListNetworkFeatures", resp, "Failure sending request") + } + + result, err = client.ListNetworkFeaturesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListNetworkFeatures", resp, "Failure responding to request") + } + + return +} + +// ListNetworkFeaturesPreparer prepares the ListNetworkFeatures request. +func (client AppsClient) ListNetworkFeaturesPreparer(resourceGroupName string, name string, view string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "view": autorest.Encode("path", view), + } + + const APIVersion = "2016-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.Web/sites/{name}/networkFeatures/{view}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListNetworkFeaturesSender sends the ListNetworkFeatures request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListNetworkFeaturesSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListNetworkFeaturesResponder handles the response to the ListNetworkFeatures request. The method always +// closes the http.Response Body. +func (client AppsClient) ListNetworkFeaturesResponder(resp *http.Response) (result NetworkFeatures, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNotFound), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListNetworkFeaturesSlot gets all network features used by the app (or +// deployment slot, if specified). +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. view is the type of view. This can either +// be "summary" or "detailed". slot is name of the deployment slot. If a slot +// is not specified, the API will get network features for the production slot. +func (client AppsClient) ListNetworkFeaturesSlot(resourceGroupName string, name string, view string, slot string) (result NetworkFeatures, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "ListNetworkFeaturesSlot") + } + + req, err := client.ListNetworkFeaturesSlotPreparer(resourceGroupName, name, view, slot) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListNetworkFeaturesSlot", nil, "Failure preparing request") + } + + resp, err := client.ListNetworkFeaturesSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListNetworkFeaturesSlot", resp, "Failure sending request") + } + + result, err = client.ListNetworkFeaturesSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListNetworkFeaturesSlot", resp, "Failure responding to request") + } + + return +} + +// ListNetworkFeaturesSlotPreparer prepares the ListNetworkFeaturesSlot request. +func (client AppsClient) ListNetworkFeaturesSlotPreparer(resourceGroupName string, name string, view string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "view": autorest.Encode("path", view), + } + + const APIVersion = "2016-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.Web/sites/{name}/slots/{slot}/networkFeatures/{view}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListNetworkFeaturesSlotSender sends the ListNetworkFeaturesSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListNetworkFeaturesSlotSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListNetworkFeaturesSlotResponder handles the response to the ListNetworkFeaturesSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) ListNetworkFeaturesSlotResponder(resp *http.Response) (result NetworkFeatures, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNotFound), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListPerfMonCounters gets perfmon counters for web app. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of web app filter is return only usages/metrics +// specified in the filter. Filter conforms to odata syntax. Example: +// $filter=(startTime eq '2014-01-01T00:00:00Z' and endTime eq +// '2014-12-31T23:59:59Z' and timeGrain eq duration'[Hour|Minute|Day]'. +func (client AppsClient) ListPerfMonCounters(resourceGroupName string, name string, filter string) (result PerfMonCounterCollection, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "ListPerfMonCounters") + } + + req, err := client.ListPerfMonCountersPreparer(resourceGroupName, name, filter) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListPerfMonCounters", nil, "Failure preparing request") + } + + resp, err := client.ListPerfMonCountersSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListPerfMonCounters", resp, "Failure sending request") + } + + result, err = client.ListPerfMonCountersResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListPerfMonCounters", resp, "Failure responding to request") + } + + return +} + +// ListPerfMonCountersPreparer prepares the ListPerfMonCounters request. +func (client AppsClient) ListPerfMonCountersPreparer(resourceGroupName string, name string, filter string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(filter) > 0 { + queryParameters["$filter"] = filter + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/perfcounters", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListPerfMonCountersSender sends the ListPerfMonCounters request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListPerfMonCountersSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListPerfMonCountersResponder handles the response to the ListPerfMonCounters request. The method always +// closes the http.Response Body. +func (client AppsClient) ListPerfMonCountersResponder(resp *http.Response) (result PerfMonCounterCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListPerfMonCountersNextResults retrieves the next set of results, if any. +func (client AppsClient) ListPerfMonCountersNextResults(lastResults PerfMonCounterCollection) (result PerfMonCounterCollection, err error) { + req, err := lastResults.PerfMonCounterCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListPerfMonCounters", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListPerfMonCountersSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListPerfMonCounters", resp, "Failure sending next results request") + } + + result, err = client.ListPerfMonCountersResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListPerfMonCounters", resp, "Failure responding to next results request") + } + + return +} + +// ListPerfMonCountersSlot gets perfmon counters for web app. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of web app slot is name of web app slot. If not +// specified then will default to production slot. **** CURRENTLY UNUSED ***** +// filter is return only usages/metrics specified in the filter. Filter +// conforms to odata syntax. Example: $filter=(startTime eq +// '2014-01-01T00:00:00Z' and endTime eq '2014-12-31T23:59:59Z' and timeGrain +// eq duration'[Hour|Minute|Day]'. +func (client AppsClient) ListPerfMonCountersSlot(resourceGroupName string, name string, slot string, filter string) (result PerfMonCounterCollection, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "ListPerfMonCountersSlot") + } + + req, err := client.ListPerfMonCountersSlotPreparer(resourceGroupName, name, slot, filter) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListPerfMonCountersSlot", nil, "Failure preparing request") + } + + resp, err := client.ListPerfMonCountersSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListPerfMonCountersSlot", resp, "Failure sending request") + } + + result, err = client.ListPerfMonCountersSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListPerfMonCountersSlot", resp, "Failure responding to request") + } + + return +} + +// ListPerfMonCountersSlotPreparer prepares the ListPerfMonCountersSlot request. +func (client AppsClient) ListPerfMonCountersSlotPreparer(resourceGroupName string, name string, slot string, filter string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(filter) > 0 { + queryParameters["$filter"] = filter + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/perfcounters", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListPerfMonCountersSlotSender sends the ListPerfMonCountersSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListPerfMonCountersSlotSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListPerfMonCountersSlotResponder handles the response to the ListPerfMonCountersSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) ListPerfMonCountersSlotResponder(resp *http.Response) (result PerfMonCounterCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListPerfMonCountersSlotNextResults retrieves the next set of results, if any. +func (client AppsClient) ListPerfMonCountersSlotNextResults(lastResults PerfMonCounterCollection) (result PerfMonCounterCollection, err error) { + req, err := lastResults.PerfMonCounterCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListPerfMonCountersSlot", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListPerfMonCountersSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListPerfMonCountersSlot", resp, "Failure sending next results request") + } + + result, err = client.ListPerfMonCountersSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListPerfMonCountersSlot", resp, "Failure responding to next results request") + } + + return +} + +// ListPremierAddOns gets the premier add-ons of an app. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. +func (client AppsClient) ListPremierAddOns(resourceGroupName string, name string) (result PremierAddOn, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "ListPremierAddOns") + } + + req, err := client.ListPremierAddOnsPreparer(resourceGroupName, name) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListPremierAddOns", nil, "Failure preparing request") + } + + resp, err := client.ListPremierAddOnsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListPremierAddOns", resp, "Failure sending request") + } + + result, err = client.ListPremierAddOnsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListPremierAddOns", resp, "Failure responding to request") + } + + return +} + +// ListPremierAddOnsPreparer prepares the ListPremierAddOns request. +func (client AppsClient) ListPremierAddOnsPreparer(resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-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.Web/sites/{name}/premieraddons", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListPremierAddOnsSender sends the ListPremierAddOns request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListPremierAddOnsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListPremierAddOnsResponder handles the response to the ListPremierAddOns request. The method always +// closes the http.Response Body. +func (client AppsClient) ListPremierAddOnsResponder(resp *http.Response) (result PremierAddOn, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListPremierAddOnsSlot gets the premier add-ons of an app. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. slot is name of the deployment slot. If a +// slot is not specified, the API will get the premier add-ons for the +// production slot. +func (client AppsClient) ListPremierAddOnsSlot(resourceGroupName string, name string, slot string) (result PremierAddOn, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "ListPremierAddOnsSlot") + } + + req, err := client.ListPremierAddOnsSlotPreparer(resourceGroupName, name, slot) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListPremierAddOnsSlot", nil, "Failure preparing request") + } + + resp, err := client.ListPremierAddOnsSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListPremierAddOnsSlot", resp, "Failure sending request") + } + + result, err = client.ListPremierAddOnsSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListPremierAddOnsSlot", resp, "Failure responding to request") + } + + return +} + +// ListPremierAddOnsSlotPreparer prepares the ListPremierAddOnsSlot request. +func (client AppsClient) ListPremierAddOnsSlotPreparer(resourceGroupName string, name string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-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.Web/sites/{name}/slots/{slot}/premieraddons", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListPremierAddOnsSlotSender sends the ListPremierAddOnsSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListPremierAddOnsSlotSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListPremierAddOnsSlotResponder handles the response to the ListPremierAddOnsSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) ListPremierAddOnsSlotResponder(resp *http.Response) (result PremierAddOn, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListPublishingCredentials gets the Git/FTP publishing credentials of an app. +// This method may poll for completion. Polling can be canceled by passing the +// cancel channel argument. The channel will be used to cancel polling and any +// outstanding HTTP requests. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. +func (client AppsClient) ListPublishingCredentials(resourceGroupName string, name string, cancel <-chan struct{}) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "ListPublishingCredentials") + } + + req, err := client.ListPublishingCredentialsPreparer(resourceGroupName, name, cancel) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListPublishingCredentials", nil, "Failure preparing request") + } + + resp, err := client.ListPublishingCredentialsSender(req) + if err != nil { + result.Response = resp + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListPublishingCredentials", resp, "Failure sending request") + } + + result, err = client.ListPublishingCredentialsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListPublishingCredentials", resp, "Failure responding to request") + } + + return +} + +// ListPublishingCredentialsPreparer prepares the ListPublishingCredentials request. +func (client AppsClient) ListPublishingCredentialsPreparer(resourceGroupName string, name string, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-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.Web/sites/{name}/config/publishingcredentials/list", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// ListPublishingCredentialsSender sends the ListPublishingCredentials request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListPublishingCredentialsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// ListPublishingCredentialsResponder handles the response to the ListPublishingCredentials request. The method always +// closes the http.Response Body. +func (client AppsClient) ListPublishingCredentialsResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// ListPublishingCredentialsSlot gets the Git/FTP publishing credentials of an +// app. This method may poll for completion. Polling can be canceled by passing +// the cancel channel argument. The channel will be used to cancel polling and +// any outstanding HTTP requests. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. slot is name of the deployment slot. If a +// slot is not specified, the API will get the publishing credentials for the +// production slot. +func (client AppsClient) ListPublishingCredentialsSlot(resourceGroupName string, name string, slot string, cancel <-chan struct{}) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "ListPublishingCredentialsSlot") + } + + req, err := client.ListPublishingCredentialsSlotPreparer(resourceGroupName, name, slot, cancel) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListPublishingCredentialsSlot", nil, "Failure preparing request") + } + + resp, err := client.ListPublishingCredentialsSlotSender(req) + if err != nil { + result.Response = resp + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListPublishingCredentialsSlot", resp, "Failure sending request") + } + + result, err = client.ListPublishingCredentialsSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListPublishingCredentialsSlot", resp, "Failure responding to request") + } + + return +} + +// ListPublishingCredentialsSlotPreparer prepares the ListPublishingCredentialsSlot request. +func (client AppsClient) ListPublishingCredentialsSlotPreparer(resourceGroupName string, name string, slot string, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-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.Web/sites/{name}/slots/{slot}/config/publishingcredentials/list", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// ListPublishingCredentialsSlotSender sends the ListPublishingCredentialsSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListPublishingCredentialsSlotSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// ListPublishingCredentialsSlotResponder handles the response to the ListPublishingCredentialsSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) ListPublishingCredentialsSlotResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// ListPublishingProfileXMLWithSecrets gets the publishing profile for an app +// (or deployment slot, if specified). +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. publishingProfileOptions is specifies +// publishingProfileOptions for publishing profile. For example, use {"format": +// "FileZilla3"} to get a FileZilla publishing profile. +func (client AppsClient) ListPublishingProfileXMLWithSecrets(resourceGroupName string, name string, publishingProfileOptions CsmPublishingProfileOptions) (result ReadCloser, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "ListPublishingProfileXMLWithSecrets") + } + + req, err := client.ListPublishingProfileXMLWithSecretsPreparer(resourceGroupName, name, publishingProfileOptions) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListPublishingProfileXMLWithSecrets", nil, "Failure preparing request") + } + + resp, err := client.ListPublishingProfileXMLWithSecretsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListPublishingProfileXMLWithSecrets", resp, "Failure sending request") + } + + result, err = client.ListPublishingProfileXMLWithSecretsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListPublishingProfileXMLWithSecrets", resp, "Failure responding to request") + } + + return +} + +// ListPublishingProfileXMLWithSecretsPreparer prepares the ListPublishingProfileXMLWithSecrets request. +func (client AppsClient) ListPublishingProfileXMLWithSecretsPreparer(resourceGroupName string, name string, publishingProfileOptions CsmPublishingProfileOptions) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/publishxml", pathParameters), + autorest.WithJSON(publishingProfileOptions), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListPublishingProfileXMLWithSecretsSender sends the ListPublishingProfileXMLWithSecrets request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListPublishingProfileXMLWithSecretsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListPublishingProfileXMLWithSecretsResponder handles the response to the ListPublishingProfileXMLWithSecrets request. The method always +// closes the http.Response Body. +func (client AppsClient) ListPublishingProfileXMLWithSecretsResponder(resp *http.Response) (result ReadCloser, err error) { + result.Value = &resp.Body + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK)) + result.Response = autorest.Response{Response: resp} + return +} + +// ListPublishingProfileXMLWithSecretsSlot gets the publishing profile for an +// app (or deployment slot, if specified). +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. publishingProfileOptions is specifies +// publishingProfileOptions for publishing profile. For example, use {"format": +// "FileZilla3"} to get a FileZilla publishing profile. slot is name of the +// deployment slot. If a slot is not specified, the API will get the publishing +// profile for the production slot. +func (client AppsClient) ListPublishingProfileXMLWithSecretsSlot(resourceGroupName string, name string, publishingProfileOptions CsmPublishingProfileOptions, slot string) (result ReadCloser, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "ListPublishingProfileXMLWithSecretsSlot") + } + + req, err := client.ListPublishingProfileXMLWithSecretsSlotPreparer(resourceGroupName, name, publishingProfileOptions, slot) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListPublishingProfileXMLWithSecretsSlot", nil, "Failure preparing request") + } + + resp, err := client.ListPublishingProfileXMLWithSecretsSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListPublishingProfileXMLWithSecretsSlot", resp, "Failure sending request") + } + + result, err = client.ListPublishingProfileXMLWithSecretsSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListPublishingProfileXMLWithSecretsSlot", resp, "Failure responding to request") + } + + return +} + +// ListPublishingProfileXMLWithSecretsSlotPreparer prepares the ListPublishingProfileXMLWithSecretsSlot request. +func (client AppsClient) ListPublishingProfileXMLWithSecretsSlotPreparer(resourceGroupName string, name string, publishingProfileOptions CsmPublishingProfileOptions, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/publishxml", pathParameters), + autorest.WithJSON(publishingProfileOptions), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListPublishingProfileXMLWithSecretsSlotSender sends the ListPublishingProfileXMLWithSecretsSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListPublishingProfileXMLWithSecretsSlotSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListPublishingProfileXMLWithSecretsSlotResponder handles the response to the ListPublishingProfileXMLWithSecretsSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) ListPublishingProfileXMLWithSecretsSlotResponder(resp *http.Response) (result ReadCloser, err error) { + result.Value = &resp.Body + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK)) + result.Response = autorest.Response{Response: resp} + return +} + +// ListRelayServiceConnections gets hybrid connections configured for an app +// (or deployment slot, if specified). +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. +func (client AppsClient) ListRelayServiceConnections(resourceGroupName string, name string) (result RelayServiceConnectionEntity, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "ListRelayServiceConnections") + } + + req, err := client.ListRelayServiceConnectionsPreparer(resourceGroupName, name) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListRelayServiceConnections", nil, "Failure preparing request") + } + + resp, err := client.ListRelayServiceConnectionsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListRelayServiceConnections", resp, "Failure sending request") + } + + result, err = client.ListRelayServiceConnectionsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListRelayServiceConnections", resp, "Failure responding to request") + } + + return +} + +// ListRelayServiceConnectionsPreparer prepares the ListRelayServiceConnections request. +func (client AppsClient) ListRelayServiceConnectionsPreparer(resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-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.Web/sites/{name}/hybridconnection", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListRelayServiceConnectionsSender sends the ListRelayServiceConnections request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListRelayServiceConnectionsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListRelayServiceConnectionsResponder handles the response to the ListRelayServiceConnections request. The method always +// closes the http.Response Body. +func (client AppsClient) ListRelayServiceConnectionsResponder(resp *http.Response) (result RelayServiceConnectionEntity, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListRelayServiceConnectionsSlot gets hybrid connections configured for an +// app (or deployment slot, if specified). +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. slot is name of the deployment slot. If a +// slot is not specified, the API will get hybrid connections for the +// production slot. +func (client AppsClient) ListRelayServiceConnectionsSlot(resourceGroupName string, name string, slot string) (result RelayServiceConnectionEntity, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "ListRelayServiceConnectionsSlot") + } + + req, err := client.ListRelayServiceConnectionsSlotPreparer(resourceGroupName, name, slot) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListRelayServiceConnectionsSlot", nil, "Failure preparing request") + } + + resp, err := client.ListRelayServiceConnectionsSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListRelayServiceConnectionsSlot", resp, "Failure sending request") + } + + result, err = client.ListRelayServiceConnectionsSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListRelayServiceConnectionsSlot", resp, "Failure responding to request") + } + + return +} + +// ListRelayServiceConnectionsSlotPreparer prepares the ListRelayServiceConnectionsSlot request. +func (client AppsClient) ListRelayServiceConnectionsSlotPreparer(resourceGroupName string, name string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-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.Web/sites/{name}/slots/{slot}/hybridconnection", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListRelayServiceConnectionsSlotSender sends the ListRelayServiceConnectionsSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListRelayServiceConnectionsSlotSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListRelayServiceConnectionsSlotResponder handles the response to the ListRelayServiceConnectionsSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) ListRelayServiceConnectionsSlotResponder(resp *http.Response) (result RelayServiceConnectionEntity, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListSitePushSettings gets the Push settings associated with web app. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of web app +func (client AppsClient) ListSitePushSettings(resourceGroupName string, name string) (result PushSettings, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "ListSitePushSettings") + } + + req, err := client.ListSitePushSettingsPreparer(resourceGroupName, name) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListSitePushSettings", nil, "Failure preparing request") + } + + resp, err := client.ListSitePushSettingsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListSitePushSettings", resp, "Failure sending request") + } + + result, err = client.ListSitePushSettingsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListSitePushSettings", resp, "Failure responding to request") + } + + return +} + +// ListSitePushSettingsPreparer prepares the ListSitePushSettings request. +func (client AppsClient) ListSitePushSettingsPreparer(resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-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.Web/sites/{name}/config/pushsettings/list", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSitePushSettingsSender sends the ListSitePushSettings request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListSitePushSettingsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListSitePushSettingsResponder handles the response to the ListSitePushSettings request. The method always +// closes the http.Response Body. +func (client AppsClient) ListSitePushSettingsResponder(resp *http.Response) (result PushSettings, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListSitePushSettingsSlot gets the Push settings associated with web app. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of web app slot is name of web app slot. If not +// specified then will default to production slot. +func (client AppsClient) ListSitePushSettingsSlot(resourceGroupName string, name string, slot string) (result PushSettings, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "ListSitePushSettingsSlot") + } + + req, err := client.ListSitePushSettingsSlotPreparer(resourceGroupName, name, slot) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListSitePushSettingsSlot", nil, "Failure preparing request") + } + + resp, err := client.ListSitePushSettingsSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListSitePushSettingsSlot", resp, "Failure sending request") + } + + result, err = client.ListSitePushSettingsSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListSitePushSettingsSlot", resp, "Failure responding to request") + } + + return +} + +// ListSitePushSettingsSlotPreparer prepares the ListSitePushSettingsSlot request. +func (client AppsClient) ListSitePushSettingsSlotPreparer(resourceGroupName string, name string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-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.Web/sites/{name}/slots/{slot}/config/pushsettings/list", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSitePushSettingsSlotSender sends the ListSitePushSettingsSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListSitePushSettingsSlotSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListSitePushSettingsSlotResponder handles the response to the ListSitePushSettingsSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) ListSitePushSettingsSlotResponder(resp *http.Response) (result PushSettings, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListSlotConfigurationNames gets the names of app settings and connection +// strings that stick to the slot (not swapped). +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. +func (client AppsClient) ListSlotConfigurationNames(resourceGroupName string, name string) (result SlotConfigNamesResource, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "ListSlotConfigurationNames") + } + + req, err := client.ListSlotConfigurationNamesPreparer(resourceGroupName, name) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListSlotConfigurationNames", nil, "Failure preparing request") + } + + resp, err := client.ListSlotConfigurationNamesSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListSlotConfigurationNames", resp, "Failure sending request") + } + + result, err = client.ListSlotConfigurationNamesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListSlotConfigurationNames", resp, "Failure responding to request") + } + + return +} + +// ListSlotConfigurationNamesPreparer prepares the ListSlotConfigurationNames request. +func (client AppsClient) ListSlotConfigurationNamesPreparer(resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-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.Web/sites/{name}/config/slotConfigNames", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSlotConfigurationNamesSender sends the ListSlotConfigurationNames request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListSlotConfigurationNamesSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListSlotConfigurationNamesResponder handles the response to the ListSlotConfigurationNames request. The method always +// closes the http.Response Body. +func (client AppsClient) ListSlotConfigurationNamesResponder(resp *http.Response) (result SlotConfigNamesResource, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListSlotDifferencesFromProduction get the difference in configuration +// settings between two web app slots. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. slotSwapEntity is jSON object that +// contains the target slot name. See example. +func (client AppsClient) ListSlotDifferencesFromProduction(resourceGroupName string, name string, slotSwapEntity CsmSlotEntity) (result SlotDifferenceCollection, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}, + {TargetValue: slotSwapEntity, + Constraints: []validation.Constraint{{Target: "slotSwapEntity.TargetSlot", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "slotSwapEntity.PreserveVnet", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "ListSlotDifferencesFromProduction") + } + + req, err := client.ListSlotDifferencesFromProductionPreparer(resourceGroupName, name, slotSwapEntity) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListSlotDifferencesFromProduction", nil, "Failure preparing request") + } + + resp, err := client.ListSlotDifferencesFromProductionSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListSlotDifferencesFromProduction", resp, "Failure sending request") + } + + result, err = client.ListSlotDifferencesFromProductionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListSlotDifferencesFromProduction", resp, "Failure responding to request") + } + + return +} + +// ListSlotDifferencesFromProductionPreparer prepares the ListSlotDifferencesFromProduction request. +func (client AppsClient) ListSlotDifferencesFromProductionPreparer(resourceGroupName string, name string, slotSwapEntity CsmSlotEntity) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slotsdiffs", pathParameters), + autorest.WithJSON(slotSwapEntity), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSlotDifferencesFromProductionSender sends the ListSlotDifferencesFromProduction request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListSlotDifferencesFromProductionSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListSlotDifferencesFromProductionResponder handles the response to the ListSlotDifferencesFromProduction request. The method always +// closes the http.Response Body. +func (client AppsClient) ListSlotDifferencesFromProductionResponder(resp *http.Response) (result SlotDifferenceCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListSlotDifferencesFromProductionNextResults retrieves the next set of results, if any. +func (client AppsClient) ListSlotDifferencesFromProductionNextResults(lastResults SlotDifferenceCollection) (result SlotDifferenceCollection, err error) { + req, err := lastResults.SlotDifferenceCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListSlotDifferencesFromProduction", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListSlotDifferencesFromProductionSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListSlotDifferencesFromProduction", resp, "Failure sending next results request") + } + + result, err = client.ListSlotDifferencesFromProductionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListSlotDifferencesFromProduction", resp, "Failure responding to next results request") + } + + return +} + +// ListSlotDifferencesSlot get the difference in configuration settings between +// two web app slots. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. slotSwapEntity is jSON object that +// contains the target slot name. See example. slot is name of the source slot. +// If a slot is not specified, the production slot is used as the source slot. +func (client AppsClient) ListSlotDifferencesSlot(resourceGroupName string, name string, slotSwapEntity CsmSlotEntity, slot string) (result SlotDifferenceCollection, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}, + {TargetValue: slotSwapEntity, + Constraints: []validation.Constraint{{Target: "slotSwapEntity.TargetSlot", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "slotSwapEntity.PreserveVnet", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "ListSlotDifferencesSlot") + } + + req, err := client.ListSlotDifferencesSlotPreparer(resourceGroupName, name, slotSwapEntity, slot) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListSlotDifferencesSlot", nil, "Failure preparing request") + } + + resp, err := client.ListSlotDifferencesSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListSlotDifferencesSlot", resp, "Failure sending request") + } + + result, err = client.ListSlotDifferencesSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListSlotDifferencesSlot", resp, "Failure responding to request") + } + + return +} + +// ListSlotDifferencesSlotPreparer prepares the ListSlotDifferencesSlot request. +func (client AppsClient) ListSlotDifferencesSlotPreparer(resourceGroupName string, name string, slotSwapEntity CsmSlotEntity, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/slotsdiffs", pathParameters), + autorest.WithJSON(slotSwapEntity), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSlotDifferencesSlotSender sends the ListSlotDifferencesSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListSlotDifferencesSlotSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListSlotDifferencesSlotResponder handles the response to the ListSlotDifferencesSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) ListSlotDifferencesSlotResponder(resp *http.Response) (result SlotDifferenceCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListSlotDifferencesSlotNextResults retrieves the next set of results, if any. +func (client AppsClient) ListSlotDifferencesSlotNextResults(lastResults SlotDifferenceCollection) (result SlotDifferenceCollection, err error) { + req, err := lastResults.SlotDifferenceCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListSlotDifferencesSlot", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListSlotDifferencesSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListSlotDifferencesSlot", resp, "Failure sending next results request") + } + + result, err = client.ListSlotDifferencesSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListSlotDifferencesSlot", resp, "Failure responding to next results request") + } + + return +} + +// ListSlots gets an app's deployment slots. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. +func (client AppsClient) ListSlots(resourceGroupName string, name string) (result AppCollection, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "ListSlots") + } + + req, err := client.ListSlotsPreparer(resourceGroupName, name) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListSlots", nil, "Failure preparing request") + } + + resp, err := client.ListSlotsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListSlots", resp, "Failure sending request") + } + + result, err = client.ListSlotsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListSlots", resp, "Failure responding to request") + } + + return +} + +// ListSlotsPreparer prepares the ListSlots request. +func (client AppsClient) ListSlotsPreparer(resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-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.Web/sites/{name}/slots", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSlotsSender sends the ListSlots request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListSlotsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListSlotsResponder handles the response to the ListSlots request. The method always +// closes the http.Response Body. +func (client AppsClient) ListSlotsResponder(resp *http.Response) (result AppCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListSlotsNextResults retrieves the next set of results, if any. +func (client AppsClient) ListSlotsNextResults(lastResults AppCollection) (result AppCollection, err error) { + req, err := lastResults.AppCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListSlots", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListSlotsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListSlots", resp, "Failure sending next results request") + } + + result, err = client.ListSlotsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListSlots", resp, "Failure responding to next results request") + } + + return +} + +// ListSnapshots returns all Snapshots to the user. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is website Name +func (client AppsClient) ListSnapshots(resourceGroupName string, name string) (result SnapshotCollection, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "ListSnapshots") + } + + req, err := client.ListSnapshotsPreparer(resourceGroupName, name) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListSnapshots", nil, "Failure preparing request") + } + + resp, err := client.ListSnapshotsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListSnapshots", resp, "Failure sending request") + } + + result, err = client.ListSnapshotsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListSnapshots", resp, "Failure responding to request") + } + + return +} + +// ListSnapshotsPreparer prepares the ListSnapshots request. +func (client AppsClient) ListSnapshotsPreparer(resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-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.Web/sites/{name}/snapshots", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSnapshotsSender sends the ListSnapshots request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListSnapshotsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListSnapshotsResponder handles the response to the ListSnapshots request. The method always +// closes the http.Response Body. +func (client AppsClient) ListSnapshotsResponder(resp *http.Response) (result SnapshotCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListSnapshotsNextResults retrieves the next set of results, if any. +func (client AppsClient) ListSnapshotsNextResults(lastResults SnapshotCollection) (result SnapshotCollection, err error) { + req, err := lastResults.SnapshotCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListSnapshots", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListSnapshotsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListSnapshots", resp, "Failure sending next results request") + } + + result, err = client.ListSnapshotsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListSnapshots", resp, "Failure responding to next results request") + } + + return +} + +// ListSnapshotsSlot returns all Snapshots to the user. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is website Name slot is website Slot +func (client AppsClient) ListSnapshotsSlot(resourceGroupName string, name string, slot string) (result SnapshotCollection, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "ListSnapshotsSlot") + } + + req, err := client.ListSnapshotsSlotPreparer(resourceGroupName, name, slot) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListSnapshotsSlot", nil, "Failure preparing request") + } + + resp, err := client.ListSnapshotsSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListSnapshotsSlot", resp, "Failure sending request") + } + + result, err = client.ListSnapshotsSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListSnapshotsSlot", resp, "Failure responding to request") + } + + return +} + +// ListSnapshotsSlotPreparer prepares the ListSnapshotsSlot request. +func (client AppsClient) ListSnapshotsSlotPreparer(resourceGroupName string, name string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-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.Web/sites/{name}/slots/{slot}/snapshots", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSnapshotsSlotSender sends the ListSnapshotsSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListSnapshotsSlotSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListSnapshotsSlotResponder handles the response to the ListSnapshotsSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) ListSnapshotsSlotResponder(resp *http.Response) (result SnapshotCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListSnapshotsSlotNextResults retrieves the next set of results, if any. +func (client AppsClient) ListSnapshotsSlotNextResults(lastResults SnapshotCollection) (result SnapshotCollection, err error) { + req, err := lastResults.SnapshotCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListSnapshotsSlot", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListSnapshotsSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListSnapshotsSlot", resp, "Failure sending next results request") + } + + result, err = client.ListSnapshotsSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListSnapshotsSlot", resp, "Failure responding to next results request") + } + + return +} + +// ListUsages gets the quota usage information of an app (or deployment slot, +// if specified). +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. filter is return only information +// specified in the filter (using OData syntax). For example: +// $filter=(name.value eq 'Metric1' or name.value eq 'Metric2') and startTime +// eq '2014-01-01T00:00:00Z' and endTime eq '2014-12-31T23:59:59Z' and +// timeGrain eq duration'[Hour|Minute|Day]'. +func (client AppsClient) ListUsages(resourceGroupName string, name string, filter string) (result CsmUsageQuotaCollection, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "ListUsages") + } + + req, err := client.ListUsagesPreparer(resourceGroupName, name, filter) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListUsages", nil, "Failure preparing request") + } + + resp, err := client.ListUsagesSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListUsages", resp, "Failure sending request") + } + + result, err = client.ListUsagesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListUsages", resp, "Failure responding to request") + } + + return +} + +// ListUsagesPreparer prepares the ListUsages request. +func (client AppsClient) ListUsagesPreparer(resourceGroupName string, name string, filter string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(filter) > 0 { + queryParameters["$filter"] = filter + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/usages", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListUsagesSender sends the ListUsages request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListUsagesSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListUsagesResponder handles the response to the ListUsages request. The method always +// closes the http.Response Body. +func (client AppsClient) ListUsagesResponder(resp *http.Response) (result CsmUsageQuotaCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListUsagesNextResults retrieves the next set of results, if any. +func (client AppsClient) ListUsagesNextResults(lastResults CsmUsageQuotaCollection) (result CsmUsageQuotaCollection, err error) { + req, err := lastResults.CsmUsageQuotaCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListUsages", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListUsagesSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListUsages", resp, "Failure sending next results request") + } + + result, err = client.ListUsagesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListUsages", resp, "Failure responding to next results request") + } + + return +} + +// ListUsagesSlot gets the quota usage information of an app (or deployment +// slot, if specified). +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. slot is name of the deployment slot. If a +// slot is not specified, the API will get quota information of the production +// slot. filter is return only information specified in the filter (using OData +// syntax). For example: $filter=(name.value eq 'Metric1' or name.value eq +// 'Metric2') and startTime eq '2014-01-01T00:00:00Z' and endTime eq +// '2014-12-31T23:59:59Z' and timeGrain eq duration'[Hour|Minute|Day]'. +func (client AppsClient) ListUsagesSlot(resourceGroupName string, name string, slot string, filter string) (result CsmUsageQuotaCollection, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "ListUsagesSlot") + } + + req, err := client.ListUsagesSlotPreparer(resourceGroupName, name, slot, filter) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListUsagesSlot", nil, "Failure preparing request") + } + + resp, err := client.ListUsagesSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListUsagesSlot", resp, "Failure sending request") + } + + result, err = client.ListUsagesSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListUsagesSlot", resp, "Failure responding to request") + } + + return +} + +// ListUsagesSlotPreparer prepares the ListUsagesSlot request. +func (client AppsClient) ListUsagesSlotPreparer(resourceGroupName string, name string, slot string, filter string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(filter) > 0 { + queryParameters["$filter"] = filter + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/usages", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListUsagesSlotSender sends the ListUsagesSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListUsagesSlotSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListUsagesSlotResponder handles the response to the ListUsagesSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) ListUsagesSlotResponder(resp *http.Response) (result CsmUsageQuotaCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListUsagesSlotNextResults retrieves the next set of results, if any. +func (client AppsClient) ListUsagesSlotNextResults(lastResults CsmUsageQuotaCollection) (result CsmUsageQuotaCollection, err error) { + req, err := lastResults.CsmUsageQuotaCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListUsagesSlot", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListUsagesSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListUsagesSlot", resp, "Failure sending next results request") + } + + result, err = client.ListUsagesSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListUsagesSlot", resp, "Failure responding to next results request") + } + + return +} + +// ListVnetConnections gets the virtual networks the app (or deployment slot) +// is connected to. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. +func (client AppsClient) ListVnetConnections(resourceGroupName string, name string) (result ListVnetInfo, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "ListVnetConnections") + } + + req, err := client.ListVnetConnectionsPreparer(resourceGroupName, name) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListVnetConnections", nil, "Failure preparing request") + } + + resp, err := client.ListVnetConnectionsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListVnetConnections", resp, "Failure sending request") + } + + result, err = client.ListVnetConnectionsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListVnetConnections", resp, "Failure responding to request") + } + + return +} + +// ListVnetConnectionsPreparer prepares the ListVnetConnections request. +func (client AppsClient) ListVnetConnectionsPreparer(resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-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.Web/sites/{name}/virtualNetworkConnections", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListVnetConnectionsSender sends the ListVnetConnections request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListVnetConnectionsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListVnetConnectionsResponder handles the response to the ListVnetConnections request. The method always +// closes the http.Response Body. +func (client AppsClient) ListVnetConnectionsResponder(resp *http.Response) (result ListVnetInfo, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListVnetConnectionsSlot gets the virtual networks the app (or deployment +// slot) is connected to. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. slot is name of the deployment slot. If a +// slot is not specified, the API will get virtual network connections for the +// production slot. +func (client AppsClient) ListVnetConnectionsSlot(resourceGroupName string, name string, slot string) (result ListVnetInfo, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "ListVnetConnectionsSlot") + } + + req, err := client.ListVnetConnectionsSlotPreparer(resourceGroupName, name, slot) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListVnetConnectionsSlot", nil, "Failure preparing request") + } + + resp, err := client.ListVnetConnectionsSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListVnetConnectionsSlot", resp, "Failure sending request") + } + + result, err = client.ListVnetConnectionsSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListVnetConnectionsSlot", resp, "Failure responding to request") + } + + return +} + +// ListVnetConnectionsSlotPreparer prepares the ListVnetConnectionsSlot request. +func (client AppsClient) ListVnetConnectionsSlotPreparer(resourceGroupName string, name string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-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.Web/sites/{name}/slots/{slot}/virtualNetworkConnections", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListVnetConnectionsSlotSender sends the ListVnetConnectionsSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListVnetConnectionsSlotSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListVnetConnectionsSlotResponder handles the response to the ListVnetConnectionsSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) ListVnetConnectionsSlotResponder(resp *http.Response) (result ListVnetInfo, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// MigrateMySQL migrates a local (in-app) MySql database to a remote MySql +// database. This method may poll for completion. Polling can be canceled by +// passing the cancel channel argument. The channel will be used to cancel +// polling and any outstanding HTTP requests. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of web app migrationRequestEnvelope is mySql migration +// options +func (client AppsClient) MigrateMySQL(resourceGroupName string, name string, migrationRequestEnvelope MigrateMySQLRequest, cancel <-chan struct{}) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "MigrateMySQL") + } + + req, err := client.MigrateMySQLPreparer(resourceGroupName, name, migrationRequestEnvelope, cancel) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "MigrateMySQL", nil, "Failure preparing request") + } + + resp, err := client.MigrateMySQLSender(req) + if err != nil { + result.Response = resp + return result, autorest.NewErrorWithError(err, "web.AppsClient", "MigrateMySQL", resp, "Failure sending request") + } + + result, err = client.MigrateMySQLResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "MigrateMySQL", resp, "Failure responding to request") + } + + return +} + +// MigrateMySQLPreparer prepares the MigrateMySQL request. +func (client AppsClient) MigrateMySQLPreparer(resourceGroupName string, name string, migrationRequestEnvelope MigrateMySQLRequest, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/migratemysql", pathParameters), + autorest.WithJSON(migrationRequestEnvelope), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// MigrateMySQLSender sends the MigrateMySQL request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) MigrateMySQLSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// MigrateMySQLResponder handles the response to the MigrateMySQL request. The method always +// closes the http.Response Body. +func (client AppsClient) MigrateMySQLResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// MigrateStorage restores a web app. This method may poll for completion. +// Polling can be canceled by passing the cancel channel argument. The channel +// will be used to cancel polling and any outstanding HTTP requests. +// +// subscriptionName is azure subscription resourceGroupName is name of the +// resource group to which the resource belongs. name is name of web app +// migrationOptions is migration migrationOptions +func (client AppsClient) MigrateStorage(subscriptionName string, resourceGroupName string, name string, migrationOptions StorageMigrationOptions, cancel <-chan struct{}) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "MigrateStorage") + } + + req, err := client.MigrateStoragePreparer(subscriptionName, resourceGroupName, name, migrationOptions, cancel) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "MigrateStorage", nil, "Failure preparing request") + } + + resp, err := client.MigrateStorageSender(req) + if err != nil { + result.Response = resp + return result, autorest.NewErrorWithError(err, "web.AppsClient", "MigrateStorage", resp, "Failure sending request") + } + + result, err = client.MigrateStorageResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "MigrateStorage", resp, "Failure responding to request") + } + + return +} + +// MigrateStoragePreparer prepares the MigrateStorage request. +func (client AppsClient) MigrateStoragePreparer(subscriptionName string, resourceGroupName string, name string, migrationOptions StorageMigrationOptions, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + "subscriptionName": autorest.Encode("query", subscriptionName), + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/migrate", pathParameters), + autorest.WithJSON(migrationOptions), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// MigrateStorageSender sends the MigrateStorage request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) MigrateStorageSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// MigrateStorageResponder handles the response to the MigrateStorage request. The method always +// closes the http.Response Body. +func (client AppsClient) MigrateStorageResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// Recover recovers a deleted web app. This method may poll for completion. +// Polling can be canceled by passing the cancel channel argument. The channel +// will be used to cancel polling and any outstanding HTTP requests. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of web app recoveryEntity is snapshot data used for +// web app recovery. Snapshot information can be obtained by calling +// GetDeletedSites or GetSiteSnapshots API. +func (client AppsClient) Recover(resourceGroupName string, name string, recoveryEntity CsmSiteRecoveryEntity, cancel <-chan struct{}) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "Recover") + } + + req, err := client.RecoverPreparer(resourceGroupName, name, recoveryEntity, cancel) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "Recover", nil, "Failure preparing request") + } + + resp, err := client.RecoverSender(req) + if err != nil { + result.Response = resp + return result, autorest.NewErrorWithError(err, "web.AppsClient", "Recover", resp, "Failure sending request") + } + + result, err = client.RecoverResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "Recover", resp, "Failure responding to request") + } + + return +} + +// RecoverPreparer prepares the Recover request. +func (client AppsClient) RecoverPreparer(resourceGroupName string, name string, recoveryEntity CsmSiteRecoveryEntity, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/recover", pathParameters), + autorest.WithJSON(recoveryEntity), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// RecoverSender sends the Recover request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) RecoverSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// RecoverResponder handles the response to the Recover request. The method always +// closes the http.Response Body. +func (client AppsClient) RecoverResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// RecoverSiteConfigurationSnapshot reverts the configuration of an app to a +// previous snapshot. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. snapshotID is the ID of the snapshot to +// read. +func (client AppsClient) RecoverSiteConfigurationSnapshot(resourceGroupName string, name string, snapshotID string) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "RecoverSiteConfigurationSnapshot") + } + + req, err := client.RecoverSiteConfigurationSnapshotPreparer(resourceGroupName, name, snapshotID) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "RecoverSiteConfigurationSnapshot", nil, "Failure preparing request") + } + + resp, err := client.RecoverSiteConfigurationSnapshotSender(req) + if err != nil { + result.Response = resp + return result, autorest.NewErrorWithError(err, "web.AppsClient", "RecoverSiteConfigurationSnapshot", resp, "Failure sending request") + } + + result, err = client.RecoverSiteConfigurationSnapshotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "RecoverSiteConfigurationSnapshot", resp, "Failure responding to request") + } + + return +} + +// RecoverSiteConfigurationSnapshotPreparer prepares the RecoverSiteConfigurationSnapshot request. +func (client AppsClient) RecoverSiteConfigurationSnapshotPreparer(resourceGroupName string, name string, snapshotID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "snapshotId": autorest.Encode("path", snapshotID), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-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.Web/sites/{name}/config/web/snapshots/{snapshotId}/recover", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// RecoverSiteConfigurationSnapshotSender sends the RecoverSiteConfigurationSnapshot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) RecoverSiteConfigurationSnapshotSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// RecoverSiteConfigurationSnapshotResponder handles the response to the RecoverSiteConfigurationSnapshot request. The method always +// closes the http.Response Body. +func (client AppsClient) RecoverSiteConfigurationSnapshotResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// RecoverSiteConfigurationSnapshotSlot reverts the configuration of an app to +// a previous snapshot. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. snapshotID is the ID of the snapshot to +// read. slot is name of the deployment slot. If a slot is not specified, the +// API will return configuration for the production slot. +func (client AppsClient) RecoverSiteConfigurationSnapshotSlot(resourceGroupName string, name string, snapshotID string, slot string) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "RecoverSiteConfigurationSnapshotSlot") + } + + req, err := client.RecoverSiteConfigurationSnapshotSlotPreparer(resourceGroupName, name, snapshotID, slot) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "RecoverSiteConfigurationSnapshotSlot", nil, "Failure preparing request") + } + + resp, err := client.RecoverSiteConfigurationSnapshotSlotSender(req) + if err != nil { + result.Response = resp + return result, autorest.NewErrorWithError(err, "web.AppsClient", "RecoverSiteConfigurationSnapshotSlot", resp, "Failure sending request") + } + + result, err = client.RecoverSiteConfigurationSnapshotSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "RecoverSiteConfigurationSnapshotSlot", resp, "Failure responding to request") + } + + return +} + +// RecoverSiteConfigurationSnapshotSlotPreparer prepares the RecoverSiteConfigurationSnapshotSlot request. +func (client AppsClient) RecoverSiteConfigurationSnapshotSlotPreparer(resourceGroupName string, name string, snapshotID string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "snapshotId": autorest.Encode("path", snapshotID), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-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.Web/sites/{name}/slots/{slot}/config/web/snapshots/{snapshotId}/recover", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// RecoverSiteConfigurationSnapshotSlotSender sends the RecoverSiteConfigurationSnapshotSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) RecoverSiteConfigurationSnapshotSlotSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// RecoverSiteConfigurationSnapshotSlotResponder handles the response to the RecoverSiteConfigurationSnapshotSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) RecoverSiteConfigurationSnapshotSlotResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// RecoverSlot recovers a deleted web app. This method may poll for completion. +// Polling can be canceled by passing the cancel channel argument. The channel +// will be used to cancel polling and any outstanding HTTP requests. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of web app recoveryEntity is snapshot data used for +// web app recovery. Snapshot information can be obtained by calling +// GetDeletedSites or GetSiteSnapshots API. slot is name of web app slot. If +// not specified then will default to production slot. +func (client AppsClient) RecoverSlot(resourceGroupName string, name string, recoveryEntity CsmSiteRecoveryEntity, slot string, cancel <-chan struct{}) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "RecoverSlot") + } + + req, err := client.RecoverSlotPreparer(resourceGroupName, name, recoveryEntity, slot, cancel) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "RecoverSlot", nil, "Failure preparing request") + } + + resp, err := client.RecoverSlotSender(req) + if err != nil { + result.Response = resp + return result, autorest.NewErrorWithError(err, "web.AppsClient", "RecoverSlot", resp, "Failure sending request") + } + + result, err = client.RecoverSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "RecoverSlot", resp, "Failure responding to request") + } + + return +} + +// RecoverSlotPreparer prepares the RecoverSlot request. +func (client AppsClient) RecoverSlotPreparer(resourceGroupName string, name string, recoveryEntity CsmSiteRecoveryEntity, slot string, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/recover", pathParameters), + autorest.WithJSON(recoveryEntity), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// RecoverSlotSender sends the RecoverSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) RecoverSlotSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// RecoverSlotResponder handles the response to the RecoverSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) RecoverSlotResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// ResetProductionSlotConfig resets the configuration settings of the current +// slot if they were previously modified by calling the API with POST. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. +func (client AppsClient) ResetProductionSlotConfig(resourceGroupName string, name string) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "ResetProductionSlotConfig") + } + + req, err := client.ResetProductionSlotConfigPreparer(resourceGroupName, name) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ResetProductionSlotConfig", nil, "Failure preparing request") + } + + resp, err := client.ResetProductionSlotConfigSender(req) + if err != nil { + result.Response = resp + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ResetProductionSlotConfig", resp, "Failure sending request") + } + + result, err = client.ResetProductionSlotConfigResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ResetProductionSlotConfig", resp, "Failure responding to request") + } + + return +} + +// ResetProductionSlotConfigPreparer prepares the ResetProductionSlotConfig request. +func (client AppsClient) ResetProductionSlotConfigPreparer(resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-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.Web/sites/{name}/resetSlotConfig", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ResetProductionSlotConfigSender sends the ResetProductionSlotConfig request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ResetProductionSlotConfigSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ResetProductionSlotConfigResponder handles the response to the ResetProductionSlotConfig request. The method always +// closes the http.Response Body. +func (client AppsClient) ResetProductionSlotConfigResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// ResetSlotConfigurationSlot resets the configuration settings of the current +// slot if they were previously modified by calling the API with POST. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. slot is name of the deployment slot. If a +// slot is not specified, the API resets configuration settings for the +// production slot. +func (client AppsClient) ResetSlotConfigurationSlot(resourceGroupName string, name string, slot string) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "ResetSlotConfigurationSlot") + } + + req, err := client.ResetSlotConfigurationSlotPreparer(resourceGroupName, name, slot) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ResetSlotConfigurationSlot", nil, "Failure preparing request") + } + + resp, err := client.ResetSlotConfigurationSlotSender(req) + if err != nil { + result.Response = resp + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ResetSlotConfigurationSlot", resp, "Failure sending request") + } + + result, err = client.ResetSlotConfigurationSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ResetSlotConfigurationSlot", resp, "Failure responding to request") + } + + return +} + +// ResetSlotConfigurationSlotPreparer prepares the ResetSlotConfigurationSlot request. +func (client AppsClient) ResetSlotConfigurationSlotPreparer(resourceGroupName string, name string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-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.Web/sites/{name}/slots/{slot}/resetSlotConfig", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ResetSlotConfigurationSlotSender sends the ResetSlotConfigurationSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ResetSlotConfigurationSlotSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ResetSlotConfigurationSlotResponder handles the response to the ResetSlotConfigurationSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) ResetSlotConfigurationSlotResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Restart restarts an app (or deployment slot, if specified). +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. softRestart is specify true to apply the +// configuration settings and restarts the app only if necessary. By default, +// the API always restarts and reprovisions the app. synchronous is specify +// true to block until the app is restarted. By default, it is set to false, +// and the API responds immediately (asynchronous). +func (client AppsClient) Restart(resourceGroupName string, name string, softRestart *bool, synchronous *bool) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "Restart") + } + + req, err := client.RestartPreparer(resourceGroupName, name, softRestart, synchronous) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "Restart", nil, "Failure preparing request") + } + + resp, err := client.RestartSender(req) + if err != nil { + result.Response = resp + return result, autorest.NewErrorWithError(err, "web.AppsClient", "Restart", resp, "Failure sending request") + } + + result, err = client.RestartResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "Restart", resp, "Failure responding to request") + } + + return +} + +// RestartPreparer prepares the Restart request. +func (client AppsClient) RestartPreparer(resourceGroupName string, name string, softRestart *bool, synchronous *bool) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if softRestart != nil { + queryParameters["softRestart"] = autorest.Encode("query", *softRestart) + } + if synchronous != nil { + queryParameters["synchronous"] = autorest.Encode("query", *synchronous) + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/restart", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// RestartSender sends the Restart request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) RestartSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// RestartResponder handles the response to the Restart request. The method always +// closes the http.Response Body. +func (client AppsClient) RestartResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// RestartSlot restarts an app (or deployment slot, if specified). +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. slot is name of the deployment slot. If a +// slot is not specified, the API will restart the production slot. softRestart +// is specify true to apply the configuration settings and restarts the app +// only if necessary. By default, the API always restarts and reprovisions the +// app. synchronous is specify true to block until the app is restarted. By +// default, it is set to false, and the API responds immediately +// (asynchronous). +func (client AppsClient) RestartSlot(resourceGroupName string, name string, slot string, softRestart *bool, synchronous *bool) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "RestartSlot") + } + + req, err := client.RestartSlotPreparer(resourceGroupName, name, slot, softRestart, synchronous) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "RestartSlot", nil, "Failure preparing request") + } + + resp, err := client.RestartSlotSender(req) + if err != nil { + result.Response = resp + return result, autorest.NewErrorWithError(err, "web.AppsClient", "RestartSlot", resp, "Failure sending request") + } + + result, err = client.RestartSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "RestartSlot", resp, "Failure responding to request") + } + + return +} + +// RestartSlotPreparer prepares the RestartSlot request. +func (client AppsClient) RestartSlotPreparer(resourceGroupName string, name string, slot string, softRestart *bool, synchronous *bool) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if softRestart != nil { + queryParameters["softRestart"] = autorest.Encode("query", *softRestart) + } + if synchronous != nil { + queryParameters["synchronous"] = autorest.Encode("query", *synchronous) + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/restart", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// RestartSlotSender sends the RestartSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) RestartSlotSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// RestartSlotResponder handles the response to the RestartSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) RestartSlotResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// Restore restores a specific backup to another app (or deployment slot, if +// specified). This method may poll for completion. Polling can be canceled by +// passing the cancel channel argument. The channel will be used to cancel +// polling and any outstanding HTTP requests. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. backupID is iD of the backup. request is +// information on restore request +func (client AppsClient) Restore(resourceGroupName string, name string, backupID string, request RestoreRequest, cancel <-chan struct{}) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "Restore") + } + + req, err := client.RestorePreparer(resourceGroupName, name, backupID, request, cancel) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "Restore", nil, "Failure preparing request") + } + + resp, err := client.RestoreSender(req) + if err != nil { + result.Response = resp + return result, autorest.NewErrorWithError(err, "web.AppsClient", "Restore", resp, "Failure sending request") + } + + result, err = client.RestoreResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "Restore", resp, "Failure responding to request") + } + + return +} + +// RestorePreparer prepares the Restore request. +func (client AppsClient) RestorePreparer(resourceGroupName string, name string, backupID string, request RestoreRequest, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "backupId": autorest.Encode("path", backupID), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/backups/{backupId}/restore", pathParameters), + autorest.WithJSON(request), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// RestoreSender sends the Restore request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) RestoreSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// RestoreResponder handles the response to the Restore request. The method always +// closes the http.Response Body. +func (client AppsClient) RestoreResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// RestoreSlot restores a specific backup to another app (or deployment slot, +// if specified). This method may poll for completion. Polling can be canceled +// by passing the cancel channel argument. The channel will be used to cancel +// polling and any outstanding HTTP requests. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. backupID is iD of the backup. request is +// information on restore request slot is name of the deployment slot. If a +// slot is not specified, the API will restore a backup of the production slot. +func (client AppsClient) RestoreSlot(resourceGroupName string, name string, backupID string, request RestoreRequest, slot string, cancel <-chan struct{}) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "RestoreSlot") + } + + req, err := client.RestoreSlotPreparer(resourceGroupName, name, backupID, request, slot, cancel) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "RestoreSlot", nil, "Failure preparing request") + } + + resp, err := client.RestoreSlotSender(req) + if err != nil { + result.Response = resp + return result, autorest.NewErrorWithError(err, "web.AppsClient", "RestoreSlot", resp, "Failure sending request") + } + + result, err = client.RestoreSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "RestoreSlot", resp, "Failure responding to request") + } + + return +} + +// RestoreSlotPreparer prepares the RestoreSlot request. +func (client AppsClient) RestoreSlotPreparer(resourceGroupName string, name string, backupID string, request RestoreRequest, slot string, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "backupId": autorest.Encode("path", backupID), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/backups/{backupId}/restore", pathParameters), + autorest.WithJSON(request), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// RestoreSlotSender sends the RestoreSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) RestoreSlotSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// RestoreSlotResponder handles the response to the RestoreSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) RestoreSlotResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// Start starts an app (or deployment slot, if specified). +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. +func (client AppsClient) Start(resourceGroupName string, name string) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "Start") + } + + req, err := client.StartPreparer(resourceGroupName, name) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "Start", nil, "Failure preparing request") + } + + resp, err := client.StartSender(req) + if err != nil { + result.Response = resp + return result, autorest.NewErrorWithError(err, "web.AppsClient", "Start", resp, "Failure sending request") + } + + result, err = client.StartResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "Start", resp, "Failure responding to request") + } + + return +} + +// StartPreparer prepares the Start request. +func (client AppsClient) StartPreparer(resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-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.Web/sites/{name}/start", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// StartSender sends the Start request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) StartSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// StartResponder handles the response to the Start request. The method always +// closes the http.Response Body. +func (client AppsClient) StartResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// StartSlot starts an app (or deployment slot, if specified). +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. slot is name of the deployment slot. If a +// slot is not specified, the API will start the production slot. +func (client AppsClient) StartSlot(resourceGroupName string, name string, slot string) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "StartSlot") + } + + req, err := client.StartSlotPreparer(resourceGroupName, name, slot) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "StartSlot", nil, "Failure preparing request") + } + + resp, err := client.StartSlotSender(req) + if err != nil { + result.Response = resp + return result, autorest.NewErrorWithError(err, "web.AppsClient", "StartSlot", resp, "Failure sending request") + } + + result, err = client.StartSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "StartSlot", resp, "Failure responding to request") + } + + return +} + +// StartSlotPreparer prepares the StartSlot request. +func (client AppsClient) StartSlotPreparer(resourceGroupName string, name string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-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.Web/sites/{name}/slots/{slot}/start", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// StartSlotSender sends the StartSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) StartSlotSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// StartSlotResponder handles the response to the StartSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) StartSlotResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// StartWebSiteNetworkTrace start capturing network packets for the site. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is the name of the web app. durationInSeconds is the duration +// to keep capturing in seconds. maxFrameLength is the maximum frame length in +// bytes (Optional). sasURL is the Blob URL to store capture file. +func (client AppsClient) StartWebSiteNetworkTrace(resourceGroupName string, name string, durationInSeconds *int32, maxFrameLength *int32, sasURL string) (result String, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "StartWebSiteNetworkTrace") + } + + req, err := client.StartWebSiteNetworkTracePreparer(resourceGroupName, name, durationInSeconds, maxFrameLength, sasURL) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "StartWebSiteNetworkTrace", nil, "Failure preparing request") + } + + resp, err := client.StartWebSiteNetworkTraceSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "StartWebSiteNetworkTrace", resp, "Failure sending request") + } + + result, err = client.StartWebSiteNetworkTraceResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "StartWebSiteNetworkTrace", resp, "Failure responding to request") + } + + return +} + +// StartWebSiteNetworkTracePreparer prepares the StartWebSiteNetworkTrace request. +func (client AppsClient) StartWebSiteNetworkTracePreparer(resourceGroupName string, name string, durationInSeconds *int32, maxFrameLength *int32, sasURL string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if durationInSeconds != nil { + queryParameters["durationInSeconds"] = autorest.Encode("query", *durationInSeconds) + } + if maxFrameLength != nil { + queryParameters["maxFrameLength"] = autorest.Encode("query", *maxFrameLength) + } + if len(sasURL) > 0 { + queryParameters["sasUrl"] = autorest.Encode("query", sasURL) + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/networkTrace/start", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// StartWebSiteNetworkTraceSender sends the StartWebSiteNetworkTrace request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) StartWebSiteNetworkTraceSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// StartWebSiteNetworkTraceResponder handles the response to the StartWebSiteNetworkTrace request. The method always +// closes the http.Response Body. +func (client AppsClient) StartWebSiteNetworkTraceResponder(resp *http.Response) (result String, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// StartWebSiteNetworkTraceSlot start capturing network packets for the site. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is the name of the web app. slot is the name of the slot for +// this web app. durationInSeconds is the duration to keep capturing in +// seconds. maxFrameLength is the maximum frame length in bytes (Optional). +// sasURL is the Blob URL to store capture file. +func (client AppsClient) StartWebSiteNetworkTraceSlot(resourceGroupName string, name string, slot string, durationInSeconds *int32, maxFrameLength *int32, sasURL string) (result String, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "StartWebSiteNetworkTraceSlot") + } + + req, err := client.StartWebSiteNetworkTraceSlotPreparer(resourceGroupName, name, slot, durationInSeconds, maxFrameLength, sasURL) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "StartWebSiteNetworkTraceSlot", nil, "Failure preparing request") + } + + resp, err := client.StartWebSiteNetworkTraceSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "StartWebSiteNetworkTraceSlot", resp, "Failure sending request") + } + + result, err = client.StartWebSiteNetworkTraceSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "StartWebSiteNetworkTraceSlot", resp, "Failure responding to request") + } + + return +} + +// StartWebSiteNetworkTraceSlotPreparer prepares the StartWebSiteNetworkTraceSlot request. +func (client AppsClient) StartWebSiteNetworkTraceSlotPreparer(resourceGroupName string, name string, slot string, durationInSeconds *int32, maxFrameLength *int32, sasURL string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if durationInSeconds != nil { + queryParameters["durationInSeconds"] = autorest.Encode("query", *durationInSeconds) + } + if maxFrameLength != nil { + queryParameters["maxFrameLength"] = autorest.Encode("query", *maxFrameLength) + } + if len(sasURL) > 0 { + queryParameters["sasUrl"] = autorest.Encode("query", sasURL) + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/networkTrace/start", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// StartWebSiteNetworkTraceSlotSender sends the StartWebSiteNetworkTraceSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) StartWebSiteNetworkTraceSlotSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// StartWebSiteNetworkTraceSlotResponder handles the response to the StartWebSiteNetworkTraceSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) StartWebSiteNetworkTraceSlotResponder(resp *http.Response) (result String, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Stop stops an app (or deployment slot, if specified). +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. +func (client AppsClient) Stop(resourceGroupName string, name string) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "Stop") + } + + req, err := client.StopPreparer(resourceGroupName, name) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "Stop", nil, "Failure preparing request") + } + + resp, err := client.StopSender(req) + if err != nil { + result.Response = resp + return result, autorest.NewErrorWithError(err, "web.AppsClient", "Stop", resp, "Failure sending request") + } + + result, err = client.StopResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "Stop", resp, "Failure responding to request") + } + + return +} + +// StopPreparer prepares the Stop request. +func (client AppsClient) StopPreparer(resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-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.Web/sites/{name}/stop", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// StopSender sends the Stop request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) StopSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// StopResponder handles the response to the Stop request. The method always +// closes the http.Response Body. +func (client AppsClient) StopResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// StopSlot stops an app (or deployment slot, if specified). +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. slot is name of the deployment slot. If a +// slot is not specified, the API will stop the production slot. +func (client AppsClient) StopSlot(resourceGroupName string, name string, slot string) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "StopSlot") + } + + req, err := client.StopSlotPreparer(resourceGroupName, name, slot) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "StopSlot", nil, "Failure preparing request") + } + + resp, err := client.StopSlotSender(req) + if err != nil { + result.Response = resp + return result, autorest.NewErrorWithError(err, "web.AppsClient", "StopSlot", resp, "Failure sending request") + } + + result, err = client.StopSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "StopSlot", resp, "Failure responding to request") + } + + return +} + +// StopSlotPreparer prepares the StopSlot request. +func (client AppsClient) StopSlotPreparer(resourceGroupName string, name string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-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.Web/sites/{name}/slots/{slot}/stop", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// StopSlotSender sends the StopSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) StopSlotSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// StopSlotResponder handles the response to the StopSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) StopSlotResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// StopWebSiteNetworkTrace stop ongoing capturing network packets for the site. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is the name of the web app. +func (client AppsClient) StopWebSiteNetworkTrace(resourceGroupName string, name string) (result String, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "StopWebSiteNetworkTrace") + } + + req, err := client.StopWebSiteNetworkTracePreparer(resourceGroupName, name) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "StopWebSiteNetworkTrace", nil, "Failure preparing request") + } + + resp, err := client.StopWebSiteNetworkTraceSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "StopWebSiteNetworkTrace", resp, "Failure sending request") + } + + result, err = client.StopWebSiteNetworkTraceResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "StopWebSiteNetworkTrace", resp, "Failure responding to request") + } + + return +} + +// StopWebSiteNetworkTracePreparer prepares the StopWebSiteNetworkTrace request. +func (client AppsClient) StopWebSiteNetworkTracePreparer(resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-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.Web/sites/{name}/networkTrace/stop", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// StopWebSiteNetworkTraceSender sends the StopWebSiteNetworkTrace request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) StopWebSiteNetworkTraceSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// StopWebSiteNetworkTraceResponder handles the response to the StopWebSiteNetworkTrace request. The method always +// closes the http.Response Body. +func (client AppsClient) StopWebSiteNetworkTraceResponder(resp *http.Response) (result String, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// StopWebSiteNetworkTraceSlot stop ongoing capturing network packets for the +// site. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is the name of the web app. slot is the name of the slot for +// this web app. +func (client AppsClient) StopWebSiteNetworkTraceSlot(resourceGroupName string, name string, slot string) (result String, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "StopWebSiteNetworkTraceSlot") + } + + req, err := client.StopWebSiteNetworkTraceSlotPreparer(resourceGroupName, name, slot) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "StopWebSiteNetworkTraceSlot", nil, "Failure preparing request") + } + + resp, err := client.StopWebSiteNetworkTraceSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "StopWebSiteNetworkTraceSlot", resp, "Failure sending request") + } + + result, err = client.StopWebSiteNetworkTraceSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "StopWebSiteNetworkTraceSlot", resp, "Failure responding to request") + } + + return +} + +// StopWebSiteNetworkTraceSlotPreparer prepares the StopWebSiteNetworkTraceSlot request. +func (client AppsClient) StopWebSiteNetworkTraceSlotPreparer(resourceGroupName string, name string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-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.Web/sites/{name}/slots/{slot}/networkTrace/stop", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// StopWebSiteNetworkTraceSlotSender sends the StopWebSiteNetworkTraceSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) StopWebSiteNetworkTraceSlotSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// StopWebSiteNetworkTraceSlotResponder handles the response to the StopWebSiteNetworkTraceSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) StopWebSiteNetworkTraceSlotResponder(resp *http.Response) (result String, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// SwapSlotSlot swaps two deployment slots of an app. This method may poll for +// completion. Polling can be canceled by passing the cancel channel argument. +// The channel will be used to cancel polling and any outstanding HTTP +// requests. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. slotSwapEntity is jSON object that +// contains the target slot name. See example. slot is name of the source slot. +// If a slot is not specified, the production slot is used as the source slot. +func (client AppsClient) SwapSlotSlot(resourceGroupName string, name string, slotSwapEntity CsmSlotEntity, slot string, cancel <-chan struct{}) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}, + {TargetValue: slotSwapEntity, + Constraints: []validation.Constraint{{Target: "slotSwapEntity.TargetSlot", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "slotSwapEntity.PreserveVnet", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "SwapSlotSlot") + } + + req, err := client.SwapSlotSlotPreparer(resourceGroupName, name, slotSwapEntity, slot, cancel) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "SwapSlotSlot", nil, "Failure preparing request") + } + + resp, err := client.SwapSlotSlotSender(req) + if err != nil { + result.Response = resp + return result, autorest.NewErrorWithError(err, "web.AppsClient", "SwapSlotSlot", resp, "Failure sending request") + } + + result, err = client.SwapSlotSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "SwapSlotSlot", resp, "Failure responding to request") + } + + return +} + +// SwapSlotSlotPreparer prepares the SwapSlotSlot request. +func (client AppsClient) SwapSlotSlotPreparer(resourceGroupName string, name string, slotSwapEntity CsmSlotEntity, slot string, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/slotsswap", pathParameters), + autorest.WithJSON(slotSwapEntity), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// SwapSlotSlotSender sends the SwapSlotSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) SwapSlotSlotSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// SwapSlotSlotResponder handles the response to the SwapSlotSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) SwapSlotSlotResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// SwapSlotWithProduction swaps two deployment slots of an app. This method may +// poll for completion. Polling can be canceled by passing the cancel channel +// argument. The channel will be used to cancel polling and any outstanding +// HTTP requests. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. slotSwapEntity is jSON object that +// contains the target slot name. See example. +func (client AppsClient) SwapSlotWithProduction(resourceGroupName string, name string, slotSwapEntity CsmSlotEntity, cancel <-chan struct{}) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}, + {TargetValue: slotSwapEntity, + Constraints: []validation.Constraint{{Target: "slotSwapEntity.TargetSlot", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "slotSwapEntity.PreserveVnet", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "SwapSlotWithProduction") + } + + req, err := client.SwapSlotWithProductionPreparer(resourceGroupName, name, slotSwapEntity, cancel) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "SwapSlotWithProduction", nil, "Failure preparing request") + } + + resp, err := client.SwapSlotWithProductionSender(req) + if err != nil { + result.Response = resp + return result, autorest.NewErrorWithError(err, "web.AppsClient", "SwapSlotWithProduction", resp, "Failure sending request") + } + + result, err = client.SwapSlotWithProductionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "SwapSlotWithProduction", resp, "Failure responding to request") + } + + return +} + +// SwapSlotWithProductionPreparer prepares the SwapSlotWithProduction request. +func (client AppsClient) SwapSlotWithProductionPreparer(resourceGroupName string, name string, slotSwapEntity CsmSlotEntity, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slotsswap", pathParameters), + autorest.WithJSON(slotSwapEntity), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// SwapSlotWithProductionSender sends the SwapSlotWithProduction request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) SwapSlotWithProductionSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// SwapSlotWithProductionResponder handles the response to the SwapSlotWithProduction request. The method always +// closes the http.Response Body. +func (client AppsClient) SwapSlotWithProductionResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// SyncRepository sync web app repository. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of web app +func (client AppsClient) SyncRepository(resourceGroupName string, name string) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "SyncRepository") + } + + req, err := client.SyncRepositoryPreparer(resourceGroupName, name) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "SyncRepository", nil, "Failure preparing request") + } + + resp, err := client.SyncRepositorySender(req) + if err != nil { + result.Response = resp + return result, autorest.NewErrorWithError(err, "web.AppsClient", "SyncRepository", resp, "Failure sending request") + } + + result, err = client.SyncRepositoryResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "SyncRepository", resp, "Failure responding to request") + } + + return +} + +// SyncRepositoryPreparer prepares the SyncRepository request. +func (client AppsClient) SyncRepositoryPreparer(resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-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.Web/sites/{name}/sync", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// SyncRepositorySender sends the SyncRepository request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) SyncRepositorySender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// SyncRepositoryResponder handles the response to the SyncRepository request. The method always +// closes the http.Response Body. +func (client AppsClient) SyncRepositoryResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// SyncRepositorySlot sync web app repository. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of web app slot is name of web app slot. If not +// specified then will default to production slot. +func (client AppsClient) SyncRepositorySlot(resourceGroupName string, name string, slot string) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "SyncRepositorySlot") + } + + req, err := client.SyncRepositorySlotPreparer(resourceGroupName, name, slot) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "SyncRepositorySlot", nil, "Failure preparing request") + } + + resp, err := client.SyncRepositorySlotSender(req) + if err != nil { + result.Response = resp + return result, autorest.NewErrorWithError(err, "web.AppsClient", "SyncRepositorySlot", resp, "Failure sending request") + } + + result, err = client.SyncRepositorySlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "SyncRepositorySlot", resp, "Failure responding to request") + } + + return +} + +// SyncRepositorySlotPreparer prepares the SyncRepositorySlot request. +func (client AppsClient) SyncRepositorySlotPreparer(resourceGroupName string, name string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-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.Web/sites/{name}/slots/{slot}/sync", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// SyncRepositorySlotSender sends the SyncRepositorySlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) SyncRepositorySlotSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// SyncRepositorySlotResponder handles the response to the SyncRepositorySlot request. The method always +// closes the http.Response Body. +func (client AppsClient) SyncRepositorySlotResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// UpdateApplicationSettings replaces the application settings of an app. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. appSettings is application settings of the +// app. +func (client AppsClient) UpdateApplicationSettings(resourceGroupName string, name string, appSettings StringDictionary) (result StringDictionary, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "UpdateApplicationSettings") + } + + req, err := client.UpdateApplicationSettingsPreparer(resourceGroupName, name, appSettings) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "UpdateApplicationSettings", nil, "Failure preparing request") + } + + resp, err := client.UpdateApplicationSettingsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "UpdateApplicationSettings", resp, "Failure sending request") + } + + result, err = client.UpdateApplicationSettingsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateApplicationSettings", resp, "Failure responding to request") + } + + return +} + +// UpdateApplicationSettingsPreparer prepares the UpdateApplicationSettings request. +func (client AppsClient) UpdateApplicationSettingsPreparer(resourceGroupName string, name string, appSettings StringDictionary) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/appsettings", pathParameters), + autorest.WithJSON(appSettings), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// UpdateApplicationSettingsSender sends the UpdateApplicationSettings request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) UpdateApplicationSettingsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// UpdateApplicationSettingsResponder handles the response to the UpdateApplicationSettings request. The method always +// closes the http.Response Body. +func (client AppsClient) UpdateApplicationSettingsResponder(resp *http.Response) (result StringDictionary, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// UpdateApplicationSettingsSlot replaces the application settings of an app. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. appSettings is application settings of the +// app. slot is name of the deployment slot. If a slot is not specified, the +// API will update the application settings for the production slot. +func (client AppsClient) UpdateApplicationSettingsSlot(resourceGroupName string, name string, appSettings StringDictionary, slot string) (result StringDictionary, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "UpdateApplicationSettingsSlot") + } + + req, err := client.UpdateApplicationSettingsSlotPreparer(resourceGroupName, name, appSettings, slot) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "UpdateApplicationSettingsSlot", nil, "Failure preparing request") + } + + resp, err := client.UpdateApplicationSettingsSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "UpdateApplicationSettingsSlot", resp, "Failure sending request") + } + + result, err = client.UpdateApplicationSettingsSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateApplicationSettingsSlot", resp, "Failure responding to request") + } + + return +} + +// UpdateApplicationSettingsSlotPreparer prepares the UpdateApplicationSettingsSlot request. +func (client AppsClient) UpdateApplicationSettingsSlotPreparer(resourceGroupName string, name string, appSettings StringDictionary, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/appsettings", pathParameters), + autorest.WithJSON(appSettings), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// UpdateApplicationSettingsSlotSender sends the UpdateApplicationSettingsSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) UpdateApplicationSettingsSlotSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// UpdateApplicationSettingsSlotResponder handles the response to the UpdateApplicationSettingsSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) UpdateApplicationSettingsSlotResponder(resp *http.Response) (result StringDictionary, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// UpdateAuthSettings updates the Authentication / Authorization settings +// associated with web app. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of web app siteAuthSettings is auth settings +// associated with web app +func (client AppsClient) UpdateAuthSettings(resourceGroupName string, name string, siteAuthSettings SiteAuthSettings) (result SiteAuthSettings, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "UpdateAuthSettings") + } + + req, err := client.UpdateAuthSettingsPreparer(resourceGroupName, name, siteAuthSettings) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "UpdateAuthSettings", nil, "Failure preparing request") + } + + resp, err := client.UpdateAuthSettingsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "UpdateAuthSettings", resp, "Failure sending request") + } + + result, err = client.UpdateAuthSettingsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateAuthSettings", resp, "Failure responding to request") + } + + return +} + +// UpdateAuthSettingsPreparer prepares the UpdateAuthSettings request. +func (client AppsClient) UpdateAuthSettingsPreparer(resourceGroupName string, name string, siteAuthSettings SiteAuthSettings) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/authsettings", pathParameters), + autorest.WithJSON(siteAuthSettings), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// UpdateAuthSettingsSender sends the UpdateAuthSettings request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) UpdateAuthSettingsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// UpdateAuthSettingsResponder handles the response to the UpdateAuthSettings request. The method always +// closes the http.Response Body. +func (client AppsClient) UpdateAuthSettingsResponder(resp *http.Response) (result SiteAuthSettings, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// UpdateAuthSettingsSlot updates the Authentication / Authorization settings +// associated with web app. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of web app siteAuthSettings is auth settings +// associated with web app slot is name of web app slot. If not specified then +// will default to production slot. +func (client AppsClient) UpdateAuthSettingsSlot(resourceGroupName string, name string, siteAuthSettings SiteAuthSettings, slot string) (result SiteAuthSettings, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "UpdateAuthSettingsSlot") + } + + req, err := client.UpdateAuthSettingsSlotPreparer(resourceGroupName, name, siteAuthSettings, slot) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "UpdateAuthSettingsSlot", nil, "Failure preparing request") + } + + resp, err := client.UpdateAuthSettingsSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "UpdateAuthSettingsSlot", resp, "Failure sending request") + } + + result, err = client.UpdateAuthSettingsSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateAuthSettingsSlot", resp, "Failure responding to request") + } + + return +} + +// UpdateAuthSettingsSlotPreparer prepares the UpdateAuthSettingsSlot request. +func (client AppsClient) UpdateAuthSettingsSlotPreparer(resourceGroupName string, name string, siteAuthSettings SiteAuthSettings, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/authsettings", pathParameters), + autorest.WithJSON(siteAuthSettings), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// UpdateAuthSettingsSlotSender sends the UpdateAuthSettingsSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) UpdateAuthSettingsSlotSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// UpdateAuthSettingsSlotResponder handles the response to the UpdateAuthSettingsSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) UpdateAuthSettingsSlotResponder(resp *http.Response) (result SiteAuthSettings, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// UpdateBackupConfiguration updates the backup configuration of an app. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. request is edited backup configuration. +func (client AppsClient) UpdateBackupConfiguration(resourceGroupName string, name string, request BackupRequest) (result BackupRequest, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}, + {TargetValue: request, + Constraints: []validation.Constraint{{Target: "request.BackupRequestProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "request.BackupRequestProperties.BackupSchedule", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "request.BackupRequestProperties.BackupSchedule.FrequencyInterval", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "request.BackupRequestProperties.BackupSchedule.KeepAtLeastOneBackup", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "request.BackupRequestProperties.BackupSchedule.RetentionPeriodInDays", Name: validation.Null, Rule: true, Chain: nil}, + }}, + }}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "UpdateBackupConfiguration") + } + + req, err := client.UpdateBackupConfigurationPreparer(resourceGroupName, name, request) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "UpdateBackupConfiguration", nil, "Failure preparing request") + } + + resp, err := client.UpdateBackupConfigurationSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "UpdateBackupConfiguration", resp, "Failure sending request") + } + + result, err = client.UpdateBackupConfigurationResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateBackupConfiguration", resp, "Failure responding to request") + } + + return +} + +// UpdateBackupConfigurationPreparer prepares the UpdateBackupConfiguration request. +func (client AppsClient) UpdateBackupConfigurationPreparer(resourceGroupName string, name string, request BackupRequest) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/backup", pathParameters), + autorest.WithJSON(request), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// UpdateBackupConfigurationSender sends the UpdateBackupConfiguration request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) UpdateBackupConfigurationSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// UpdateBackupConfigurationResponder handles the response to the UpdateBackupConfiguration request. The method always +// closes the http.Response Body. +func (client AppsClient) UpdateBackupConfigurationResponder(resp *http.Response) (result BackupRequest, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// UpdateBackupConfigurationSlot updates the backup configuration of an app. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. request is edited backup configuration. +// slot is name of the deployment slot. If a slot is not specified, the API +// will update the backup configuration for the production slot. +func (client AppsClient) UpdateBackupConfigurationSlot(resourceGroupName string, name string, request BackupRequest, slot string) (result BackupRequest, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}, + {TargetValue: request, + Constraints: []validation.Constraint{{Target: "request.BackupRequestProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "request.BackupRequestProperties.BackupSchedule", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "request.BackupRequestProperties.BackupSchedule.FrequencyInterval", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "request.BackupRequestProperties.BackupSchedule.KeepAtLeastOneBackup", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "request.BackupRequestProperties.BackupSchedule.RetentionPeriodInDays", Name: validation.Null, Rule: true, Chain: nil}, + }}, + }}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "UpdateBackupConfigurationSlot") + } + + req, err := client.UpdateBackupConfigurationSlotPreparer(resourceGroupName, name, request, slot) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "UpdateBackupConfigurationSlot", nil, "Failure preparing request") + } + + resp, err := client.UpdateBackupConfigurationSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "UpdateBackupConfigurationSlot", resp, "Failure sending request") + } + + result, err = client.UpdateBackupConfigurationSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateBackupConfigurationSlot", resp, "Failure responding to request") + } + + return +} + +// UpdateBackupConfigurationSlotPreparer prepares the UpdateBackupConfigurationSlot request. +func (client AppsClient) UpdateBackupConfigurationSlotPreparer(resourceGroupName string, name string, request BackupRequest, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/backup", pathParameters), + autorest.WithJSON(request), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// UpdateBackupConfigurationSlotSender sends the UpdateBackupConfigurationSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) UpdateBackupConfigurationSlotSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// UpdateBackupConfigurationSlotResponder handles the response to the UpdateBackupConfigurationSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) UpdateBackupConfigurationSlotResponder(resp *http.Response) (result BackupRequest, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// UpdateConfiguration updates the configuration of an app. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. siteConfig is jSON representation of a +// SiteConfig object. See example. +func (client AppsClient) UpdateConfiguration(resourceGroupName string, name string, siteConfig SiteConfigResource) (result SiteConfigResource, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "UpdateConfiguration") + } + + req, err := client.UpdateConfigurationPreparer(resourceGroupName, name, siteConfig) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "UpdateConfiguration", nil, "Failure preparing request") + } + + resp, err := client.UpdateConfigurationSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "UpdateConfiguration", resp, "Failure sending request") + } + + result, err = client.UpdateConfigurationResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateConfiguration", resp, "Failure responding to request") + } + + return +} + +// UpdateConfigurationPreparer prepares the UpdateConfiguration request. +func (client AppsClient) UpdateConfigurationPreparer(resourceGroupName string, name string, siteConfig SiteConfigResource) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/web", pathParameters), + autorest.WithJSON(siteConfig), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// UpdateConfigurationSender sends the UpdateConfiguration request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) UpdateConfigurationSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// UpdateConfigurationResponder handles the response to the UpdateConfiguration request. The method always +// closes the http.Response Body. +func (client AppsClient) UpdateConfigurationResponder(resp *http.Response) (result SiteConfigResource, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// UpdateConfigurationSlot updates the configuration of an app. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. siteConfig is jSON representation of a +// SiteConfig object. See example. slot is name of the deployment slot. If a +// slot is not specified, the API will update configuration for the production +// slot. +func (client AppsClient) UpdateConfigurationSlot(resourceGroupName string, name string, siteConfig SiteConfigResource, slot string) (result SiteConfigResource, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "UpdateConfigurationSlot") + } + + req, err := client.UpdateConfigurationSlotPreparer(resourceGroupName, name, siteConfig, slot) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "UpdateConfigurationSlot", nil, "Failure preparing request") + } + + resp, err := client.UpdateConfigurationSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "UpdateConfigurationSlot", resp, "Failure sending request") + } + + result, err = client.UpdateConfigurationSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateConfigurationSlot", resp, "Failure responding to request") + } + + return +} + +// UpdateConfigurationSlotPreparer prepares the UpdateConfigurationSlot request. +func (client AppsClient) UpdateConfigurationSlotPreparer(resourceGroupName string, name string, siteConfig SiteConfigResource, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/web", pathParameters), + autorest.WithJSON(siteConfig), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// UpdateConfigurationSlotSender sends the UpdateConfigurationSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) UpdateConfigurationSlotSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// UpdateConfigurationSlotResponder handles the response to the UpdateConfigurationSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) UpdateConfigurationSlotResponder(resp *http.Response) (result SiteConfigResource, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// UpdateConnectionStrings replaces the connection strings of an app. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. connectionStrings is connection strings of +// the app or deployment slot. See example. +func (client AppsClient) UpdateConnectionStrings(resourceGroupName string, name string, connectionStrings ConnectionStringDictionary) (result ConnectionStringDictionary, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "UpdateConnectionStrings") + } + + req, err := client.UpdateConnectionStringsPreparer(resourceGroupName, name, connectionStrings) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "UpdateConnectionStrings", nil, "Failure preparing request") + } + + resp, err := client.UpdateConnectionStringsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "UpdateConnectionStrings", resp, "Failure sending request") + } + + result, err = client.UpdateConnectionStringsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateConnectionStrings", resp, "Failure responding to request") + } + + return +} + +// UpdateConnectionStringsPreparer prepares the UpdateConnectionStrings request. +func (client AppsClient) UpdateConnectionStringsPreparer(resourceGroupName string, name string, connectionStrings ConnectionStringDictionary) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/connectionstrings", pathParameters), + autorest.WithJSON(connectionStrings), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// UpdateConnectionStringsSender sends the UpdateConnectionStrings request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) UpdateConnectionStringsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// UpdateConnectionStringsResponder handles the response to the UpdateConnectionStrings request. The method always +// closes the http.Response Body. +func (client AppsClient) UpdateConnectionStringsResponder(resp *http.Response) (result ConnectionStringDictionary, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// UpdateConnectionStringsSlot replaces the connection strings of an app. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. connectionStrings is connection strings of +// the app or deployment slot. See example. slot is name of the deployment +// slot. If a slot is not specified, the API will update the connection +// settings for the production slot. +func (client AppsClient) UpdateConnectionStringsSlot(resourceGroupName string, name string, connectionStrings ConnectionStringDictionary, slot string) (result ConnectionStringDictionary, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "UpdateConnectionStringsSlot") + } + + req, err := client.UpdateConnectionStringsSlotPreparer(resourceGroupName, name, connectionStrings, slot) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "UpdateConnectionStringsSlot", nil, "Failure preparing request") + } + + resp, err := client.UpdateConnectionStringsSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "UpdateConnectionStringsSlot", resp, "Failure sending request") + } + + result, err = client.UpdateConnectionStringsSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateConnectionStringsSlot", resp, "Failure responding to request") + } + + return +} + +// UpdateConnectionStringsSlotPreparer prepares the UpdateConnectionStringsSlot request. +func (client AppsClient) UpdateConnectionStringsSlotPreparer(resourceGroupName string, name string, connectionStrings ConnectionStringDictionary, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/connectionstrings", pathParameters), + autorest.WithJSON(connectionStrings), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// UpdateConnectionStringsSlotSender sends the UpdateConnectionStringsSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) UpdateConnectionStringsSlotSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// UpdateConnectionStringsSlotResponder handles the response to the UpdateConnectionStringsSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) UpdateConnectionStringsSlotResponder(resp *http.Response) (result ConnectionStringDictionary, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// UpdateDiagnosticLogsConfig updates the logging configuration of an app. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. siteLogsConfig is a SiteLogsConfig JSON +// object that contains the logging configuration to change in the "properties" +// property. +func (client AppsClient) UpdateDiagnosticLogsConfig(resourceGroupName string, name string, siteLogsConfig SiteLogsConfig) (result SiteLogsConfig, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}, + {TargetValue: siteLogsConfig, + Constraints: []validation.Constraint{{Target: "siteLogsConfig.SiteLogsConfigProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "siteLogsConfig.SiteLogsConfigProperties.ApplicationLogs", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "siteLogsConfig.SiteLogsConfigProperties.ApplicationLogs.AzureTableStorage", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "siteLogsConfig.SiteLogsConfigProperties.ApplicationLogs.AzureTableStorage.SasURL", Name: validation.Null, Rule: true, Chain: nil}}}, + }}, + {Target: "siteLogsConfig.SiteLogsConfigProperties.HTTPLogs", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "siteLogsConfig.SiteLogsConfigProperties.HTTPLogs.FileSystem", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "siteLogsConfig.SiteLogsConfigProperties.HTTPLogs.FileSystem.RetentionInMb", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "siteLogsConfig.SiteLogsConfigProperties.HTTPLogs.FileSystem.RetentionInMb", Name: validation.InclusiveMaximum, Rule: 100, Chain: nil}, + {Target: "siteLogsConfig.SiteLogsConfigProperties.HTTPLogs.FileSystem.RetentionInMb", Name: validation.InclusiveMinimum, Rule: 25, Chain: nil}, + }}, + }}, + }}, + }}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "UpdateDiagnosticLogsConfig") + } + + req, err := client.UpdateDiagnosticLogsConfigPreparer(resourceGroupName, name, siteLogsConfig) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "UpdateDiagnosticLogsConfig", nil, "Failure preparing request") + } + + resp, err := client.UpdateDiagnosticLogsConfigSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "UpdateDiagnosticLogsConfig", resp, "Failure sending request") + } + + result, err = client.UpdateDiagnosticLogsConfigResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateDiagnosticLogsConfig", resp, "Failure responding to request") + } + + return +} + +// UpdateDiagnosticLogsConfigPreparer prepares the UpdateDiagnosticLogsConfig request. +func (client AppsClient) UpdateDiagnosticLogsConfigPreparer(resourceGroupName string, name string, siteLogsConfig SiteLogsConfig) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/logs", pathParameters), + autorest.WithJSON(siteLogsConfig), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// UpdateDiagnosticLogsConfigSender sends the UpdateDiagnosticLogsConfig request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) UpdateDiagnosticLogsConfigSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// UpdateDiagnosticLogsConfigResponder handles the response to the UpdateDiagnosticLogsConfig request. The method always +// closes the http.Response Body. +func (client AppsClient) UpdateDiagnosticLogsConfigResponder(resp *http.Response) (result SiteLogsConfig, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// UpdateDiagnosticLogsConfigSlot updates the logging configuration of an app. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. siteLogsConfig is a SiteLogsConfig JSON +// object that contains the logging configuration to change in the "properties" +// property. slot is name of the deployment slot. If a slot is not specified, +// the API will update the logging configuration for the production slot. +func (client AppsClient) UpdateDiagnosticLogsConfigSlot(resourceGroupName string, name string, siteLogsConfig SiteLogsConfig, slot string) (result SiteLogsConfig, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}, + {TargetValue: siteLogsConfig, + Constraints: []validation.Constraint{{Target: "siteLogsConfig.SiteLogsConfigProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "siteLogsConfig.SiteLogsConfigProperties.ApplicationLogs", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "siteLogsConfig.SiteLogsConfigProperties.ApplicationLogs.AzureTableStorage", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "siteLogsConfig.SiteLogsConfigProperties.ApplicationLogs.AzureTableStorage.SasURL", Name: validation.Null, Rule: true, Chain: nil}}}, + }}, + {Target: "siteLogsConfig.SiteLogsConfigProperties.HTTPLogs", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "siteLogsConfig.SiteLogsConfigProperties.HTTPLogs.FileSystem", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "siteLogsConfig.SiteLogsConfigProperties.HTTPLogs.FileSystem.RetentionInMb", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "siteLogsConfig.SiteLogsConfigProperties.HTTPLogs.FileSystem.RetentionInMb", Name: validation.InclusiveMaximum, Rule: 100, Chain: nil}, + {Target: "siteLogsConfig.SiteLogsConfigProperties.HTTPLogs.FileSystem.RetentionInMb", Name: validation.InclusiveMinimum, Rule: 25, Chain: nil}, + }}, + }}, + }}, + }}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "UpdateDiagnosticLogsConfigSlot") + } + + req, err := client.UpdateDiagnosticLogsConfigSlotPreparer(resourceGroupName, name, siteLogsConfig, slot) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "UpdateDiagnosticLogsConfigSlot", nil, "Failure preparing request") + } + + resp, err := client.UpdateDiagnosticLogsConfigSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "UpdateDiagnosticLogsConfigSlot", resp, "Failure sending request") + } + + result, err = client.UpdateDiagnosticLogsConfigSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateDiagnosticLogsConfigSlot", resp, "Failure responding to request") + } + + return +} + +// UpdateDiagnosticLogsConfigSlotPreparer prepares the UpdateDiagnosticLogsConfigSlot request. +func (client AppsClient) UpdateDiagnosticLogsConfigSlotPreparer(resourceGroupName string, name string, siteLogsConfig SiteLogsConfig, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/logs", pathParameters), + autorest.WithJSON(siteLogsConfig), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// UpdateDiagnosticLogsConfigSlotSender sends the UpdateDiagnosticLogsConfigSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) UpdateDiagnosticLogsConfigSlotSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// UpdateDiagnosticLogsConfigSlotResponder handles the response to the UpdateDiagnosticLogsConfigSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) UpdateDiagnosticLogsConfigSlotResponder(resp *http.Response) (result SiteLogsConfig, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// UpdateDomainOwnershipIdentifier creates a domain ownership identifier for +// web app, or updates an existing ownership identifier. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. domainOwnershipIdentifierName is name of +// domain ownership identifier. domainOwnershipIdentifier is a JSON +// representation of the domain ownership properties. +func (client AppsClient) UpdateDomainOwnershipIdentifier(resourceGroupName string, name string, domainOwnershipIdentifierName string, domainOwnershipIdentifier Identifier) (result Identifier, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "UpdateDomainOwnershipIdentifier") + } + + req, err := client.UpdateDomainOwnershipIdentifierPreparer(resourceGroupName, name, domainOwnershipIdentifierName, domainOwnershipIdentifier) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "UpdateDomainOwnershipIdentifier", nil, "Failure preparing request") + } + + resp, err := client.UpdateDomainOwnershipIdentifierSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "UpdateDomainOwnershipIdentifier", resp, "Failure sending request") + } + + result, err = client.UpdateDomainOwnershipIdentifierResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateDomainOwnershipIdentifier", resp, "Failure responding to request") + } + + return +} + +// UpdateDomainOwnershipIdentifierPreparer prepares the UpdateDomainOwnershipIdentifier request. +func (client AppsClient) UpdateDomainOwnershipIdentifierPreparer(resourceGroupName string, name string, domainOwnershipIdentifierName string, domainOwnershipIdentifier Identifier) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "domainOwnershipIdentifierName": autorest.Encode("path", domainOwnershipIdentifierName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/domainOwnershipIdentifiers/{domainOwnershipIdentifierName}", pathParameters), + autorest.WithJSON(domainOwnershipIdentifier), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// UpdateDomainOwnershipIdentifierSender sends the UpdateDomainOwnershipIdentifier request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) UpdateDomainOwnershipIdentifierSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// UpdateDomainOwnershipIdentifierResponder handles the response to the UpdateDomainOwnershipIdentifier request. The method always +// closes the http.Response Body. +func (client AppsClient) UpdateDomainOwnershipIdentifierResponder(resp *http.Response) (result Identifier, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// UpdateDomainOwnershipIdentifierSlot creates a domain ownership identifier +// for web app, or updates an existing ownership identifier. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. domainOwnershipIdentifierName is name of +// domain ownership identifier. domainOwnershipIdentifier is a JSON +// representation of the domain ownership properties. slot is name of the +// deployment slot. If a slot is not specified, the API will delete the binding +// for the production slot. +func (client AppsClient) UpdateDomainOwnershipIdentifierSlot(resourceGroupName string, name string, domainOwnershipIdentifierName string, domainOwnershipIdentifier Identifier, slot string) (result Identifier, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "UpdateDomainOwnershipIdentifierSlot") + } + + req, err := client.UpdateDomainOwnershipIdentifierSlotPreparer(resourceGroupName, name, domainOwnershipIdentifierName, domainOwnershipIdentifier, slot) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "UpdateDomainOwnershipIdentifierSlot", nil, "Failure preparing request") + } + + resp, err := client.UpdateDomainOwnershipIdentifierSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "UpdateDomainOwnershipIdentifierSlot", resp, "Failure sending request") + } + + result, err = client.UpdateDomainOwnershipIdentifierSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateDomainOwnershipIdentifierSlot", resp, "Failure responding to request") + } + + return +} + +// UpdateDomainOwnershipIdentifierSlotPreparer prepares the UpdateDomainOwnershipIdentifierSlot request. +func (client AppsClient) UpdateDomainOwnershipIdentifierSlotPreparer(resourceGroupName string, name string, domainOwnershipIdentifierName string, domainOwnershipIdentifier Identifier, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "domainOwnershipIdentifierName": autorest.Encode("path", domainOwnershipIdentifierName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/domainOwnershipIdentifiers/{domainOwnershipIdentifierName}", pathParameters), + autorest.WithJSON(domainOwnershipIdentifier), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// UpdateDomainOwnershipIdentifierSlotSender sends the UpdateDomainOwnershipIdentifierSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) UpdateDomainOwnershipIdentifierSlotSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// UpdateDomainOwnershipIdentifierSlotResponder handles the response to the UpdateDomainOwnershipIdentifierSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) UpdateDomainOwnershipIdentifierSlotResponder(resp *http.Response) (result Identifier, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// UpdateHybridConnection creates a new Hybrid Connection using a Service Bus +// relay. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is the name of the web app namespaceName is the namespace for +// this hybrid connection relayName is the relay name for this hybrid +// connection connectionEnvelope is the details of the hybrid connection +func (client AppsClient) UpdateHybridConnection(resourceGroupName string, name string, namespaceName string, relayName string, connectionEnvelope HybridConnection) (result HybridConnection, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "UpdateHybridConnection") + } + + req, err := client.UpdateHybridConnectionPreparer(resourceGroupName, name, namespaceName, relayName, connectionEnvelope) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "UpdateHybridConnection", nil, "Failure preparing request") + } + + resp, err := client.UpdateHybridConnectionSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "UpdateHybridConnection", resp, "Failure sending request") + } + + result, err = client.UpdateHybridConnectionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateHybridConnection", resp, "Failure responding to request") + } + + return +} + +// UpdateHybridConnectionPreparer prepares the UpdateHybridConnection request. +func (client AppsClient) UpdateHybridConnectionPreparer(resourceGroupName string, name string, namespaceName string, relayName string, connectionEnvelope HybridConnection) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "namespaceName": autorest.Encode("path", namespaceName), + "relayName": autorest.Encode("path", relayName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/hybridConnectionNamespaces/{namespaceName}/relays/{relayName}", pathParameters), + autorest.WithJSON(connectionEnvelope), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// UpdateHybridConnectionSender sends the UpdateHybridConnection request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) UpdateHybridConnectionSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// UpdateHybridConnectionResponder handles the response to the UpdateHybridConnection request. The method always +// closes the http.Response Body. +func (client AppsClient) UpdateHybridConnectionResponder(resp *http.Response) (result HybridConnection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// UpdateHybridConnectionSlot creates a new Hybrid Connection using a Service +// Bus relay. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is the name of the web app namespaceName is the namespace for +// this hybrid connection relayName is the relay name for this hybrid +// connection connectionEnvelope is the details of the hybrid connection slot +// is the name of the slot for the web app. +func (client AppsClient) UpdateHybridConnectionSlot(resourceGroupName string, name string, namespaceName string, relayName string, connectionEnvelope HybridConnection, slot string) (result HybridConnection, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "UpdateHybridConnectionSlot") + } + + req, err := client.UpdateHybridConnectionSlotPreparer(resourceGroupName, name, namespaceName, relayName, connectionEnvelope, slot) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "UpdateHybridConnectionSlot", nil, "Failure preparing request") + } + + resp, err := client.UpdateHybridConnectionSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "UpdateHybridConnectionSlot", resp, "Failure sending request") + } + + result, err = client.UpdateHybridConnectionSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateHybridConnectionSlot", resp, "Failure responding to request") + } + + return +} + +// UpdateHybridConnectionSlotPreparer prepares the UpdateHybridConnectionSlot request. +func (client AppsClient) UpdateHybridConnectionSlotPreparer(resourceGroupName string, name string, namespaceName string, relayName string, connectionEnvelope HybridConnection, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "namespaceName": autorest.Encode("path", namespaceName), + "relayName": autorest.Encode("path", relayName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/hybridConnectionNamespaces/{namespaceName}/relays/{relayName}", pathParameters), + autorest.WithJSON(connectionEnvelope), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// UpdateHybridConnectionSlotSender sends the UpdateHybridConnectionSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) UpdateHybridConnectionSlotSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// UpdateHybridConnectionSlotResponder handles the response to the UpdateHybridConnectionSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) UpdateHybridConnectionSlotResponder(resp *http.Response) (result HybridConnection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// UpdateMetadata replaces the metadata of an app. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. metadata is edited metadata of the app or +// deployment slot. See example. +func (client AppsClient) UpdateMetadata(resourceGroupName string, name string, metadata StringDictionary) (result StringDictionary, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "UpdateMetadata") + } + + req, err := client.UpdateMetadataPreparer(resourceGroupName, name, metadata) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "UpdateMetadata", nil, "Failure preparing request") + } + + resp, err := client.UpdateMetadataSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "UpdateMetadata", resp, "Failure sending request") + } + + result, err = client.UpdateMetadataResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateMetadata", resp, "Failure responding to request") + } + + return +} + +// UpdateMetadataPreparer prepares the UpdateMetadata request. +func (client AppsClient) UpdateMetadataPreparer(resourceGroupName string, name string, metadata StringDictionary) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/metadata", pathParameters), + autorest.WithJSON(metadata), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// UpdateMetadataSender sends the UpdateMetadata request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) UpdateMetadataSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// UpdateMetadataResponder handles the response to the UpdateMetadata request. The method always +// closes the http.Response Body. +func (client AppsClient) UpdateMetadataResponder(resp *http.Response) (result StringDictionary, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// UpdateMetadataSlot replaces the metadata of an app. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. metadata is edited metadata of the app or +// deployment slot. See example. slot is name of the deployment slot. If a slot +// is not specified, the API will update the metadata for the production slot. +func (client AppsClient) UpdateMetadataSlot(resourceGroupName string, name string, metadata StringDictionary, slot string) (result StringDictionary, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "UpdateMetadataSlot") + } + + req, err := client.UpdateMetadataSlotPreparer(resourceGroupName, name, metadata, slot) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "UpdateMetadataSlot", nil, "Failure preparing request") + } + + resp, err := client.UpdateMetadataSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "UpdateMetadataSlot", resp, "Failure sending request") + } + + result, err = client.UpdateMetadataSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateMetadataSlot", resp, "Failure responding to request") + } + + return +} + +// UpdateMetadataSlotPreparer prepares the UpdateMetadataSlot request. +func (client AppsClient) UpdateMetadataSlotPreparer(resourceGroupName string, name string, metadata StringDictionary, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/metadata", pathParameters), + autorest.WithJSON(metadata), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// UpdateMetadataSlotSender sends the UpdateMetadataSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) UpdateMetadataSlotSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// UpdateMetadataSlotResponder handles the response to the UpdateMetadataSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) UpdateMetadataSlotResponder(resp *http.Response) (result StringDictionary, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// UpdateRelayServiceConnection creates a new hybrid connection configuration +// (PUT), or updates an existing one (PATCH). +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. entityName is name of the hybrid +// connection configuration. connectionEnvelope is details of the hybrid +// connection configuration. +func (client AppsClient) UpdateRelayServiceConnection(resourceGroupName string, name string, entityName string, connectionEnvelope RelayServiceConnectionEntity) (result RelayServiceConnectionEntity, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "UpdateRelayServiceConnection") + } + + req, err := client.UpdateRelayServiceConnectionPreparer(resourceGroupName, name, entityName, connectionEnvelope) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "UpdateRelayServiceConnection", nil, "Failure preparing request") + } + + resp, err := client.UpdateRelayServiceConnectionSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "UpdateRelayServiceConnection", resp, "Failure sending request") + } + + result, err = client.UpdateRelayServiceConnectionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateRelayServiceConnection", resp, "Failure responding to request") + } + + return +} + +// UpdateRelayServiceConnectionPreparer prepares the UpdateRelayServiceConnection request. +func (client AppsClient) UpdateRelayServiceConnectionPreparer(resourceGroupName string, name string, entityName string, connectionEnvelope RelayServiceConnectionEntity) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "entityName": autorest.Encode("path", entityName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/hybridconnection/{entityName}", pathParameters), + autorest.WithJSON(connectionEnvelope), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// UpdateRelayServiceConnectionSender sends the UpdateRelayServiceConnection request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) UpdateRelayServiceConnectionSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// UpdateRelayServiceConnectionResponder handles the response to the UpdateRelayServiceConnection request. The method always +// closes the http.Response Body. +func (client AppsClient) UpdateRelayServiceConnectionResponder(resp *http.Response) (result RelayServiceConnectionEntity, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// UpdateRelayServiceConnectionSlot creates a new hybrid connection +// configuration (PUT), or updates an existing one (PATCH). +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. entityName is name of the hybrid +// connection configuration. connectionEnvelope is details of the hybrid +// connection configuration. slot is name of the deployment slot. If a slot is +// not specified, the API will create or update a hybrid connection for the +// production slot. +func (client AppsClient) UpdateRelayServiceConnectionSlot(resourceGroupName string, name string, entityName string, connectionEnvelope RelayServiceConnectionEntity, slot string) (result RelayServiceConnectionEntity, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "UpdateRelayServiceConnectionSlot") + } + + req, err := client.UpdateRelayServiceConnectionSlotPreparer(resourceGroupName, name, entityName, connectionEnvelope, slot) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "UpdateRelayServiceConnectionSlot", nil, "Failure preparing request") + } + + resp, err := client.UpdateRelayServiceConnectionSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "UpdateRelayServiceConnectionSlot", resp, "Failure sending request") + } + + result, err = client.UpdateRelayServiceConnectionSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateRelayServiceConnectionSlot", resp, "Failure responding to request") + } + + return +} + +// UpdateRelayServiceConnectionSlotPreparer prepares the UpdateRelayServiceConnectionSlot request. +func (client AppsClient) UpdateRelayServiceConnectionSlotPreparer(resourceGroupName string, name string, entityName string, connectionEnvelope RelayServiceConnectionEntity, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "entityName": autorest.Encode("path", entityName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/hybridconnection/{entityName}", pathParameters), + autorest.WithJSON(connectionEnvelope), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// UpdateRelayServiceConnectionSlotSender sends the UpdateRelayServiceConnectionSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) UpdateRelayServiceConnectionSlotSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// UpdateRelayServiceConnectionSlotResponder handles the response to the UpdateRelayServiceConnectionSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) UpdateRelayServiceConnectionSlotResponder(resp *http.Response) (result RelayServiceConnectionEntity, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// UpdateSitePushSettings updates the Push settings associated with web app. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of web app pushSettings is push settings associated +// with web app +func (client AppsClient) UpdateSitePushSettings(resourceGroupName string, name string, pushSettings PushSettings) (result PushSettings, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}, + {TargetValue: pushSettings, + Constraints: []validation.Constraint{{Target: "pushSettings.IsPushEnabled", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "UpdateSitePushSettings") + } + + req, err := client.UpdateSitePushSettingsPreparer(resourceGroupName, name, pushSettings) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "UpdateSitePushSettings", nil, "Failure preparing request") + } + + resp, err := client.UpdateSitePushSettingsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "UpdateSitePushSettings", resp, "Failure sending request") + } + + result, err = client.UpdateSitePushSettingsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateSitePushSettings", resp, "Failure responding to request") + } + + return +} + +// UpdateSitePushSettingsPreparer prepares the UpdateSitePushSettings request. +func (client AppsClient) UpdateSitePushSettingsPreparer(resourceGroupName string, name string, pushSettings PushSettings) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/pushsettings", pathParameters), + autorest.WithJSON(pushSettings), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// UpdateSitePushSettingsSender sends the UpdateSitePushSettings request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) UpdateSitePushSettingsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// UpdateSitePushSettingsResponder handles the response to the UpdateSitePushSettings request. The method always +// closes the http.Response Body. +func (client AppsClient) UpdateSitePushSettingsResponder(resp *http.Response) (result PushSettings, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// UpdateSitePushSettingsSlot updates the Push settings associated with web +// app. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of web app pushSettings is push settings associated +// with web app slot is name of web app slot. If not specified then will +// default to production slot. +func (client AppsClient) UpdateSitePushSettingsSlot(resourceGroupName string, name string, pushSettings PushSettings, slot string) (result PushSettings, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}, + {TargetValue: pushSettings, + Constraints: []validation.Constraint{{Target: "pushSettings.IsPushEnabled", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "UpdateSitePushSettingsSlot") + } + + req, err := client.UpdateSitePushSettingsSlotPreparer(resourceGroupName, name, pushSettings, slot) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "UpdateSitePushSettingsSlot", nil, "Failure preparing request") + } + + resp, err := client.UpdateSitePushSettingsSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "UpdateSitePushSettingsSlot", resp, "Failure sending request") + } + + result, err = client.UpdateSitePushSettingsSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateSitePushSettingsSlot", resp, "Failure responding to request") + } + + return +} + +// UpdateSitePushSettingsSlotPreparer prepares the UpdateSitePushSettingsSlot request. +func (client AppsClient) UpdateSitePushSettingsSlotPreparer(resourceGroupName string, name string, pushSettings PushSettings, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/pushsettings", pathParameters), + autorest.WithJSON(pushSettings), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// UpdateSitePushSettingsSlotSender sends the UpdateSitePushSettingsSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) UpdateSitePushSettingsSlotSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// UpdateSitePushSettingsSlotResponder handles the response to the UpdateSitePushSettingsSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) UpdateSitePushSettingsSlotResponder(resp *http.Response) (result PushSettings, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// UpdateSlotConfigurationNames updates the names of application settings and +// connection string that remain with the slot during swap operation. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. slotConfigNames is names of application +// settings and connection strings. See example. +func (client AppsClient) UpdateSlotConfigurationNames(resourceGroupName string, name string, slotConfigNames SlotConfigNamesResource) (result SlotConfigNamesResource, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "UpdateSlotConfigurationNames") + } + + req, err := client.UpdateSlotConfigurationNamesPreparer(resourceGroupName, name, slotConfigNames) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "UpdateSlotConfigurationNames", nil, "Failure preparing request") + } + + resp, err := client.UpdateSlotConfigurationNamesSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "UpdateSlotConfigurationNames", resp, "Failure sending request") + } + + result, err = client.UpdateSlotConfigurationNamesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateSlotConfigurationNames", resp, "Failure responding to request") + } + + return +} + +// UpdateSlotConfigurationNamesPreparer prepares the UpdateSlotConfigurationNames request. +func (client AppsClient) UpdateSlotConfigurationNamesPreparer(resourceGroupName string, name string, slotConfigNames SlotConfigNamesResource) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/slotConfigNames", pathParameters), + autorest.WithJSON(slotConfigNames), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// UpdateSlotConfigurationNamesSender sends the UpdateSlotConfigurationNames request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) UpdateSlotConfigurationNamesSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// UpdateSlotConfigurationNamesResponder handles the response to the UpdateSlotConfigurationNames request. The method always +// closes the http.Response Body. +func (client AppsClient) UpdateSlotConfigurationNamesResponder(resp *http.Response) (result SlotConfigNamesResource, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// UpdateVnetConnection adds a Virtual Network connection to an app or slot +// (PUT) or updates the connection properties (PATCH). +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. vnetName is name of an existing Virtual +// Network. connectionEnvelope is properties of the Virtual Network connection. +// See example. +func (client AppsClient) UpdateVnetConnection(resourceGroupName string, name string, vnetName string, connectionEnvelope VnetInfo) (result VnetInfo, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "UpdateVnetConnection") + } + + req, err := client.UpdateVnetConnectionPreparer(resourceGroupName, name, vnetName, connectionEnvelope) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "UpdateVnetConnection", nil, "Failure preparing request") + } + + resp, err := client.UpdateVnetConnectionSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "UpdateVnetConnection", resp, "Failure sending request") + } + + result, err = client.UpdateVnetConnectionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateVnetConnection", resp, "Failure responding to request") + } + + return +} + +// UpdateVnetConnectionPreparer prepares the UpdateVnetConnection request. +func (client AppsClient) UpdateVnetConnectionPreparer(resourceGroupName string, name string, vnetName string, connectionEnvelope VnetInfo) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vnetName": autorest.Encode("path", vnetName), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/virtualNetworkConnections/{vnetName}", pathParameters), + autorest.WithJSON(connectionEnvelope), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// UpdateVnetConnectionSender sends the UpdateVnetConnection request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) UpdateVnetConnectionSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// UpdateVnetConnectionResponder handles the response to the UpdateVnetConnection request. The method always +// closes the http.Response Body. +func (client AppsClient) UpdateVnetConnectionResponder(resp *http.Response) (result VnetInfo, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// UpdateVnetConnectionGateway adds a gateway to a connected Virtual Network +// (PUT) or updates it (PATCH). +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. vnetName is name of the Virtual Network. +// gatewayName is name of the gateway. Currently, the only supported string is +// "primary". connectionEnvelope is the properties to update this gateway with. +func (client AppsClient) UpdateVnetConnectionGateway(resourceGroupName string, name string, vnetName string, gatewayName string, connectionEnvelope VnetGateway) (result VnetGateway, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "UpdateVnetConnectionGateway") + } + + req, err := client.UpdateVnetConnectionGatewayPreparer(resourceGroupName, name, vnetName, gatewayName, connectionEnvelope) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "UpdateVnetConnectionGateway", nil, "Failure preparing request") + } + + resp, err := client.UpdateVnetConnectionGatewaySender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "UpdateVnetConnectionGateway", resp, "Failure sending request") + } + + result, err = client.UpdateVnetConnectionGatewayResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateVnetConnectionGateway", resp, "Failure responding to request") + } + + return +} + +// UpdateVnetConnectionGatewayPreparer prepares the UpdateVnetConnectionGateway request. +func (client AppsClient) UpdateVnetConnectionGatewayPreparer(resourceGroupName string, name string, vnetName string, gatewayName string, connectionEnvelope VnetGateway) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "gatewayName": autorest.Encode("path", gatewayName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vnetName": autorest.Encode("path", vnetName), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/virtualNetworkConnections/{vnetName}/gateways/{gatewayName}", pathParameters), + autorest.WithJSON(connectionEnvelope), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// UpdateVnetConnectionGatewaySender sends the UpdateVnetConnectionGateway request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) UpdateVnetConnectionGatewaySender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// UpdateVnetConnectionGatewayResponder handles the response to the UpdateVnetConnectionGateway request. The method always +// closes the http.Response Body. +func (client AppsClient) UpdateVnetConnectionGatewayResponder(resp *http.Response) (result VnetGateway, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// UpdateVnetConnectionGatewaySlot adds a gateway to a connected Virtual +// Network (PUT) or updates it (PATCH). +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. vnetName is name of the Virtual Network. +// gatewayName is name of the gateway. Currently, the only supported string is +// "primary". connectionEnvelope is the properties to update this gateway with. +// slot is name of the deployment slot. If a slot is not specified, the API +// will add or update a gateway for the production slot's Virtual Network. +func (client AppsClient) UpdateVnetConnectionGatewaySlot(resourceGroupName string, name string, vnetName string, gatewayName string, connectionEnvelope VnetGateway, slot string) (result VnetGateway, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "UpdateVnetConnectionGatewaySlot") + } + + req, err := client.UpdateVnetConnectionGatewaySlotPreparer(resourceGroupName, name, vnetName, gatewayName, connectionEnvelope, slot) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "UpdateVnetConnectionGatewaySlot", nil, "Failure preparing request") + } + + resp, err := client.UpdateVnetConnectionGatewaySlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "UpdateVnetConnectionGatewaySlot", resp, "Failure sending request") + } + + result, err = client.UpdateVnetConnectionGatewaySlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateVnetConnectionGatewaySlot", resp, "Failure responding to request") + } + + return +} + +// UpdateVnetConnectionGatewaySlotPreparer prepares the UpdateVnetConnectionGatewaySlot request. +func (client AppsClient) UpdateVnetConnectionGatewaySlotPreparer(resourceGroupName string, name string, vnetName string, gatewayName string, connectionEnvelope VnetGateway, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "gatewayName": autorest.Encode("path", gatewayName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vnetName": autorest.Encode("path", vnetName), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/virtualNetworkConnections/{vnetName}/gateways/{gatewayName}", pathParameters), + autorest.WithJSON(connectionEnvelope), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// UpdateVnetConnectionGatewaySlotSender sends the UpdateVnetConnectionGatewaySlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) UpdateVnetConnectionGatewaySlotSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// UpdateVnetConnectionGatewaySlotResponder handles the response to the UpdateVnetConnectionGatewaySlot request. The method always +// closes the http.Response Body. +func (client AppsClient) UpdateVnetConnectionGatewaySlotResponder(resp *http.Response) (result VnetGateway, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// UpdateVnetConnectionSlot adds a Virtual Network connection to an app or slot +// (PUT) or updates the connection properties (PATCH). +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. vnetName is name of an existing Virtual +// Network. connectionEnvelope is properties of the Virtual Network connection. +// See example. slot is name of the deployment slot. If a slot is not +// specified, the API will add or update connections for the production slot. +func (client AppsClient) UpdateVnetConnectionSlot(resourceGroupName string, name string, vnetName string, connectionEnvelope VnetInfo, slot string) (result VnetInfo, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "UpdateVnetConnectionSlot") + } + + req, err := client.UpdateVnetConnectionSlotPreparer(resourceGroupName, name, vnetName, connectionEnvelope, slot) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "UpdateVnetConnectionSlot", nil, "Failure preparing request") + } + + resp, err := client.UpdateVnetConnectionSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "UpdateVnetConnectionSlot", resp, "Failure sending request") + } + + result, err = client.UpdateVnetConnectionSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateVnetConnectionSlot", resp, "Failure responding to request") + } + + return +} + +// UpdateVnetConnectionSlotPreparer prepares the UpdateVnetConnectionSlot request. +func (client AppsClient) UpdateVnetConnectionSlotPreparer(resourceGroupName string, name string, vnetName string, connectionEnvelope VnetInfo, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vnetName": autorest.Encode("path", vnetName), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/virtualNetworkConnections/{vnetName}", pathParameters), + autorest.WithJSON(connectionEnvelope), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// UpdateVnetConnectionSlotSender sends the UpdateVnetConnectionSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) UpdateVnetConnectionSlotSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// UpdateVnetConnectionSlotResponder handles the response to the UpdateVnetConnectionSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) UpdateVnetConnectionSlotResponder(resp *http.Response) (result VnetInfo, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/arm/web/appservicecertificateorders.go b/arm/web/appservicecertificateorders.go new file mode 100755 index 000000000000..bea46d063418 --- /dev/null +++ b/arm/web/appservicecertificateorders.go @@ -0,0 +1,1433 @@ +package web + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// 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/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// AppServiceCertificateOrdersClient is the composite Swagger for WebSite +// Management Client +type AppServiceCertificateOrdersClient struct { + ManagementClient +} + +// NewAppServiceCertificateOrdersClient creates an instance of the +// AppServiceCertificateOrdersClient client. +func NewAppServiceCertificateOrdersClient(subscriptionID string) AppServiceCertificateOrdersClient { + return NewAppServiceCertificateOrdersClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewAppServiceCertificateOrdersClientWithBaseURI creates an instance of the +// AppServiceCertificateOrdersClient client. +func NewAppServiceCertificateOrdersClientWithBaseURI(baseURI string, subscriptionID string) AppServiceCertificateOrdersClient { + return AppServiceCertificateOrdersClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate create or update a certificate purchase order. This method +// may poll for completion. Polling can be canceled by passing the cancel +// channel argument. The channel will be used to cancel polling and any +// outstanding HTTP requests. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. certificateOrderName is name of the certificate order. +// certificateDistinguishedName is distinguished name to to use for the +// certificate order. +func (client AppServiceCertificateOrdersClient) CreateOrUpdate(resourceGroupName string, certificateOrderName string, certificateDistinguishedName AppServiceCertificateOrder, cancel <-chan struct{}) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}, + {TargetValue: certificateDistinguishedName, + Constraints: []validation.Constraint{{Target: "certificateDistinguishedName.AppServiceCertificateOrderProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "certificateDistinguishedName.AppServiceCertificateOrderProperties.ValidityInYears", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "certificateDistinguishedName.AppServiceCertificateOrderProperties.ValidityInYears", Name: validation.InclusiveMaximum, Rule: 3, Chain: nil}, + {Target: "certificateDistinguishedName.AppServiceCertificateOrderProperties.ValidityInYears", Name: validation.InclusiveMinimum, Rule: 1, Chain: nil}, + }}, + }}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppServiceCertificateOrdersClient", "CreateOrUpdate") + } + + req, err := client.CreateOrUpdatePreparer(resourceGroupName, certificateOrderName, certificateDistinguishedName, cancel) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "CreateOrUpdate", nil, "Failure preparing request") + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = resp + return result, autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "CreateOrUpdate", resp, "Failure sending request") + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "CreateOrUpdate", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client AppServiceCertificateOrdersClient) CreateOrUpdatePreparer(resourceGroupName string, certificateOrderName string, certificateDistinguishedName AppServiceCertificateOrder, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "certificateOrderName": autorest.Encode("path", certificateOrderName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName}", pathParameters), + autorest.WithJSON(certificateDistinguishedName), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client AppServiceCertificateOrdersClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client AppServiceCertificateOrdersClient) CreateOrUpdateResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByClosing()) + result.Response = resp + return +} + +// CreateOrUpdateCertificate creates or updates a certificate and associates +// with key vault secret. This method may poll for completion. Polling can be +// canceled by passing the cancel channel argument. The channel will be used to +// cancel polling and any outstanding HTTP requests. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. certificateOrderName is name of the certificate order. name is name +// of the certificate. keyVaultCertificate is key vault certificate resource +// Id. +func (client AppServiceCertificateOrdersClient) CreateOrUpdateCertificate(resourceGroupName string, certificateOrderName string, name string, keyVaultCertificate AppServiceCertificateResource, cancel <-chan struct{}) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppServiceCertificateOrdersClient", "CreateOrUpdateCertificate") + } + + req, err := client.CreateOrUpdateCertificatePreparer(resourceGroupName, certificateOrderName, name, keyVaultCertificate, cancel) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "CreateOrUpdateCertificate", nil, "Failure preparing request") + } + + resp, err := client.CreateOrUpdateCertificateSender(req) + if err != nil { + result.Response = resp + return result, autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "CreateOrUpdateCertificate", resp, "Failure sending request") + } + + result, err = client.CreateOrUpdateCertificateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "CreateOrUpdateCertificate", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdateCertificatePreparer prepares the CreateOrUpdateCertificate request. +func (client AppServiceCertificateOrdersClient) CreateOrUpdateCertificatePreparer(resourceGroupName string, certificateOrderName string, name string, keyVaultCertificate AppServiceCertificateResource, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "certificateOrderName": autorest.Encode("path", certificateOrderName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName}/certificates/{name}", pathParameters), + autorest.WithJSON(keyVaultCertificate), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// CreateOrUpdateCertificateSender sends the CreateOrUpdateCertificate request. The method will close the +// http.Response Body if it receives an error. +func (client AppServiceCertificateOrdersClient) CreateOrUpdateCertificateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// CreateOrUpdateCertificateResponder handles the response to the CreateOrUpdateCertificate request. The method always +// closes the http.Response Body. +func (client AppServiceCertificateOrdersClient) CreateOrUpdateCertificateResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByClosing()) + result.Response = resp + return +} + +// Delete delete an existing certificate order. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. certificateOrderName is name of the certificate order. +func (client AppServiceCertificateOrdersClient) Delete(resourceGroupName string, certificateOrderName string) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppServiceCertificateOrdersClient", "Delete") + } + + req, err := client.DeletePreparer(resourceGroupName, certificateOrderName) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "Delete", nil, "Failure preparing request") + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + return result, autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "Delete", resp, "Failure sending request") + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client AppServiceCertificateOrdersClient) DeletePreparer(resourceGroupName string, certificateOrderName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "certificateOrderName": autorest.Encode("path", certificateOrderName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-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.CertificateRegistration/certificateOrders/{certificateOrderName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client AppServiceCertificateOrdersClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client AppServiceCertificateOrdersClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// DeleteCertificate delete the certificate associated with a certificate +// order. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. certificateOrderName is name of the certificate order. name is name +// of the certificate. +func (client AppServiceCertificateOrdersClient) DeleteCertificate(resourceGroupName string, certificateOrderName string, name string) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppServiceCertificateOrdersClient", "DeleteCertificate") + } + + req, err := client.DeleteCertificatePreparer(resourceGroupName, certificateOrderName, name) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "DeleteCertificate", nil, "Failure preparing request") + } + + resp, err := client.DeleteCertificateSender(req) + if err != nil { + result.Response = resp + return result, autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "DeleteCertificate", resp, "Failure sending request") + } + + result, err = client.DeleteCertificateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "DeleteCertificate", resp, "Failure responding to request") + } + + return +} + +// DeleteCertificatePreparer prepares the DeleteCertificate request. +func (client AppServiceCertificateOrdersClient) DeleteCertificatePreparer(resourceGroupName string, certificateOrderName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "certificateOrderName": autorest.Encode("path", certificateOrderName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-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.CertificateRegistration/certificateOrders/{certificateOrderName}/certificates/{name}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DeleteCertificateSender sends the DeleteCertificate request. The method will close the +// http.Response Body if it receives an error. +func (client AppServiceCertificateOrdersClient) DeleteCertificateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteCertificateResponder handles the response to the DeleteCertificate request. The method always +// closes the http.Response Body. +func (client AppServiceCertificateOrdersClient) DeleteCertificateResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get get a certificate order. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. certificateOrderName is name of the certificate order.. +func (client AppServiceCertificateOrdersClient) Get(resourceGroupName string, certificateOrderName string) (result AppServiceCertificateOrder, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppServiceCertificateOrdersClient", "Get") + } + + req, err := client.GetPreparer(resourceGroupName, certificateOrderName) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "Get", nil, "Failure preparing request") + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "Get", resp, "Failure sending request") + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client AppServiceCertificateOrdersClient) GetPreparer(resourceGroupName string, certificateOrderName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "certificateOrderName": autorest.Encode("path", certificateOrderName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-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.CertificateRegistration/certificateOrders/{certificateOrderName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client AppServiceCertificateOrdersClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client AppServiceCertificateOrdersClient) GetResponder(resp *http.Response) (result AppServiceCertificateOrder, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetCertificate get the certificate associated with a certificate order. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. certificateOrderName is name of the certificate order. name is name +// of the certificate. +func (client AppServiceCertificateOrdersClient) GetCertificate(resourceGroupName string, certificateOrderName string, name string) (result AppServiceCertificateResource, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppServiceCertificateOrdersClient", "GetCertificate") + } + + req, err := client.GetCertificatePreparer(resourceGroupName, certificateOrderName, name) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "GetCertificate", nil, "Failure preparing request") + } + + resp, err := client.GetCertificateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "GetCertificate", resp, "Failure sending request") + } + + result, err = client.GetCertificateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "GetCertificate", resp, "Failure responding to request") + } + + return +} + +// GetCertificatePreparer prepares the GetCertificate request. +func (client AppServiceCertificateOrdersClient) GetCertificatePreparer(resourceGroupName string, certificateOrderName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "certificateOrderName": autorest.Encode("path", certificateOrderName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-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.CertificateRegistration/certificateOrders/{certificateOrderName}/certificates/{name}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetCertificateSender sends the GetCertificate request. The method will close the +// http.Response Body if it receives an error. +func (client AppServiceCertificateOrdersClient) GetCertificateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetCertificateResponder handles the response to the GetCertificate request. The method always +// closes the http.Response Body. +func (client AppServiceCertificateOrdersClient) GetCertificateResponder(resp *http.Response) (result AppServiceCertificateResource, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List list all certificate orders in a subscription. +func (client AppServiceCertificateOrdersClient) List() (result AppServiceCertificateOrderCollection, err error) { + req, err := client.ListPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "List", nil, "Failure preparing request") + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "List", resp, "Failure sending request") + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client AppServiceCertificateOrdersClient) ListPreparer() (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.CertificateRegistration/certificateOrders", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client AppServiceCertificateOrdersClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client AppServiceCertificateOrdersClient) ListResponder(resp *http.Response) (result AppServiceCertificateOrderCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + 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 AppServiceCertificateOrdersClient) ListNextResults(lastResults AppServiceCertificateOrderCollection) (result AppServiceCertificateOrderCollection, err error) { + req, err := lastResults.AppServiceCertificateOrderCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "List", 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, "web.AppServiceCertificateOrdersClient", "List", resp, "Failure sending next results request") + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "List", resp, "Failure responding to next results request") + } + + return +} + +// ListByResourceGroup get certificate orders in a resource group. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. +func (client AppServiceCertificateOrdersClient) ListByResourceGroup(resourceGroupName string) (result AppServiceCertificateOrderCollection, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppServiceCertificateOrdersClient", "ListByResourceGroup") + } + + req, err := client.ListByResourceGroupPreparer(resourceGroupName) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "ListByResourceGroup", nil, "Failure preparing request") + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "ListByResourceGroup", resp, "Failure sending request") + } + + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "ListByResourceGroup", resp, "Failure responding to request") + } + + return +} + +// ListByResourceGroupPreparer prepares the ListByResourceGroup request. +func (client AppServiceCertificateOrdersClient) ListByResourceGroupPreparer(resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-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.CertificateRegistration/certificateOrders", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the +// http.Response Body if it receives an error. +func (client AppServiceCertificateOrdersClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (client AppServiceCertificateOrdersClient) ListByResourceGroupResponder(resp *http.Response) (result AppServiceCertificateOrderCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + 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 AppServiceCertificateOrdersClient) ListByResourceGroupNextResults(lastResults AppServiceCertificateOrderCollection) (result AppServiceCertificateOrderCollection, err error) { + req, err := lastResults.AppServiceCertificateOrderCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "ListByResourceGroup", 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, "web.AppServiceCertificateOrdersClient", "ListByResourceGroup", resp, "Failure sending next results request") + } + + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "ListByResourceGroup", resp, "Failure responding to next results request") + } + + return +} + +// ListCertificates list all certificates associated with a certificate order. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. certificateOrderName is name of the certificate order. +func (client AppServiceCertificateOrdersClient) ListCertificates(resourceGroupName string, certificateOrderName string) (result AppServiceCertificateCollection, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppServiceCertificateOrdersClient", "ListCertificates") + } + + req, err := client.ListCertificatesPreparer(resourceGroupName, certificateOrderName) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "ListCertificates", nil, "Failure preparing request") + } + + resp, err := client.ListCertificatesSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "ListCertificates", resp, "Failure sending request") + } + + result, err = client.ListCertificatesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "ListCertificates", resp, "Failure responding to request") + } + + return +} + +// ListCertificatesPreparer prepares the ListCertificates request. +func (client AppServiceCertificateOrdersClient) ListCertificatesPreparer(resourceGroupName string, certificateOrderName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "certificateOrderName": autorest.Encode("path", certificateOrderName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-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.CertificateRegistration/certificateOrders/{certificateOrderName}/certificates", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListCertificatesSender sends the ListCertificates request. The method will close the +// http.Response Body if it receives an error. +func (client AppServiceCertificateOrdersClient) ListCertificatesSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListCertificatesResponder handles the response to the ListCertificates request. The method always +// closes the http.Response Body. +func (client AppServiceCertificateOrdersClient) ListCertificatesResponder(resp *http.Response) (result AppServiceCertificateCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListCertificatesNextResults retrieves the next set of results, if any. +func (client AppServiceCertificateOrdersClient) ListCertificatesNextResults(lastResults AppServiceCertificateCollection) (result AppServiceCertificateCollection, err error) { + req, err := lastResults.AppServiceCertificateCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "ListCertificates", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListCertificatesSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "ListCertificates", resp, "Failure sending next results request") + } + + result, err = client.ListCertificatesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "ListCertificates", resp, "Failure responding to next results request") + } + + return +} + +// Reissue reissue an existing certificate order. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. certificateOrderName is name of the certificate order. +// reissueCertificateOrderRequest is parameters for the reissue. +func (client AppServiceCertificateOrdersClient) Reissue(resourceGroupName string, certificateOrderName string, reissueCertificateOrderRequest ReissueCertificateOrderRequest) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppServiceCertificateOrdersClient", "Reissue") + } + + req, err := client.ReissuePreparer(resourceGroupName, certificateOrderName, reissueCertificateOrderRequest) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "Reissue", nil, "Failure preparing request") + } + + resp, err := client.ReissueSender(req) + if err != nil { + result.Response = resp + return result, autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "Reissue", resp, "Failure sending request") + } + + result, err = client.ReissueResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "Reissue", resp, "Failure responding to request") + } + + return +} + +// ReissuePreparer prepares the Reissue request. +func (client AppServiceCertificateOrdersClient) ReissuePreparer(resourceGroupName string, certificateOrderName string, reissueCertificateOrderRequest ReissueCertificateOrderRequest) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "certificateOrderName": autorest.Encode("path", certificateOrderName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName}/reissue", pathParameters), + autorest.WithJSON(reissueCertificateOrderRequest), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ReissueSender sends the Reissue request. The method will close the +// http.Response Body if it receives an error. +func (client AppServiceCertificateOrdersClient) ReissueSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ReissueResponder handles the response to the Reissue request. The method always +// closes the http.Response Body. +func (client AppServiceCertificateOrdersClient) ReissueResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Renew renew an existing certificate order. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. certificateOrderName is name of the certificate order. +// renewCertificateOrderRequest is renew parameters +func (client AppServiceCertificateOrdersClient) Renew(resourceGroupName string, certificateOrderName string, renewCertificateOrderRequest RenewCertificateOrderRequest) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppServiceCertificateOrdersClient", "Renew") + } + + req, err := client.RenewPreparer(resourceGroupName, certificateOrderName, renewCertificateOrderRequest) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "Renew", nil, "Failure preparing request") + } + + resp, err := client.RenewSender(req) + if err != nil { + result.Response = resp + return result, autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "Renew", resp, "Failure sending request") + } + + result, err = client.RenewResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "Renew", resp, "Failure responding to request") + } + + return +} + +// RenewPreparer prepares the Renew request. +func (client AppServiceCertificateOrdersClient) RenewPreparer(resourceGroupName string, certificateOrderName string, renewCertificateOrderRequest RenewCertificateOrderRequest) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "certificateOrderName": autorest.Encode("path", certificateOrderName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName}/renew", pathParameters), + autorest.WithJSON(renewCertificateOrderRequest), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// RenewSender sends the Renew request. The method will close the +// http.Response Body if it receives an error. +func (client AppServiceCertificateOrdersClient) RenewSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// RenewResponder handles the response to the Renew request. The method always +// closes the http.Response Body. +func (client AppServiceCertificateOrdersClient) RenewResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// ResendEmail resend certificate email. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. certificateOrderName is name of the certificate order. +func (client AppServiceCertificateOrdersClient) ResendEmail(resourceGroupName string, certificateOrderName string) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppServiceCertificateOrdersClient", "ResendEmail") + } + + req, err := client.ResendEmailPreparer(resourceGroupName, certificateOrderName) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "ResendEmail", nil, "Failure preparing request") + } + + resp, err := client.ResendEmailSender(req) + if err != nil { + result.Response = resp + return result, autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "ResendEmail", resp, "Failure sending request") + } + + result, err = client.ResendEmailResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "ResendEmail", resp, "Failure responding to request") + } + + return +} + +// ResendEmailPreparer prepares the ResendEmail request. +func (client AppServiceCertificateOrdersClient) ResendEmailPreparer(resourceGroupName string, certificateOrderName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "certificateOrderName": autorest.Encode("path", certificateOrderName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-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.CertificateRegistration/certificateOrders/{certificateOrderName}/resendEmail", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ResendEmailSender sends the ResendEmail request. The method will close the +// http.Response Body if it receives an error. +func (client AppServiceCertificateOrdersClient) ResendEmailSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ResendEmailResponder handles the response to the ResendEmail request. The method always +// closes the http.Response Body. +func (client AppServiceCertificateOrdersClient) ResendEmailResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// ResendRequestEmails verify domain ownership for this certificate order. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. certificateOrderName is name of the certificate order. +// nameIdentifier is email address +func (client AppServiceCertificateOrdersClient) ResendRequestEmails(resourceGroupName string, certificateOrderName string, nameIdentifier NameIdentifier) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppServiceCertificateOrdersClient", "ResendRequestEmails") + } + + req, err := client.ResendRequestEmailsPreparer(resourceGroupName, certificateOrderName, nameIdentifier) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "ResendRequestEmails", nil, "Failure preparing request") + } + + resp, err := client.ResendRequestEmailsSender(req) + if err != nil { + result.Response = resp + return result, autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "ResendRequestEmails", resp, "Failure sending request") + } + + result, err = client.ResendRequestEmailsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "ResendRequestEmails", resp, "Failure responding to request") + } + + return +} + +// ResendRequestEmailsPreparer prepares the ResendRequestEmails request. +func (client AppServiceCertificateOrdersClient) ResendRequestEmailsPreparer(resourceGroupName string, certificateOrderName string, nameIdentifier NameIdentifier) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "certificateOrderName": autorest.Encode("path", certificateOrderName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName}/resendRequestEmails", pathParameters), + autorest.WithJSON(nameIdentifier), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ResendRequestEmailsSender sends the ResendRequestEmails request. The method will close the +// http.Response Body if it receives an error. +func (client AppServiceCertificateOrdersClient) ResendRequestEmailsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ResendRequestEmailsResponder handles the response to the ResendRequestEmails request. The method always +// closes the http.Response Body. +func (client AppServiceCertificateOrdersClient) ResendRequestEmailsResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// RetrieveCertificateActions retrieve the list of certificate actions. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the certificate order. +func (client AppServiceCertificateOrdersClient) RetrieveCertificateActions(resourceGroupName string, name string) (result ListCertificateOrderAction, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppServiceCertificateOrdersClient", "RetrieveCertificateActions") + } + + req, err := client.RetrieveCertificateActionsPreparer(resourceGroupName, name) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "RetrieveCertificateActions", nil, "Failure preparing request") + } + + resp, err := client.RetrieveCertificateActionsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "RetrieveCertificateActions", resp, "Failure sending request") + } + + result, err = client.RetrieveCertificateActionsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "RetrieveCertificateActions", resp, "Failure responding to request") + } + + return +} + +// RetrieveCertificateActionsPreparer prepares the RetrieveCertificateActions request. +func (client AppServiceCertificateOrdersClient) RetrieveCertificateActionsPreparer(resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-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.CertificateRegistration/certificateOrders/{name}/retrieveCertificateActions", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// RetrieveCertificateActionsSender sends the RetrieveCertificateActions request. The method will close the +// http.Response Body if it receives an error. +func (client AppServiceCertificateOrdersClient) RetrieveCertificateActionsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// RetrieveCertificateActionsResponder handles the response to the RetrieveCertificateActions request. The method always +// closes the http.Response Body. +func (client AppServiceCertificateOrdersClient) RetrieveCertificateActionsResponder(resp *http.Response) (result ListCertificateOrderAction, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// RetrieveCertificateEmailHistory retrieve email history. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the certificate order. +func (client AppServiceCertificateOrdersClient) RetrieveCertificateEmailHistory(resourceGroupName string, name string) (result ListCertificateEmail, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppServiceCertificateOrdersClient", "RetrieveCertificateEmailHistory") + } + + req, err := client.RetrieveCertificateEmailHistoryPreparer(resourceGroupName, name) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "RetrieveCertificateEmailHistory", nil, "Failure preparing request") + } + + resp, err := client.RetrieveCertificateEmailHistorySender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "RetrieveCertificateEmailHistory", resp, "Failure sending request") + } + + result, err = client.RetrieveCertificateEmailHistoryResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "RetrieveCertificateEmailHistory", resp, "Failure responding to request") + } + + return +} + +// RetrieveCertificateEmailHistoryPreparer prepares the RetrieveCertificateEmailHistory request. +func (client AppServiceCertificateOrdersClient) RetrieveCertificateEmailHistoryPreparer(resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-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.CertificateRegistration/certificateOrders/{name}/retrieveEmailHistory", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// RetrieveCertificateEmailHistorySender sends the RetrieveCertificateEmailHistory request. The method will close the +// http.Response Body if it receives an error. +func (client AppServiceCertificateOrdersClient) RetrieveCertificateEmailHistorySender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// RetrieveCertificateEmailHistoryResponder handles the response to the RetrieveCertificateEmailHistory request. The method always +// closes the http.Response Body. +func (client AppServiceCertificateOrdersClient) RetrieveCertificateEmailHistoryResponder(resp *http.Response) (result ListCertificateEmail, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// RetrieveSiteSeal verify domain ownership for this certificate order. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. certificateOrderName is name of the certificate order. +// siteSealRequest is site seal request. +func (client AppServiceCertificateOrdersClient) RetrieveSiteSeal(resourceGroupName string, certificateOrderName string, siteSealRequest SiteSealRequest) (result SiteSeal, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppServiceCertificateOrdersClient", "RetrieveSiteSeal") + } + + req, err := client.RetrieveSiteSealPreparer(resourceGroupName, certificateOrderName, siteSealRequest) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "RetrieveSiteSeal", nil, "Failure preparing request") + } + + resp, err := client.RetrieveSiteSealSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "RetrieveSiteSeal", resp, "Failure sending request") + } + + result, err = client.RetrieveSiteSealResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "RetrieveSiteSeal", resp, "Failure responding to request") + } + + return +} + +// RetrieveSiteSealPreparer prepares the RetrieveSiteSeal request. +func (client AppServiceCertificateOrdersClient) RetrieveSiteSealPreparer(resourceGroupName string, certificateOrderName string, siteSealRequest SiteSealRequest) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "certificateOrderName": autorest.Encode("path", certificateOrderName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName}/retrieveSiteSeal", pathParameters), + autorest.WithJSON(siteSealRequest), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// RetrieveSiteSealSender sends the RetrieveSiteSeal request. The method will close the +// http.Response Body if it receives an error. +func (client AppServiceCertificateOrdersClient) RetrieveSiteSealSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// RetrieveSiteSealResponder handles the response to the RetrieveSiteSeal request. The method always +// closes the http.Response Body. +func (client AppServiceCertificateOrdersClient) RetrieveSiteSealResponder(resp *http.Response) (result SiteSeal, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ValidatePurchaseInformation validate information for a certificate order. +// +// appServiceCertificateOrder is information for a certificate order. +func (client AppServiceCertificateOrdersClient) ValidatePurchaseInformation(appServiceCertificateOrder AppServiceCertificateOrder) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: appServiceCertificateOrder, + Constraints: []validation.Constraint{{Target: "appServiceCertificateOrder.AppServiceCertificateOrderProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "appServiceCertificateOrder.AppServiceCertificateOrderProperties.ValidityInYears", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "appServiceCertificateOrder.AppServiceCertificateOrderProperties.ValidityInYears", Name: validation.InclusiveMaximum, Rule: 3, Chain: nil}, + {Target: "appServiceCertificateOrder.AppServiceCertificateOrderProperties.ValidityInYears", Name: validation.InclusiveMinimum, Rule: 1, Chain: nil}, + }}, + }}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppServiceCertificateOrdersClient", "ValidatePurchaseInformation") + } + + req, err := client.ValidatePurchaseInformationPreparer(appServiceCertificateOrder) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "ValidatePurchaseInformation", nil, "Failure preparing request") + } + + resp, err := client.ValidatePurchaseInformationSender(req) + if err != nil { + result.Response = resp + return result, autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "ValidatePurchaseInformation", resp, "Failure sending request") + } + + result, err = client.ValidatePurchaseInformationResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "ValidatePurchaseInformation", resp, "Failure responding to request") + } + + return +} + +// ValidatePurchaseInformationPreparer prepares the ValidatePurchaseInformation request. +func (client AppServiceCertificateOrdersClient) ValidatePurchaseInformationPreparer(appServiceCertificateOrder AppServiceCertificateOrder) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.CertificateRegistration/validateCertificateRegistrationInformation", pathParameters), + autorest.WithJSON(appServiceCertificateOrder), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ValidatePurchaseInformationSender sends the ValidatePurchaseInformation request. The method will close the +// http.Response Body if it receives an error. +func (client AppServiceCertificateOrdersClient) ValidatePurchaseInformationSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ValidatePurchaseInformationResponder handles the response to the ValidatePurchaseInformation request. The method always +// closes the http.Response Body. +func (client AppServiceCertificateOrdersClient) ValidatePurchaseInformationResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// VerifyDomainOwnership verify domain ownership for this certificate order. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. certificateOrderName is name of the certificate order. +func (client AppServiceCertificateOrdersClient) VerifyDomainOwnership(resourceGroupName string, certificateOrderName string) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppServiceCertificateOrdersClient", "VerifyDomainOwnership") + } + + req, err := client.VerifyDomainOwnershipPreparer(resourceGroupName, certificateOrderName) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "VerifyDomainOwnership", nil, "Failure preparing request") + } + + resp, err := client.VerifyDomainOwnershipSender(req) + if err != nil { + result.Response = resp + return result, autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "VerifyDomainOwnership", resp, "Failure sending request") + } + + result, err = client.VerifyDomainOwnershipResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "VerifyDomainOwnership", resp, "Failure responding to request") + } + + return +} + +// VerifyDomainOwnershipPreparer prepares the VerifyDomainOwnership request. +func (client AppServiceCertificateOrdersClient) VerifyDomainOwnershipPreparer(resourceGroupName string, certificateOrderName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "certificateOrderName": autorest.Encode("path", certificateOrderName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-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.CertificateRegistration/certificateOrders/{certificateOrderName}/verifyDomainOwnership", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// VerifyDomainOwnershipSender sends the VerifyDomainOwnership request. The method will close the +// http.Response Body if it receives an error. +func (client AppServiceCertificateOrdersClient) VerifyDomainOwnershipSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// VerifyDomainOwnershipResponder handles the response to the VerifyDomainOwnership request. The method always +// closes the http.Response Body. +func (client AppServiceCertificateOrdersClient) VerifyDomainOwnershipResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} diff --git a/arm/web/appserviceenvironments.go b/arm/web/appserviceenvironments.go new file mode 100755 index 000000000000..b9b6ec03b786 --- /dev/null +++ b/arm/web/appserviceenvironments.go @@ -0,0 +1,3328 @@ +package web + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// 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/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// AppServiceEnvironmentsClient is the composite Swagger for WebSite Management +// Client +type AppServiceEnvironmentsClient struct { + ManagementClient +} + +// NewAppServiceEnvironmentsClient creates an instance of the +// AppServiceEnvironmentsClient client. +func NewAppServiceEnvironmentsClient(subscriptionID string) AppServiceEnvironmentsClient { + return NewAppServiceEnvironmentsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewAppServiceEnvironmentsClientWithBaseURI creates an instance of the +// AppServiceEnvironmentsClient client. +func NewAppServiceEnvironmentsClientWithBaseURI(baseURI string, subscriptionID string) AppServiceEnvironmentsClient { + return AppServiceEnvironmentsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate create or update an App Service Environment. This method may +// poll for completion. Polling can be canceled by passing the cancel channel +// argument. The channel will be used to cancel polling and any outstanding +// HTTP requests. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the App Service Environment. +// hostingEnvironmentEnvelope is configuration details of the App Service +// Environment. +func (client AppServiceEnvironmentsClient) CreateOrUpdate(resourceGroupName string, name string, hostingEnvironmentEnvelope AppServiceEnvironmentResource, cancel <-chan struct{}) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}, + {TargetValue: hostingEnvironmentEnvelope, + Constraints: []validation.Constraint{{Target: "hostingEnvironmentEnvelope.AppServiceEnvironment", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "hostingEnvironmentEnvelope.AppServiceEnvironment.Name", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "hostingEnvironmentEnvelope.AppServiceEnvironment.Location", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "hostingEnvironmentEnvelope.AppServiceEnvironment.VirtualNetwork", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "hostingEnvironmentEnvelope.AppServiceEnvironment.WorkerPools", Name: validation.Null, Rule: true, Chain: nil}, + }}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppServiceEnvironmentsClient", "CreateOrUpdate") + } + + req, err := client.CreateOrUpdatePreparer(resourceGroupName, name, hostingEnvironmentEnvelope, cancel) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "CreateOrUpdate", nil, "Failure preparing request") + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = resp + return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "CreateOrUpdate", resp, "Failure sending request") + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "CreateOrUpdate", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client AppServiceEnvironmentsClient) CreateOrUpdatePreparer(resourceGroupName string, name string, hostingEnvironmentEnvelope AppServiceEnvironmentResource, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}", pathParameters), + autorest.WithJSON(hostingEnvironmentEnvelope), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client AppServiceEnvironmentsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client AppServiceEnvironmentsClient) CreateOrUpdateResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusBadRequest, http.StatusNotFound, http.StatusConflict), + autorest.ByClosing()) + result.Response = resp + return +} + +// CreateOrUpdateMultiRolePool create or update a multi-role pool. This method +// may poll for completion. Polling can be canceled by passing the cancel +// channel argument. The channel will be used to cancel polling and any +// outstanding HTTP requests. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the App Service Environment. multiRolePoolEnvelope +// is properties of the multi-role pool. +func (client AppServiceEnvironmentsClient) CreateOrUpdateMultiRolePool(resourceGroupName string, name string, multiRolePoolEnvelope WorkerPoolResource, cancel <-chan struct{}) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppServiceEnvironmentsClient", "CreateOrUpdateMultiRolePool") + } + + req, err := client.CreateOrUpdateMultiRolePoolPreparer(resourceGroupName, name, multiRolePoolEnvelope, cancel) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "CreateOrUpdateMultiRolePool", nil, "Failure preparing request") + } + + resp, err := client.CreateOrUpdateMultiRolePoolSender(req) + if err != nil { + result.Response = resp + return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "CreateOrUpdateMultiRolePool", resp, "Failure sending request") + } + + result, err = client.CreateOrUpdateMultiRolePoolResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "CreateOrUpdateMultiRolePool", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdateMultiRolePoolPreparer prepares the CreateOrUpdateMultiRolePool request. +func (client AppServiceEnvironmentsClient) CreateOrUpdateMultiRolePoolPreparer(resourceGroupName string, name string, multiRolePoolEnvelope WorkerPoolResource, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/multiRolePools/default", pathParameters), + autorest.WithJSON(multiRolePoolEnvelope), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// CreateOrUpdateMultiRolePoolSender sends the CreateOrUpdateMultiRolePool request. The method will close the +// http.Response Body if it receives an error. +func (client AppServiceEnvironmentsClient) CreateOrUpdateMultiRolePoolSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// CreateOrUpdateMultiRolePoolResponder handles the response to the CreateOrUpdateMultiRolePool request. The method always +// closes the http.Response Body. +func (client AppServiceEnvironmentsClient) CreateOrUpdateMultiRolePoolResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusBadRequest, http.StatusNotFound, http.StatusConflict), + autorest.ByClosing()) + result.Response = resp + return +} + +// CreateOrUpdateWorkerPool create or update a worker pool. This method may +// poll for completion. Polling can be canceled by passing the cancel channel +// argument. The channel will be used to cancel polling and any outstanding +// HTTP requests. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the App Service Environment. workerPoolName is name +// of the worker pool. workerPoolEnvelope is properties of the worker pool. +func (client AppServiceEnvironmentsClient) CreateOrUpdateWorkerPool(resourceGroupName string, name string, workerPoolName string, workerPoolEnvelope WorkerPoolResource, cancel <-chan struct{}) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppServiceEnvironmentsClient", "CreateOrUpdateWorkerPool") + } + + req, err := client.CreateOrUpdateWorkerPoolPreparer(resourceGroupName, name, workerPoolName, workerPoolEnvelope, cancel) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "CreateOrUpdateWorkerPool", nil, "Failure preparing request") + } + + resp, err := client.CreateOrUpdateWorkerPoolSender(req) + if err != nil { + result.Response = resp + return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "CreateOrUpdateWorkerPool", resp, "Failure sending request") + } + + result, err = client.CreateOrUpdateWorkerPoolResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "CreateOrUpdateWorkerPool", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdateWorkerPoolPreparer prepares the CreateOrUpdateWorkerPool request. +func (client AppServiceEnvironmentsClient) CreateOrUpdateWorkerPoolPreparer(resourceGroupName string, name string, workerPoolName string, workerPoolEnvelope WorkerPoolResource, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workerPoolName": autorest.Encode("path", workerPoolName), + } + + const APIVersion = "2016-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/workerPools/{workerPoolName}", pathParameters), + autorest.WithJSON(workerPoolEnvelope), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// CreateOrUpdateWorkerPoolSender sends the CreateOrUpdateWorkerPool request. The method will close the +// http.Response Body if it receives an error. +func (client AppServiceEnvironmentsClient) CreateOrUpdateWorkerPoolSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// CreateOrUpdateWorkerPoolResponder handles the response to the CreateOrUpdateWorkerPool request. The method always +// closes the http.Response Body. +func (client AppServiceEnvironmentsClient) CreateOrUpdateWorkerPoolResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusBadRequest, http.StatusNotFound, http.StatusConflict), + autorest.ByClosing()) + result.Response = resp + return +} + +// Delete delete an App Service Environment. This method may poll for +// completion. Polling can be canceled by passing the cancel channel argument. +// The channel will be used to cancel polling and any outstanding HTTP +// requests. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the App Service Environment. forceDelete is specify +// true to force the deletion even if the App Service Environment +// contains resources. The default is false. +func (client AppServiceEnvironmentsClient) Delete(resourceGroupName string, name string, forceDelete *bool, cancel <-chan struct{}) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppServiceEnvironmentsClient", "Delete") + } + + req, err := client.DeletePreparer(resourceGroupName, name, forceDelete, cancel) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "Delete", nil, "Failure preparing request") + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "Delete", resp, "Failure sending request") + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client AppServiceEnvironmentsClient) DeletePreparer(resourceGroupName string, name string, forceDelete *bool, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if forceDelete != nil { + queryParameters["forceDelete"] = autorest.Encode("query", *forceDelete) + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client AppServiceEnvironmentsClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client AppServiceEnvironmentsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent, http.StatusBadRequest, http.StatusNotFound, http.StatusConflict), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get get the properties of an App Service Environment. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the App Service Environment. +func (client AppServiceEnvironmentsClient) Get(resourceGroupName string, name string) (result AppServiceEnvironmentResource, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppServiceEnvironmentsClient", "Get") + } + + req, err := client.GetPreparer(resourceGroupName, name) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "Get", nil, "Failure preparing request") + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "Get", resp, "Failure sending request") + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client AppServiceEnvironmentsClient) GetPreparer(resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-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.Web/hostingEnvironments/{name}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client AppServiceEnvironmentsClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client AppServiceEnvironmentsClient) GetResponder(resp *http.Response) (result AppServiceEnvironmentResource, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetDiagnosticsItem get a diagnostics item for an App Service Environment. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the App Service Environment. diagnosticsName is +// name of the diagnostics item. +func (client AppServiceEnvironmentsClient) GetDiagnosticsItem(resourceGroupName string, name string, diagnosticsName string) (result HostingEnvironmentDiagnostics, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppServiceEnvironmentsClient", "GetDiagnosticsItem") + } + + req, err := client.GetDiagnosticsItemPreparer(resourceGroupName, name, diagnosticsName) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "GetDiagnosticsItem", nil, "Failure preparing request") + } + + resp, err := client.GetDiagnosticsItemSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "GetDiagnosticsItem", resp, "Failure sending request") + } + + result, err = client.GetDiagnosticsItemResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "GetDiagnosticsItem", resp, "Failure responding to request") + } + + return +} + +// GetDiagnosticsItemPreparer prepares the GetDiagnosticsItem request. +func (client AppServiceEnvironmentsClient) GetDiagnosticsItemPreparer(resourceGroupName string, name string, diagnosticsName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "diagnosticsName": autorest.Encode("path", diagnosticsName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-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.Web/hostingEnvironments/{name}/diagnostics/{diagnosticsName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetDiagnosticsItemSender sends the GetDiagnosticsItem request. The method will close the +// http.Response Body if it receives an error. +func (client AppServiceEnvironmentsClient) GetDiagnosticsItemSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetDiagnosticsItemResponder handles the response to the GetDiagnosticsItem request. The method always +// closes the http.Response Body. +func (client AppServiceEnvironmentsClient) GetDiagnosticsItemResponder(resp *http.Response) (result HostingEnvironmentDiagnostics, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetMultiRolePool get properties of a multi-role pool. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the App Service Environment. +func (client AppServiceEnvironmentsClient) GetMultiRolePool(resourceGroupName string, name string) (result WorkerPoolResource, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppServiceEnvironmentsClient", "GetMultiRolePool") + } + + req, err := client.GetMultiRolePoolPreparer(resourceGroupName, name) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "GetMultiRolePool", nil, "Failure preparing request") + } + + resp, err := client.GetMultiRolePoolSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "GetMultiRolePool", resp, "Failure sending request") + } + + result, err = client.GetMultiRolePoolResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "GetMultiRolePool", resp, "Failure responding to request") + } + + return +} + +// GetMultiRolePoolPreparer prepares the GetMultiRolePool request. +func (client AppServiceEnvironmentsClient) GetMultiRolePoolPreparer(resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-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.Web/hostingEnvironments/{name}/multiRolePools/default", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetMultiRolePoolSender sends the GetMultiRolePool request. The method will close the +// http.Response Body if it receives an error. +func (client AppServiceEnvironmentsClient) GetMultiRolePoolSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetMultiRolePoolResponder handles the response to the GetMultiRolePool request. The method always +// closes the http.Response Body. +func (client AppServiceEnvironmentsClient) GetMultiRolePoolResponder(resp *http.Response) (result WorkerPoolResource, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetWorkerPool get properties of a worker pool. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the App Service Environment. workerPoolName is name +// of the worker pool. +func (client AppServiceEnvironmentsClient) GetWorkerPool(resourceGroupName string, name string, workerPoolName string) (result WorkerPoolResource, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppServiceEnvironmentsClient", "GetWorkerPool") + } + + req, err := client.GetWorkerPoolPreparer(resourceGroupName, name, workerPoolName) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "GetWorkerPool", nil, "Failure preparing request") + } + + resp, err := client.GetWorkerPoolSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "GetWorkerPool", resp, "Failure sending request") + } + + result, err = client.GetWorkerPoolResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "GetWorkerPool", resp, "Failure responding to request") + } + + return +} + +// GetWorkerPoolPreparer prepares the GetWorkerPool request. +func (client AppServiceEnvironmentsClient) GetWorkerPoolPreparer(resourceGroupName string, name string, workerPoolName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workerPoolName": autorest.Encode("path", workerPoolName), + } + + const APIVersion = "2016-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.Web/hostingEnvironments/{name}/workerPools/{workerPoolName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetWorkerPoolSender sends the GetWorkerPool request. The method will close the +// http.Response Body if it receives an error. +func (client AppServiceEnvironmentsClient) GetWorkerPoolSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetWorkerPoolResponder handles the response to the GetWorkerPool request. The method always +// closes the http.Response Body. +func (client AppServiceEnvironmentsClient) GetWorkerPoolResponder(resp *http.Response) (result WorkerPoolResource, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List get all App Service Environments for a subscription. +func (client AppServiceEnvironmentsClient) List() (result AppServiceEnvironmentCollection, err error) { + req, err := client.ListPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "List", nil, "Failure preparing request") + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "List", resp, "Failure sending request") + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client AppServiceEnvironmentsClient) ListPreparer() (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Web/hostingEnvironments", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client AppServiceEnvironmentsClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client AppServiceEnvironmentsClient) ListResponder(resp *http.Response) (result AppServiceEnvironmentCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + 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 AppServiceEnvironmentsClient) ListNextResults(lastResults AppServiceEnvironmentCollection) (result AppServiceEnvironmentCollection, err error) { + req, err := lastResults.AppServiceEnvironmentCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "List", 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, "web.AppServiceEnvironmentsClient", "List", resp, "Failure sending next results request") + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "List", resp, "Failure responding to next results request") + } + + return +} + +// ListAppServicePlans get all App Service plans in an App Service Environment. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the App Service Environment. +func (client AppServiceEnvironmentsClient) ListAppServicePlans(resourceGroupName string, name string) (result AppServicePlanCollection, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppServiceEnvironmentsClient", "ListAppServicePlans") + } + + req, err := client.ListAppServicePlansPreparer(resourceGroupName, name) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListAppServicePlans", nil, "Failure preparing request") + } + + resp, err := client.ListAppServicePlansSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListAppServicePlans", resp, "Failure sending request") + } + + result, err = client.ListAppServicePlansResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListAppServicePlans", resp, "Failure responding to request") + } + + return +} + +// ListAppServicePlansPreparer prepares the ListAppServicePlans request. +func (client AppServiceEnvironmentsClient) ListAppServicePlansPreparer(resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-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.Web/hostingEnvironments/{name}/serverfarms", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListAppServicePlansSender sends the ListAppServicePlans request. The method will close the +// http.Response Body if it receives an error. +func (client AppServiceEnvironmentsClient) ListAppServicePlansSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListAppServicePlansResponder handles the response to the ListAppServicePlans request. The method always +// closes the http.Response Body. +func (client AppServiceEnvironmentsClient) ListAppServicePlansResponder(resp *http.Response) (result AppServicePlanCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListAppServicePlansNextResults retrieves the next set of results, if any. +func (client AppServiceEnvironmentsClient) ListAppServicePlansNextResults(lastResults AppServicePlanCollection) (result AppServicePlanCollection, err error) { + req, err := lastResults.AppServicePlanCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListAppServicePlans", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListAppServicePlansSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListAppServicePlans", resp, "Failure sending next results request") + } + + result, err = client.ListAppServicePlansResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListAppServicePlans", resp, "Failure responding to next results request") + } + + return +} + +// ListByResourceGroup get all App Service Environments in a resource group. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. +func (client AppServiceEnvironmentsClient) ListByResourceGroup(resourceGroupName string) (result AppServiceEnvironmentCollection, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppServiceEnvironmentsClient", "ListByResourceGroup") + } + + req, err := client.ListByResourceGroupPreparer(resourceGroupName) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListByResourceGroup", nil, "Failure preparing request") + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListByResourceGroup", resp, "Failure sending request") + } + + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListByResourceGroup", resp, "Failure responding to request") + } + + return +} + +// ListByResourceGroupPreparer prepares the ListByResourceGroup request. +func (client AppServiceEnvironmentsClient) ListByResourceGroupPreparer(resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-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.Web/hostingEnvironments", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the +// http.Response Body if it receives an error. +func (client AppServiceEnvironmentsClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (client AppServiceEnvironmentsClient) ListByResourceGroupResponder(resp *http.Response) (result AppServiceEnvironmentCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + 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 AppServiceEnvironmentsClient) ListByResourceGroupNextResults(lastResults AppServiceEnvironmentCollection) (result AppServiceEnvironmentCollection, err error) { + req, err := lastResults.AppServiceEnvironmentCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListByResourceGroup", 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, "web.AppServiceEnvironmentsClient", "ListByResourceGroup", resp, "Failure sending next results request") + } + + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListByResourceGroup", resp, "Failure responding to next results request") + } + + return +} + +// ListCapacities get the used, available, and total worker capacity an App +// Service Environment. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the App Service Environment. +func (client AppServiceEnvironmentsClient) ListCapacities(resourceGroupName string, name string) (result StampCapacityCollection, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppServiceEnvironmentsClient", "ListCapacities") + } + + req, err := client.ListCapacitiesPreparer(resourceGroupName, name) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListCapacities", nil, "Failure preparing request") + } + + resp, err := client.ListCapacitiesSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListCapacities", resp, "Failure sending request") + } + + result, err = client.ListCapacitiesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListCapacities", resp, "Failure responding to request") + } + + return +} + +// ListCapacitiesPreparer prepares the ListCapacities request. +func (client AppServiceEnvironmentsClient) ListCapacitiesPreparer(resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-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.Web/hostingEnvironments/{name}/capacities/compute", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListCapacitiesSender sends the ListCapacities request. The method will close the +// http.Response Body if it receives an error. +func (client AppServiceEnvironmentsClient) ListCapacitiesSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListCapacitiesResponder handles the response to the ListCapacities request. The method always +// closes the http.Response Body. +func (client AppServiceEnvironmentsClient) ListCapacitiesResponder(resp *http.Response) (result StampCapacityCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListCapacitiesNextResults retrieves the next set of results, if any. +func (client AppServiceEnvironmentsClient) ListCapacitiesNextResults(lastResults StampCapacityCollection) (result StampCapacityCollection, err error) { + req, err := lastResults.StampCapacityCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListCapacities", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListCapacitiesSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListCapacities", resp, "Failure sending next results request") + } + + result, err = client.ListCapacitiesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListCapacities", resp, "Failure responding to next results request") + } + + return +} + +// ListDiagnostics get diagnostic information for an App Service Environment. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the App Service Environment. +func (client AppServiceEnvironmentsClient) ListDiagnostics(resourceGroupName string, name string) (result ListHostingEnvironmentDiagnostics, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppServiceEnvironmentsClient", "ListDiagnostics") + } + + req, err := client.ListDiagnosticsPreparer(resourceGroupName, name) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListDiagnostics", nil, "Failure preparing request") + } + + resp, err := client.ListDiagnosticsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListDiagnostics", resp, "Failure sending request") + } + + result, err = client.ListDiagnosticsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListDiagnostics", resp, "Failure responding to request") + } + + return +} + +// ListDiagnosticsPreparer prepares the ListDiagnostics request. +func (client AppServiceEnvironmentsClient) ListDiagnosticsPreparer(resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-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.Web/hostingEnvironments/{name}/diagnostics", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListDiagnosticsSender sends the ListDiagnostics request. The method will close the +// http.Response Body if it receives an error. +func (client AppServiceEnvironmentsClient) ListDiagnosticsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListDiagnosticsResponder handles the response to the ListDiagnostics request. The method always +// closes the http.Response Body. +func (client AppServiceEnvironmentsClient) ListDiagnosticsResponder(resp *http.Response) (result ListHostingEnvironmentDiagnostics, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListMetricDefinitions get global metric definitions of an App Service +// Environment. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the App Service Environment. +func (client AppServiceEnvironmentsClient) ListMetricDefinitions(resourceGroupName string, name string) (result MetricDefinition, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppServiceEnvironmentsClient", "ListMetricDefinitions") + } + + req, err := client.ListMetricDefinitionsPreparer(resourceGroupName, name) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListMetricDefinitions", nil, "Failure preparing request") + } + + resp, err := client.ListMetricDefinitionsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListMetricDefinitions", resp, "Failure sending request") + } + + result, err = client.ListMetricDefinitionsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListMetricDefinitions", resp, "Failure responding to request") + } + + return +} + +// ListMetricDefinitionsPreparer prepares the ListMetricDefinitions request. +func (client AppServiceEnvironmentsClient) ListMetricDefinitionsPreparer(resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-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.Web/hostingEnvironments/{name}/metricdefinitions", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListMetricDefinitionsSender sends the ListMetricDefinitions request. The method will close the +// http.Response Body if it receives an error. +func (client AppServiceEnvironmentsClient) ListMetricDefinitionsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListMetricDefinitionsResponder handles the response to the ListMetricDefinitions request. The method always +// closes the http.Response Body. +func (client AppServiceEnvironmentsClient) ListMetricDefinitionsResponder(resp *http.Response) (result MetricDefinition, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListMetrics get global metrics of an App Service Environment. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the App Service Environment. details is specify +// true to include instance details. The default is +// false. filter is return only usages/metrics specified in the +// filter. Filter conforms to odata syntax. Example: $filter=(name.value eq +// 'Metric1' or name.value eq 'Metric2') and startTime eq +// '2014-01-01T00:00:00Z' and endTime eq '2014-12-31T23:59:59Z' and timeGrain +// eq duration'[Hour|Minute|Day]'. +func (client AppServiceEnvironmentsClient) ListMetrics(resourceGroupName string, name string, details *bool, filter string) (result ResourceMetricCollection, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppServiceEnvironmentsClient", "ListMetrics") + } + + req, err := client.ListMetricsPreparer(resourceGroupName, name, details, filter) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListMetrics", nil, "Failure preparing request") + } + + resp, err := client.ListMetricsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListMetrics", resp, "Failure sending request") + } + + result, err = client.ListMetricsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListMetrics", resp, "Failure responding to request") + } + + return +} + +// ListMetricsPreparer prepares the ListMetrics request. +func (client AppServiceEnvironmentsClient) ListMetricsPreparer(resourceGroupName string, name string, details *bool, filter string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if details != nil { + queryParameters["details"] = autorest.Encode("query", *details) + } + if len(filter) > 0 { + queryParameters["$filter"] = filter + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/metrics", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListMetricsSender sends the ListMetrics request. The method will close the +// http.Response Body if it receives an error. +func (client AppServiceEnvironmentsClient) ListMetricsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListMetricsResponder handles the response to the ListMetrics request. The method always +// closes the http.Response Body. +func (client AppServiceEnvironmentsClient) ListMetricsResponder(resp *http.Response) (result ResourceMetricCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListMetricsNextResults retrieves the next set of results, if any. +func (client AppServiceEnvironmentsClient) ListMetricsNextResults(lastResults ResourceMetricCollection) (result ResourceMetricCollection, err error) { + req, err := lastResults.ResourceMetricCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListMetrics", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListMetricsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListMetrics", resp, "Failure sending next results request") + } + + result, err = client.ListMetricsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListMetrics", resp, "Failure responding to next results request") + } + + return +} + +// ListMultiRoleMetricDefinitions get metric definitions for a multi-role pool +// of an App Service Environment. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the App Service Environment. +func (client AppServiceEnvironmentsClient) ListMultiRoleMetricDefinitions(resourceGroupName string, name string) (result ResourceMetricDefinitionCollection, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppServiceEnvironmentsClient", "ListMultiRoleMetricDefinitions") + } + + req, err := client.ListMultiRoleMetricDefinitionsPreparer(resourceGroupName, name) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListMultiRoleMetricDefinitions", nil, "Failure preparing request") + } + + resp, err := client.ListMultiRoleMetricDefinitionsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListMultiRoleMetricDefinitions", resp, "Failure sending request") + } + + result, err = client.ListMultiRoleMetricDefinitionsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListMultiRoleMetricDefinitions", resp, "Failure responding to request") + } + + return +} + +// ListMultiRoleMetricDefinitionsPreparer prepares the ListMultiRoleMetricDefinitions request. +func (client AppServiceEnvironmentsClient) ListMultiRoleMetricDefinitionsPreparer(resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-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.Web/hostingEnvironments/{name}/multiRolePools/default/metricdefinitions", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListMultiRoleMetricDefinitionsSender sends the ListMultiRoleMetricDefinitions request. The method will close the +// http.Response Body if it receives an error. +func (client AppServiceEnvironmentsClient) ListMultiRoleMetricDefinitionsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListMultiRoleMetricDefinitionsResponder handles the response to the ListMultiRoleMetricDefinitions request. The method always +// closes the http.Response Body. +func (client AppServiceEnvironmentsClient) ListMultiRoleMetricDefinitionsResponder(resp *http.Response) (result ResourceMetricDefinitionCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListMultiRoleMetricDefinitionsNextResults retrieves the next set of results, if any. +func (client AppServiceEnvironmentsClient) ListMultiRoleMetricDefinitionsNextResults(lastResults ResourceMetricDefinitionCollection) (result ResourceMetricDefinitionCollection, err error) { + req, err := lastResults.ResourceMetricDefinitionCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListMultiRoleMetricDefinitions", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListMultiRoleMetricDefinitionsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListMultiRoleMetricDefinitions", resp, "Failure sending next results request") + } + + result, err = client.ListMultiRoleMetricDefinitionsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListMultiRoleMetricDefinitions", resp, "Failure responding to next results request") + } + + return +} + +// ListMultiRoleMetrics get metrics for a multi-role pool of an App Service +// Environment. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the App Service Environment. startTime is beginning +// time of the metrics query. endTime is end time of the metrics query. +// timeGrain is time granularity of the metrics query. details is specify +// true to include instance details. The default is +// false. filter is return only usages/metrics specified in the +// filter. Filter conforms to odata syntax. Example: $filter=(name.value eq +// 'Metric1' or name.value eq 'Metric2') and startTime eq +// '2014-01-01T00:00:00Z' and endTime eq '2014-12-31T23:59:59Z' and timeGrain +// eq duration'[Hour|Minute|Day]'. +func (client AppServiceEnvironmentsClient) ListMultiRoleMetrics(resourceGroupName string, name string, startTime string, endTime string, timeGrain string, details *bool, filter string) (result ResourceMetricCollection, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppServiceEnvironmentsClient", "ListMultiRoleMetrics") + } + + req, err := client.ListMultiRoleMetricsPreparer(resourceGroupName, name, startTime, endTime, timeGrain, details, filter) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListMultiRoleMetrics", nil, "Failure preparing request") + } + + resp, err := client.ListMultiRoleMetricsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListMultiRoleMetrics", resp, "Failure sending request") + } + + result, err = client.ListMultiRoleMetricsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListMultiRoleMetrics", resp, "Failure responding to request") + } + + return +} + +// ListMultiRoleMetricsPreparer prepares the ListMultiRoleMetrics request. +func (client AppServiceEnvironmentsClient) ListMultiRoleMetricsPreparer(resourceGroupName string, name string, startTime string, endTime string, timeGrain string, details *bool, filter string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(startTime) > 0 { + queryParameters["startTime"] = autorest.Encode("query", startTime) + } + if len(endTime) > 0 { + queryParameters["endTime"] = autorest.Encode("query", endTime) + } + if len(timeGrain) > 0 { + queryParameters["timeGrain"] = autorest.Encode("query", timeGrain) + } + if details != nil { + queryParameters["details"] = autorest.Encode("query", *details) + } + if len(filter) > 0 { + queryParameters["$filter"] = filter + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/multiRolePools/default/metrics", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListMultiRoleMetricsSender sends the ListMultiRoleMetrics request. The method will close the +// http.Response Body if it receives an error. +func (client AppServiceEnvironmentsClient) ListMultiRoleMetricsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListMultiRoleMetricsResponder handles the response to the ListMultiRoleMetrics request. The method always +// closes the http.Response Body. +func (client AppServiceEnvironmentsClient) ListMultiRoleMetricsResponder(resp *http.Response) (result ResourceMetricCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListMultiRoleMetricsNextResults retrieves the next set of results, if any. +func (client AppServiceEnvironmentsClient) ListMultiRoleMetricsNextResults(lastResults ResourceMetricCollection) (result ResourceMetricCollection, err error) { + req, err := lastResults.ResourceMetricCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListMultiRoleMetrics", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListMultiRoleMetricsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListMultiRoleMetrics", resp, "Failure sending next results request") + } + + result, err = client.ListMultiRoleMetricsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListMultiRoleMetrics", resp, "Failure responding to next results request") + } + + return +} + +// ListMultiRolePoolInstanceMetricDefinitions get metric definitions for a +// specific instance of a multi-role pool of an App Service Environment. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the App Service Environment. instance is name of +// the instance in the multi-role pool. +func (client AppServiceEnvironmentsClient) ListMultiRolePoolInstanceMetricDefinitions(resourceGroupName string, name string, instance string) (result ResourceMetricDefinitionCollection, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppServiceEnvironmentsClient", "ListMultiRolePoolInstanceMetricDefinitions") + } + + req, err := client.ListMultiRolePoolInstanceMetricDefinitionsPreparer(resourceGroupName, name, instance) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListMultiRolePoolInstanceMetricDefinitions", nil, "Failure preparing request") + } + + resp, err := client.ListMultiRolePoolInstanceMetricDefinitionsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListMultiRolePoolInstanceMetricDefinitions", resp, "Failure sending request") + } + + result, err = client.ListMultiRolePoolInstanceMetricDefinitionsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListMultiRolePoolInstanceMetricDefinitions", resp, "Failure responding to request") + } + + return +} + +// ListMultiRolePoolInstanceMetricDefinitionsPreparer prepares the ListMultiRolePoolInstanceMetricDefinitions request. +func (client AppServiceEnvironmentsClient) ListMultiRolePoolInstanceMetricDefinitionsPreparer(resourceGroupName string, name string, instance string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "instance": autorest.Encode("path", instance), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-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.Web/hostingEnvironments/{name}/multiRolePools/default/instances/{instance}/metricdefinitions", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListMultiRolePoolInstanceMetricDefinitionsSender sends the ListMultiRolePoolInstanceMetricDefinitions request. The method will close the +// http.Response Body if it receives an error. +func (client AppServiceEnvironmentsClient) ListMultiRolePoolInstanceMetricDefinitionsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListMultiRolePoolInstanceMetricDefinitionsResponder handles the response to the ListMultiRolePoolInstanceMetricDefinitions request. The method always +// closes the http.Response Body. +func (client AppServiceEnvironmentsClient) ListMultiRolePoolInstanceMetricDefinitionsResponder(resp *http.Response) (result ResourceMetricDefinitionCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListMultiRolePoolInstanceMetricDefinitionsNextResults retrieves the next set of results, if any. +func (client AppServiceEnvironmentsClient) ListMultiRolePoolInstanceMetricDefinitionsNextResults(lastResults ResourceMetricDefinitionCollection) (result ResourceMetricDefinitionCollection, err error) { + req, err := lastResults.ResourceMetricDefinitionCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListMultiRolePoolInstanceMetricDefinitions", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListMultiRolePoolInstanceMetricDefinitionsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListMultiRolePoolInstanceMetricDefinitions", resp, "Failure sending next results request") + } + + result, err = client.ListMultiRolePoolInstanceMetricDefinitionsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListMultiRolePoolInstanceMetricDefinitions", resp, "Failure responding to next results request") + } + + return +} + +// ListMultiRolePoolInstanceMetrics get metrics for a specific instance of a +// multi-role pool of an App Service Environment. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the App Service Environment. instance is name of +// the instance in the multi-role pool. details is specify true to +// include instance details. The default is false. +func (client AppServiceEnvironmentsClient) ListMultiRolePoolInstanceMetrics(resourceGroupName string, name string, instance string, details *bool) (result ResourceMetricCollection, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppServiceEnvironmentsClient", "ListMultiRolePoolInstanceMetrics") + } + + req, err := client.ListMultiRolePoolInstanceMetricsPreparer(resourceGroupName, name, instance, details) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListMultiRolePoolInstanceMetrics", nil, "Failure preparing request") + } + + resp, err := client.ListMultiRolePoolInstanceMetricsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListMultiRolePoolInstanceMetrics", resp, "Failure sending request") + } + + result, err = client.ListMultiRolePoolInstanceMetricsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListMultiRolePoolInstanceMetrics", resp, "Failure responding to request") + } + + return +} + +// ListMultiRolePoolInstanceMetricsPreparer prepares the ListMultiRolePoolInstanceMetrics request. +func (client AppServiceEnvironmentsClient) ListMultiRolePoolInstanceMetricsPreparer(resourceGroupName string, name string, instance string, details *bool) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "instance": autorest.Encode("path", instance), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if details != nil { + queryParameters["details"] = autorest.Encode("query", *details) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/multiRolePools/default/instances/{instance}metrics", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListMultiRolePoolInstanceMetricsSender sends the ListMultiRolePoolInstanceMetrics request. The method will close the +// http.Response Body if it receives an error. +func (client AppServiceEnvironmentsClient) ListMultiRolePoolInstanceMetricsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListMultiRolePoolInstanceMetricsResponder handles the response to the ListMultiRolePoolInstanceMetrics request. The method always +// closes the http.Response Body. +func (client AppServiceEnvironmentsClient) ListMultiRolePoolInstanceMetricsResponder(resp *http.Response) (result ResourceMetricCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListMultiRolePoolInstanceMetricsNextResults retrieves the next set of results, if any. +func (client AppServiceEnvironmentsClient) ListMultiRolePoolInstanceMetricsNextResults(lastResults ResourceMetricCollection) (result ResourceMetricCollection, err error) { + req, err := lastResults.ResourceMetricCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListMultiRolePoolInstanceMetrics", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListMultiRolePoolInstanceMetricsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListMultiRolePoolInstanceMetrics", resp, "Failure sending next results request") + } + + result, err = client.ListMultiRolePoolInstanceMetricsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListMultiRolePoolInstanceMetrics", resp, "Failure responding to next results request") + } + + return +} + +// ListMultiRolePools get all multi-role pools. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the App Service Environment. +func (client AppServiceEnvironmentsClient) ListMultiRolePools(resourceGroupName string, name string) (result WorkerPoolCollection, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppServiceEnvironmentsClient", "ListMultiRolePools") + } + + req, err := client.ListMultiRolePoolsPreparer(resourceGroupName, name) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListMultiRolePools", nil, "Failure preparing request") + } + + resp, err := client.ListMultiRolePoolsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListMultiRolePools", resp, "Failure sending request") + } + + result, err = client.ListMultiRolePoolsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListMultiRolePools", resp, "Failure responding to request") + } + + return +} + +// ListMultiRolePoolsPreparer prepares the ListMultiRolePools request. +func (client AppServiceEnvironmentsClient) ListMultiRolePoolsPreparer(resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-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.Web/hostingEnvironments/{name}/multiRolePools", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListMultiRolePoolsSender sends the ListMultiRolePools request. The method will close the +// http.Response Body if it receives an error. +func (client AppServiceEnvironmentsClient) ListMultiRolePoolsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListMultiRolePoolsResponder handles the response to the ListMultiRolePools request. The method always +// closes the http.Response Body. +func (client AppServiceEnvironmentsClient) ListMultiRolePoolsResponder(resp *http.Response) (result WorkerPoolCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListMultiRolePoolsNextResults retrieves the next set of results, if any. +func (client AppServiceEnvironmentsClient) ListMultiRolePoolsNextResults(lastResults WorkerPoolCollection) (result WorkerPoolCollection, err error) { + req, err := lastResults.WorkerPoolCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListMultiRolePools", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListMultiRolePoolsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListMultiRolePools", resp, "Failure sending next results request") + } + + result, err = client.ListMultiRolePoolsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListMultiRolePools", resp, "Failure responding to next results request") + } + + return +} + +// ListMultiRolePoolSkus get available SKUs for scaling a multi-role pool. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the App Service Environment. +func (client AppServiceEnvironmentsClient) ListMultiRolePoolSkus(resourceGroupName string, name string) (result SkuInfoCollection, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppServiceEnvironmentsClient", "ListMultiRolePoolSkus") + } + + req, err := client.ListMultiRolePoolSkusPreparer(resourceGroupName, name) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListMultiRolePoolSkus", nil, "Failure preparing request") + } + + resp, err := client.ListMultiRolePoolSkusSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListMultiRolePoolSkus", resp, "Failure sending request") + } + + result, err = client.ListMultiRolePoolSkusResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListMultiRolePoolSkus", resp, "Failure responding to request") + } + + return +} + +// ListMultiRolePoolSkusPreparer prepares the ListMultiRolePoolSkus request. +func (client AppServiceEnvironmentsClient) ListMultiRolePoolSkusPreparer(resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-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.Web/hostingEnvironments/{name}/multiRolePools/default/skus", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListMultiRolePoolSkusSender sends the ListMultiRolePoolSkus request. The method will close the +// http.Response Body if it receives an error. +func (client AppServiceEnvironmentsClient) ListMultiRolePoolSkusSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListMultiRolePoolSkusResponder handles the response to the ListMultiRolePoolSkus request. The method always +// closes the http.Response Body. +func (client AppServiceEnvironmentsClient) ListMultiRolePoolSkusResponder(resp *http.Response) (result SkuInfoCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListMultiRolePoolSkusNextResults retrieves the next set of results, if any. +func (client AppServiceEnvironmentsClient) ListMultiRolePoolSkusNextResults(lastResults SkuInfoCollection) (result SkuInfoCollection, err error) { + req, err := lastResults.SkuInfoCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListMultiRolePoolSkus", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListMultiRolePoolSkusSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListMultiRolePoolSkus", resp, "Failure sending next results request") + } + + result, err = client.ListMultiRolePoolSkusResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListMultiRolePoolSkus", resp, "Failure responding to next results request") + } + + return +} + +// ListMultiRoleUsages get usage metrics for a multi-role pool of an App +// Service Environment. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the App Service Environment. +func (client AppServiceEnvironmentsClient) ListMultiRoleUsages(resourceGroupName string, name string) (result UsageCollection, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppServiceEnvironmentsClient", "ListMultiRoleUsages") + } + + req, err := client.ListMultiRoleUsagesPreparer(resourceGroupName, name) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListMultiRoleUsages", nil, "Failure preparing request") + } + + resp, err := client.ListMultiRoleUsagesSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListMultiRoleUsages", resp, "Failure sending request") + } + + result, err = client.ListMultiRoleUsagesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListMultiRoleUsages", resp, "Failure responding to request") + } + + return +} + +// ListMultiRoleUsagesPreparer prepares the ListMultiRoleUsages request. +func (client AppServiceEnvironmentsClient) ListMultiRoleUsagesPreparer(resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-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.Web/hostingEnvironments/{name}/multiRolePools/default/usages", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListMultiRoleUsagesSender sends the ListMultiRoleUsages request. The method will close the +// http.Response Body if it receives an error. +func (client AppServiceEnvironmentsClient) ListMultiRoleUsagesSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListMultiRoleUsagesResponder handles the response to the ListMultiRoleUsages request. The method always +// closes the http.Response Body. +func (client AppServiceEnvironmentsClient) ListMultiRoleUsagesResponder(resp *http.Response) (result UsageCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListMultiRoleUsagesNextResults retrieves the next set of results, if any. +func (client AppServiceEnvironmentsClient) ListMultiRoleUsagesNextResults(lastResults UsageCollection) (result UsageCollection, err error) { + req, err := lastResults.UsageCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListMultiRoleUsages", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListMultiRoleUsagesSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListMultiRoleUsages", resp, "Failure sending next results request") + } + + result, err = client.ListMultiRoleUsagesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListMultiRoleUsages", resp, "Failure responding to next results request") + } + + return +} + +// ListOperations list all currently running operations on the App Service +// Environment. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the App Service Environment. +func (client AppServiceEnvironmentsClient) ListOperations(resourceGroupName string, name string) (result ListOperation, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppServiceEnvironmentsClient", "ListOperations") + } + + req, err := client.ListOperationsPreparer(resourceGroupName, name) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListOperations", nil, "Failure preparing request") + } + + resp, err := client.ListOperationsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListOperations", resp, "Failure sending request") + } + + result, err = client.ListOperationsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListOperations", resp, "Failure responding to request") + } + + return +} + +// ListOperationsPreparer prepares the ListOperations request. +func (client AppServiceEnvironmentsClient) ListOperationsPreparer(resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-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.Web/hostingEnvironments/{name}/operations", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListOperationsSender sends the ListOperations request. The method will close the +// http.Response Body if it receives an error. +func (client AppServiceEnvironmentsClient) ListOperationsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListOperationsResponder handles the response to the ListOperations request. The method always +// closes the http.Response Body. +func (client AppServiceEnvironmentsClient) ListOperationsResponder(resp *http.Response) (result ListOperation, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListUsages get global usage metrics of an App Service Environment. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the App Service Environment. filter is return only +// usages/metrics specified in the filter. Filter conforms to odata syntax. +// Example: $filter=(name.value eq 'Metric1' or name.value eq 'Metric2') and +// startTime eq '2014-01-01T00:00:00Z' and endTime eq '2014-12-31T23:59:59Z' +// and timeGrain eq duration'[Hour|Minute|Day]'. +func (client AppServiceEnvironmentsClient) ListUsages(resourceGroupName string, name string, filter string) (result CsmUsageQuotaCollection, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppServiceEnvironmentsClient", "ListUsages") + } + + req, err := client.ListUsagesPreparer(resourceGroupName, name, filter) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListUsages", nil, "Failure preparing request") + } + + resp, err := client.ListUsagesSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListUsages", resp, "Failure sending request") + } + + result, err = client.ListUsagesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListUsages", resp, "Failure responding to request") + } + + return +} + +// ListUsagesPreparer prepares the ListUsages request. +func (client AppServiceEnvironmentsClient) ListUsagesPreparer(resourceGroupName string, name string, filter string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(filter) > 0 { + queryParameters["$filter"] = filter + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/usages", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListUsagesSender sends the ListUsages request. The method will close the +// http.Response Body if it receives an error. +func (client AppServiceEnvironmentsClient) ListUsagesSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListUsagesResponder handles the response to the ListUsages request. The method always +// closes the http.Response Body. +func (client AppServiceEnvironmentsClient) ListUsagesResponder(resp *http.Response) (result CsmUsageQuotaCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListUsagesNextResults retrieves the next set of results, if any. +func (client AppServiceEnvironmentsClient) ListUsagesNextResults(lastResults CsmUsageQuotaCollection) (result CsmUsageQuotaCollection, err error) { + req, err := lastResults.CsmUsageQuotaCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListUsages", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListUsagesSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListUsages", resp, "Failure sending next results request") + } + + result, err = client.ListUsagesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListUsages", resp, "Failure responding to next results request") + } + + return +} + +// ListVips get IP addresses assigned to an App Service Environment. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the App Service Environment. +func (client AppServiceEnvironmentsClient) ListVips(resourceGroupName string, name string) (result AddressResponse, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppServiceEnvironmentsClient", "ListVips") + } + + req, err := client.ListVipsPreparer(resourceGroupName, name) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListVips", nil, "Failure preparing request") + } + + resp, err := client.ListVipsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListVips", resp, "Failure sending request") + } + + result, err = client.ListVipsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListVips", resp, "Failure responding to request") + } + + return +} + +// ListVipsPreparer prepares the ListVips request. +func (client AppServiceEnvironmentsClient) ListVipsPreparer(resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-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.Web/hostingEnvironments/{name}/capacities/virtualip", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListVipsSender sends the ListVips request. The method will close the +// http.Response Body if it receives an error. +func (client AppServiceEnvironmentsClient) ListVipsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListVipsResponder handles the response to the ListVips request. The method always +// closes the http.Response Body. +func (client AppServiceEnvironmentsClient) ListVipsResponder(resp *http.Response) (result AddressResponse, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListWebApps get all apps in an App Service Environment. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the App Service Environment. propertiesToInclude is +// comma separated list of app properties to include. +func (client AppServiceEnvironmentsClient) ListWebApps(resourceGroupName string, name string, propertiesToInclude string) (result AppCollection, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppServiceEnvironmentsClient", "ListWebApps") + } + + req, err := client.ListWebAppsPreparer(resourceGroupName, name, propertiesToInclude) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListWebApps", nil, "Failure preparing request") + } + + resp, err := client.ListWebAppsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListWebApps", resp, "Failure sending request") + } + + result, err = client.ListWebAppsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListWebApps", resp, "Failure responding to request") + } + + return +} + +// ListWebAppsPreparer prepares the ListWebApps request. +func (client AppServiceEnvironmentsClient) ListWebAppsPreparer(resourceGroupName string, name string, propertiesToInclude string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(propertiesToInclude) > 0 { + queryParameters["propertiesToInclude"] = autorest.Encode("query", propertiesToInclude) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/sites", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListWebAppsSender sends the ListWebApps request. The method will close the +// http.Response Body if it receives an error. +func (client AppServiceEnvironmentsClient) ListWebAppsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListWebAppsResponder handles the response to the ListWebApps request. The method always +// closes the http.Response Body. +func (client AppServiceEnvironmentsClient) ListWebAppsResponder(resp *http.Response) (result AppCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListWebAppsNextResults retrieves the next set of results, if any. +func (client AppServiceEnvironmentsClient) ListWebAppsNextResults(lastResults AppCollection) (result AppCollection, err error) { + req, err := lastResults.AppCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListWebApps", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListWebAppsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListWebApps", resp, "Failure sending next results request") + } + + result, err = client.ListWebAppsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListWebApps", resp, "Failure responding to next results request") + } + + return +} + +// ListWebWorkerMetricDefinitions get metric definitions for a worker pool of +// an App Service Environment. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the App Service Environment. workerPoolName is name +// of the worker pool. +func (client AppServiceEnvironmentsClient) ListWebWorkerMetricDefinitions(resourceGroupName string, name string, workerPoolName string) (result ResourceMetricDefinitionCollection, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppServiceEnvironmentsClient", "ListWebWorkerMetricDefinitions") + } + + req, err := client.ListWebWorkerMetricDefinitionsPreparer(resourceGroupName, name, workerPoolName) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListWebWorkerMetricDefinitions", nil, "Failure preparing request") + } + + resp, err := client.ListWebWorkerMetricDefinitionsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListWebWorkerMetricDefinitions", resp, "Failure sending request") + } + + result, err = client.ListWebWorkerMetricDefinitionsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListWebWorkerMetricDefinitions", resp, "Failure responding to request") + } + + return +} + +// ListWebWorkerMetricDefinitionsPreparer prepares the ListWebWorkerMetricDefinitions request. +func (client AppServiceEnvironmentsClient) ListWebWorkerMetricDefinitionsPreparer(resourceGroupName string, name string, workerPoolName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workerPoolName": autorest.Encode("path", workerPoolName), + } + + const APIVersion = "2016-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.Web/hostingEnvironments/{name}/workerPools/{workerPoolName}/metricdefinitions", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListWebWorkerMetricDefinitionsSender sends the ListWebWorkerMetricDefinitions request. The method will close the +// http.Response Body if it receives an error. +func (client AppServiceEnvironmentsClient) ListWebWorkerMetricDefinitionsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListWebWorkerMetricDefinitionsResponder handles the response to the ListWebWorkerMetricDefinitions request. The method always +// closes the http.Response Body. +func (client AppServiceEnvironmentsClient) ListWebWorkerMetricDefinitionsResponder(resp *http.Response) (result ResourceMetricDefinitionCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListWebWorkerMetricDefinitionsNextResults retrieves the next set of results, if any. +func (client AppServiceEnvironmentsClient) ListWebWorkerMetricDefinitionsNextResults(lastResults ResourceMetricDefinitionCollection) (result ResourceMetricDefinitionCollection, err error) { + req, err := lastResults.ResourceMetricDefinitionCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListWebWorkerMetricDefinitions", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListWebWorkerMetricDefinitionsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListWebWorkerMetricDefinitions", resp, "Failure sending next results request") + } + + result, err = client.ListWebWorkerMetricDefinitionsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListWebWorkerMetricDefinitions", resp, "Failure responding to next results request") + } + + return +} + +// ListWebWorkerMetrics get metrics for a worker pool of a +// AppServiceEnvironment (App Service Environment). +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the App Service Environment. workerPoolName is name +// of worker pool details is specify true to include instance +// details. The default is false. filter is return only +// usages/metrics specified in the filter. Filter conforms to odata syntax. +// Example: $filter=(name.value eq 'Metric1' or name.value eq 'Metric2') and +// startTime eq '2014-01-01T00:00:00Z' and endTime eq '2014-12-31T23:59:59Z' +// and timeGrain eq duration'[Hour|Minute|Day]'. +func (client AppServiceEnvironmentsClient) ListWebWorkerMetrics(resourceGroupName string, name string, workerPoolName string, details *bool, filter string) (result ResourceMetricCollection, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppServiceEnvironmentsClient", "ListWebWorkerMetrics") + } + + req, err := client.ListWebWorkerMetricsPreparer(resourceGroupName, name, workerPoolName, details, filter) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListWebWorkerMetrics", nil, "Failure preparing request") + } + + resp, err := client.ListWebWorkerMetricsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListWebWorkerMetrics", resp, "Failure sending request") + } + + result, err = client.ListWebWorkerMetricsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListWebWorkerMetrics", resp, "Failure responding to request") + } + + return +} + +// ListWebWorkerMetricsPreparer prepares the ListWebWorkerMetrics request. +func (client AppServiceEnvironmentsClient) ListWebWorkerMetricsPreparer(resourceGroupName string, name string, workerPoolName string, details *bool, filter string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workerPoolName": autorest.Encode("path", workerPoolName), + } + + const APIVersion = "2016-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if details != nil { + queryParameters["details"] = autorest.Encode("query", *details) + } + if len(filter) > 0 { + queryParameters["$filter"] = filter + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/workerPools/{workerPoolName}/metrics", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListWebWorkerMetricsSender sends the ListWebWorkerMetrics request. The method will close the +// http.Response Body if it receives an error. +func (client AppServiceEnvironmentsClient) ListWebWorkerMetricsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListWebWorkerMetricsResponder handles the response to the ListWebWorkerMetrics request. The method always +// closes the http.Response Body. +func (client AppServiceEnvironmentsClient) ListWebWorkerMetricsResponder(resp *http.Response) (result ResourceMetricCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListWebWorkerMetricsNextResults retrieves the next set of results, if any. +func (client AppServiceEnvironmentsClient) ListWebWorkerMetricsNextResults(lastResults ResourceMetricCollection) (result ResourceMetricCollection, err error) { + req, err := lastResults.ResourceMetricCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListWebWorkerMetrics", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListWebWorkerMetricsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListWebWorkerMetrics", resp, "Failure sending next results request") + } + + result, err = client.ListWebWorkerMetricsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListWebWorkerMetrics", resp, "Failure responding to next results request") + } + + return +} + +// ListWebWorkerUsages get usage metrics for a worker pool of an App Service +// Environment. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the App Service Environment. workerPoolName is name +// of the worker pool. +func (client AppServiceEnvironmentsClient) ListWebWorkerUsages(resourceGroupName string, name string, workerPoolName string) (result UsageCollection, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppServiceEnvironmentsClient", "ListWebWorkerUsages") + } + + req, err := client.ListWebWorkerUsagesPreparer(resourceGroupName, name, workerPoolName) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListWebWorkerUsages", nil, "Failure preparing request") + } + + resp, err := client.ListWebWorkerUsagesSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListWebWorkerUsages", resp, "Failure sending request") + } + + result, err = client.ListWebWorkerUsagesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListWebWorkerUsages", resp, "Failure responding to request") + } + + return +} + +// ListWebWorkerUsagesPreparer prepares the ListWebWorkerUsages request. +func (client AppServiceEnvironmentsClient) ListWebWorkerUsagesPreparer(resourceGroupName string, name string, workerPoolName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workerPoolName": autorest.Encode("path", workerPoolName), + } + + const APIVersion = "2016-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.Web/hostingEnvironments/{name}/workerPools/{workerPoolName}/usages", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListWebWorkerUsagesSender sends the ListWebWorkerUsages request. The method will close the +// http.Response Body if it receives an error. +func (client AppServiceEnvironmentsClient) ListWebWorkerUsagesSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListWebWorkerUsagesResponder handles the response to the ListWebWorkerUsages request. The method always +// closes the http.Response Body. +func (client AppServiceEnvironmentsClient) ListWebWorkerUsagesResponder(resp *http.Response) (result UsageCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListWebWorkerUsagesNextResults retrieves the next set of results, if any. +func (client AppServiceEnvironmentsClient) ListWebWorkerUsagesNextResults(lastResults UsageCollection) (result UsageCollection, err error) { + req, err := lastResults.UsageCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListWebWorkerUsages", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListWebWorkerUsagesSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListWebWorkerUsages", resp, "Failure sending next results request") + } + + result, err = client.ListWebWorkerUsagesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListWebWorkerUsages", resp, "Failure responding to next results request") + } + + return +} + +// ListWorkerPoolInstanceMetricDefinitions get metric definitions for a +// specific instance of a worker pool of an App Service Environment. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the App Service Environment. workerPoolName is name +// of the worker pool. instance is name of the instance in the worker pool. +func (client AppServiceEnvironmentsClient) ListWorkerPoolInstanceMetricDefinitions(resourceGroupName string, name string, workerPoolName string, instance string) (result ResourceMetricDefinitionCollection, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppServiceEnvironmentsClient", "ListWorkerPoolInstanceMetricDefinitions") + } + + req, err := client.ListWorkerPoolInstanceMetricDefinitionsPreparer(resourceGroupName, name, workerPoolName, instance) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListWorkerPoolInstanceMetricDefinitions", nil, "Failure preparing request") + } + + resp, err := client.ListWorkerPoolInstanceMetricDefinitionsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListWorkerPoolInstanceMetricDefinitions", resp, "Failure sending request") + } + + result, err = client.ListWorkerPoolInstanceMetricDefinitionsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListWorkerPoolInstanceMetricDefinitions", resp, "Failure responding to request") + } + + return +} + +// ListWorkerPoolInstanceMetricDefinitionsPreparer prepares the ListWorkerPoolInstanceMetricDefinitions request. +func (client AppServiceEnvironmentsClient) ListWorkerPoolInstanceMetricDefinitionsPreparer(resourceGroupName string, name string, workerPoolName string, instance string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "instance": autorest.Encode("path", instance), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workerPoolName": autorest.Encode("path", workerPoolName), + } + + const APIVersion = "2016-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.Web/hostingEnvironments/{name}/workerPools/{workerPoolName}/instances/{instance}/metricdefinitions", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListWorkerPoolInstanceMetricDefinitionsSender sends the ListWorkerPoolInstanceMetricDefinitions request. The method will close the +// http.Response Body if it receives an error. +func (client AppServiceEnvironmentsClient) ListWorkerPoolInstanceMetricDefinitionsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListWorkerPoolInstanceMetricDefinitionsResponder handles the response to the ListWorkerPoolInstanceMetricDefinitions request. The method always +// closes the http.Response Body. +func (client AppServiceEnvironmentsClient) ListWorkerPoolInstanceMetricDefinitionsResponder(resp *http.Response) (result ResourceMetricDefinitionCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListWorkerPoolInstanceMetricDefinitionsNextResults retrieves the next set of results, if any. +func (client AppServiceEnvironmentsClient) ListWorkerPoolInstanceMetricDefinitionsNextResults(lastResults ResourceMetricDefinitionCollection) (result ResourceMetricDefinitionCollection, err error) { + req, err := lastResults.ResourceMetricDefinitionCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListWorkerPoolInstanceMetricDefinitions", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListWorkerPoolInstanceMetricDefinitionsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListWorkerPoolInstanceMetricDefinitions", resp, "Failure sending next results request") + } + + result, err = client.ListWorkerPoolInstanceMetricDefinitionsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListWorkerPoolInstanceMetricDefinitions", resp, "Failure responding to next results request") + } + + return +} + +// ListWorkerPoolInstanceMetrics get metrics for a specific instance of a +// worker pool of an App Service Environment. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the App Service Environment. workerPoolName is name +// of the worker pool. instance is name of the instance in the worker pool. +// details is specify true to include instance details. The +// default is false. filter is return only usages/metrics +// specified in the filter. Filter conforms to odata syntax. Example: +// $filter=(name.value eq 'Metric1' or name.value eq 'Metric2') and startTime +// eq '2014-01-01T00:00:00Z' and endTime eq '2014-12-31T23:59:59Z' and +// timeGrain eq duration'[Hour|Minute|Day]'. +func (client AppServiceEnvironmentsClient) ListWorkerPoolInstanceMetrics(resourceGroupName string, name string, workerPoolName string, instance string, details *bool, filter string) (result ResourceMetricCollection, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppServiceEnvironmentsClient", "ListWorkerPoolInstanceMetrics") + } + + req, err := client.ListWorkerPoolInstanceMetricsPreparer(resourceGroupName, name, workerPoolName, instance, details, filter) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListWorkerPoolInstanceMetrics", nil, "Failure preparing request") + } + + resp, err := client.ListWorkerPoolInstanceMetricsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListWorkerPoolInstanceMetrics", resp, "Failure sending request") + } + + result, err = client.ListWorkerPoolInstanceMetricsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListWorkerPoolInstanceMetrics", resp, "Failure responding to request") + } + + return +} + +// ListWorkerPoolInstanceMetricsPreparer prepares the ListWorkerPoolInstanceMetrics request. +func (client AppServiceEnvironmentsClient) ListWorkerPoolInstanceMetricsPreparer(resourceGroupName string, name string, workerPoolName string, instance string, details *bool, filter string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "instance": autorest.Encode("path", instance), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workerPoolName": autorest.Encode("path", workerPoolName), + } + + const APIVersion = "2016-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if details != nil { + queryParameters["details"] = autorest.Encode("query", *details) + } + if len(filter) > 0 { + queryParameters["$filter"] = filter + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/workerPools/{workerPoolName}/instances/{instance}metrics", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListWorkerPoolInstanceMetricsSender sends the ListWorkerPoolInstanceMetrics request. The method will close the +// http.Response Body if it receives an error. +func (client AppServiceEnvironmentsClient) ListWorkerPoolInstanceMetricsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListWorkerPoolInstanceMetricsResponder handles the response to the ListWorkerPoolInstanceMetrics request. The method always +// closes the http.Response Body. +func (client AppServiceEnvironmentsClient) ListWorkerPoolInstanceMetricsResponder(resp *http.Response) (result ResourceMetricCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListWorkerPoolInstanceMetricsNextResults retrieves the next set of results, if any. +func (client AppServiceEnvironmentsClient) ListWorkerPoolInstanceMetricsNextResults(lastResults ResourceMetricCollection) (result ResourceMetricCollection, err error) { + req, err := lastResults.ResourceMetricCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListWorkerPoolInstanceMetrics", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListWorkerPoolInstanceMetricsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListWorkerPoolInstanceMetrics", resp, "Failure sending next results request") + } + + result, err = client.ListWorkerPoolInstanceMetricsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListWorkerPoolInstanceMetrics", resp, "Failure responding to next results request") + } + + return +} + +// ListWorkerPools get all worker pools of an App Service Environment. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the App Service Environment. +func (client AppServiceEnvironmentsClient) ListWorkerPools(resourceGroupName string, name string) (result WorkerPoolCollection, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppServiceEnvironmentsClient", "ListWorkerPools") + } + + req, err := client.ListWorkerPoolsPreparer(resourceGroupName, name) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListWorkerPools", nil, "Failure preparing request") + } + + resp, err := client.ListWorkerPoolsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListWorkerPools", resp, "Failure sending request") + } + + result, err = client.ListWorkerPoolsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListWorkerPools", resp, "Failure responding to request") + } + + return +} + +// ListWorkerPoolsPreparer prepares the ListWorkerPools request. +func (client AppServiceEnvironmentsClient) ListWorkerPoolsPreparer(resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-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.Web/hostingEnvironments/{name}/workerPools", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListWorkerPoolsSender sends the ListWorkerPools request. The method will close the +// http.Response Body if it receives an error. +func (client AppServiceEnvironmentsClient) ListWorkerPoolsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListWorkerPoolsResponder handles the response to the ListWorkerPools request. The method always +// closes the http.Response Body. +func (client AppServiceEnvironmentsClient) ListWorkerPoolsResponder(resp *http.Response) (result WorkerPoolCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListWorkerPoolsNextResults retrieves the next set of results, if any. +func (client AppServiceEnvironmentsClient) ListWorkerPoolsNextResults(lastResults WorkerPoolCollection) (result WorkerPoolCollection, err error) { + req, err := lastResults.WorkerPoolCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListWorkerPools", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListWorkerPoolsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListWorkerPools", resp, "Failure sending next results request") + } + + result, err = client.ListWorkerPoolsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListWorkerPools", resp, "Failure responding to next results request") + } + + return +} + +// ListWorkerPoolSkus get available SKUs for scaling a worker pool. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the App Service Environment. workerPoolName is name +// of the worker pool. +func (client AppServiceEnvironmentsClient) ListWorkerPoolSkus(resourceGroupName string, name string, workerPoolName string) (result SkuInfoCollection, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppServiceEnvironmentsClient", "ListWorkerPoolSkus") + } + + req, err := client.ListWorkerPoolSkusPreparer(resourceGroupName, name, workerPoolName) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListWorkerPoolSkus", nil, "Failure preparing request") + } + + resp, err := client.ListWorkerPoolSkusSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListWorkerPoolSkus", resp, "Failure sending request") + } + + result, err = client.ListWorkerPoolSkusResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListWorkerPoolSkus", resp, "Failure responding to request") + } + + return +} + +// ListWorkerPoolSkusPreparer prepares the ListWorkerPoolSkus request. +func (client AppServiceEnvironmentsClient) ListWorkerPoolSkusPreparer(resourceGroupName string, name string, workerPoolName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workerPoolName": autorest.Encode("path", workerPoolName), + } + + const APIVersion = "2016-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.Web/hostingEnvironments/{name}/workerPools/{workerPoolName}/skus", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListWorkerPoolSkusSender sends the ListWorkerPoolSkus request. The method will close the +// http.Response Body if it receives an error. +func (client AppServiceEnvironmentsClient) ListWorkerPoolSkusSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListWorkerPoolSkusResponder handles the response to the ListWorkerPoolSkus request. The method always +// closes the http.Response Body. +func (client AppServiceEnvironmentsClient) ListWorkerPoolSkusResponder(resp *http.Response) (result SkuInfoCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListWorkerPoolSkusNextResults retrieves the next set of results, if any. +func (client AppServiceEnvironmentsClient) ListWorkerPoolSkusNextResults(lastResults SkuInfoCollection) (result SkuInfoCollection, err error) { + req, err := lastResults.SkuInfoCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListWorkerPoolSkus", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListWorkerPoolSkusSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListWorkerPoolSkus", resp, "Failure sending next results request") + } + + result, err = client.ListWorkerPoolSkusResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListWorkerPoolSkus", resp, "Failure responding to next results request") + } + + return +} + +// Reboot reboot all machines in an App Service Environment. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the App Service Environment. +func (client AppServiceEnvironmentsClient) Reboot(resourceGroupName string, name string) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppServiceEnvironmentsClient", "Reboot") + } + + req, err := client.RebootPreparer(resourceGroupName, name) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "Reboot", nil, "Failure preparing request") + } + + resp, err := client.RebootSender(req) + if err != nil { + result.Response = resp + return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "Reboot", resp, "Failure sending request") + } + + result, err = client.RebootResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "Reboot", resp, "Failure responding to request") + } + + return +} + +// RebootPreparer prepares the Reboot request. +func (client AppServiceEnvironmentsClient) RebootPreparer(resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-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.Web/hostingEnvironments/{name}/reboot", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// RebootSender sends the Reboot request. The method will close the +// http.Response Body if it receives an error. +func (client AppServiceEnvironmentsClient) RebootSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// RebootResponder handles the response to the Reboot request. The method always +// closes the http.Response Body. +func (client AppServiceEnvironmentsClient) RebootResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusBadRequest, http.StatusNotFound, http.StatusConflict), + autorest.ByClosing()) + result.Response = resp + return +} + +// Resume resume an App Service Environment. This method may poll for +// completion. Polling can be canceled by passing the cancel channel argument. +// The channel will be used to cancel polling and any outstanding HTTP +// requests. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the App Service Environment. +func (client AppServiceEnvironmentsClient) Resume(resourceGroupName string, name string, cancel <-chan struct{}) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppServiceEnvironmentsClient", "Resume") + } + + req, err := client.ResumePreparer(resourceGroupName, name, cancel) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "Resume", nil, "Failure preparing request") + } + + resp, err := client.ResumeSender(req) + if err != nil { + result.Response = resp + return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "Resume", resp, "Failure sending request") + } + + result, err = client.ResumeResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "Resume", resp, "Failure responding to request") + } + + return +} + +// ResumePreparer prepares the Resume request. +func (client AppServiceEnvironmentsClient) ResumePreparer(resourceGroupName string, name string, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-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.Web/hostingEnvironments/{name}/resume", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// ResumeSender sends the Resume request. The method will close the +// http.Response Body if it receives an error. +func (client AppServiceEnvironmentsClient) ResumeSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// ResumeResponder handles the response to the Resume request. The method always +// closes the http.Response Body. +func (client AppServiceEnvironmentsClient) ResumeResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// ResumeNextResults retrieves the next set of results, if any. +func (client AppServiceEnvironmentsClient) ResumeNextResults(lastResults AppCollection) (result autorest.Response, err error) { + req, err := lastResults.AppCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "Resume", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ResumeSender(req) + if err != nil { + result.Response = resp + return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "Resume", resp, "Failure sending next results request") + } + + result, err = client.ResumeResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "Resume", resp, "Failure responding to next results request") + } + + return +} + +// Suspend suspend an App Service Environment. This method may poll for +// completion. Polling can be canceled by passing the cancel channel argument. +// The channel will be used to cancel polling and any outstanding HTTP +// requests. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the App Service Environment. +func (client AppServiceEnvironmentsClient) Suspend(resourceGroupName string, name string, cancel <-chan struct{}) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppServiceEnvironmentsClient", "Suspend") + } + + req, err := client.SuspendPreparer(resourceGroupName, name, cancel) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "Suspend", nil, "Failure preparing request") + } + + resp, err := client.SuspendSender(req) + if err != nil { + result.Response = resp + return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "Suspend", resp, "Failure sending request") + } + + result, err = client.SuspendResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "Suspend", resp, "Failure responding to request") + } + + return +} + +// SuspendPreparer prepares the Suspend request. +func (client AppServiceEnvironmentsClient) SuspendPreparer(resourceGroupName string, name string, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-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.Web/hostingEnvironments/{name}/suspend", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// SuspendSender sends the Suspend request. The method will close the +// http.Response Body if it receives an error. +func (client AppServiceEnvironmentsClient) SuspendSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// SuspendResponder handles the response to the Suspend request. The method always +// closes the http.Response Body. +func (client AppServiceEnvironmentsClient) SuspendResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// SuspendNextResults retrieves the next set of results, if any. +func (client AppServiceEnvironmentsClient) SuspendNextResults(lastResults AppCollection) (result autorest.Response, err error) { + req, err := lastResults.AppCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "Suspend", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.SuspendSender(req) + if err != nil { + result.Response = resp + return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "Suspend", resp, "Failure sending next results request") + } + + result, err = client.SuspendResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "Suspend", resp, "Failure responding to next results request") + } + + return +} diff --git a/arm/web/appserviceplans.go b/arm/web/appserviceplans.go new file mode 100755 index 000000000000..8eee1248e3f8 --- /dev/null +++ b/arm/web/appserviceplans.go @@ -0,0 +1,2170 @@ +package web + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// 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/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// AppServicePlansClient is the composite Swagger for WebSite Management Client +type AppServicePlansClient struct { + ManagementClient +} + +// NewAppServicePlansClient creates an instance of the AppServicePlansClient +// client. +func NewAppServicePlansClient(subscriptionID string) AppServicePlansClient { + return NewAppServicePlansClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewAppServicePlansClientWithBaseURI creates an instance of the +// AppServicePlansClient client. +func NewAppServicePlansClientWithBaseURI(baseURI string, subscriptionID string) AppServicePlansClient { + return AppServicePlansClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates or updates an App Service Plan. This method may poll +// for completion. Polling can be canceled by passing the cancel channel +// argument. The channel will be used to cancel polling and any outstanding +// HTTP requests. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the App Service plan. appServicePlan is details of +// the App Service plan. +func (client AppServicePlansClient) CreateOrUpdate(resourceGroupName string, name string, appServicePlan AppServicePlan, cancel <-chan struct{}) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppServicePlansClient", "CreateOrUpdate") + } + + req, err := client.CreateOrUpdatePreparer(resourceGroupName, name, appServicePlan, cancel) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppServicePlansClient", "CreateOrUpdate", nil, "Failure preparing request") + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = resp + return result, autorest.NewErrorWithError(err, "web.AppServicePlansClient", "CreateOrUpdate", resp, "Failure sending request") + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "CreateOrUpdate", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client AppServicePlansClient) CreateOrUpdatePreparer(resourceGroupName string, name string, appServicePlan AppServicePlan, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}", pathParameters), + autorest.WithJSON(appServicePlan), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client AppServicePlansClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client AppServicePlansClient) CreateOrUpdateResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// CreateOrUpdateVnetRoute create or update a Virtual Network route in an App +// Service plan. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the App Service plan. vnetName is name of the +// Virtual Network. routeName is name of the Virtual Network route. route is +// definition of the Virtual Network route. +func (client AppServicePlansClient) CreateOrUpdateVnetRoute(resourceGroupName string, name string, vnetName string, routeName string, route VnetRoute) (result VnetRoute, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppServicePlansClient", "CreateOrUpdateVnetRoute") + } + + req, err := client.CreateOrUpdateVnetRoutePreparer(resourceGroupName, name, vnetName, routeName, route) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppServicePlansClient", "CreateOrUpdateVnetRoute", nil, "Failure preparing request") + } + + resp, err := client.CreateOrUpdateVnetRouteSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppServicePlansClient", "CreateOrUpdateVnetRoute", resp, "Failure sending request") + } + + result, err = client.CreateOrUpdateVnetRouteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "CreateOrUpdateVnetRoute", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdateVnetRoutePreparer prepares the CreateOrUpdateVnetRoute request. +func (client AppServicePlansClient) CreateOrUpdateVnetRoutePreparer(resourceGroupName string, name string, vnetName string, routeName string, route VnetRoute) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "routeName": autorest.Encode("path", routeName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vnetName": autorest.Encode("path", vnetName), + } + + const APIVersion = "2016-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/virtualNetworkConnections/{vnetName}/routes/{routeName}", pathParameters), + autorest.WithJSON(route), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CreateOrUpdateVnetRouteSender sends the CreateOrUpdateVnetRoute request. The method will close the +// http.Response Body if it receives an error. +func (client AppServicePlansClient) CreateOrUpdateVnetRouteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateOrUpdateVnetRouteResponder handles the response to the CreateOrUpdateVnetRoute request. The method always +// closes the http.Response Body. +func (client AppServicePlansClient) CreateOrUpdateVnetRouteResponder(resp *http.Response) (result VnetRoute, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusBadRequest, http.StatusNotFound), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete delete an App Service plan. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the App Service plan. +func (client AppServicePlansClient) Delete(resourceGroupName string, name string) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppServicePlansClient", "Delete") + } + + req, err := client.DeletePreparer(resourceGroupName, name) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppServicePlansClient", "Delete", nil, "Failure preparing request") + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + return result, autorest.NewErrorWithError(err, "web.AppServicePlansClient", "Delete", resp, "Failure sending request") + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client AppServicePlansClient) DeletePreparer(resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-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.Web/serverfarms/{name}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client AppServicePlansClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client AppServicePlansClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// DeleteHybridConnection delete a Hybrid Connection in use in an App Service +// plan. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the App Service plan. namespaceName is name of the +// Service Bus namespace. relayName is name of the Service Bus relay. +func (client AppServicePlansClient) DeleteHybridConnection(resourceGroupName string, name string, namespaceName string, relayName string) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppServicePlansClient", "DeleteHybridConnection") + } + + req, err := client.DeleteHybridConnectionPreparer(resourceGroupName, name, namespaceName, relayName) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppServicePlansClient", "DeleteHybridConnection", nil, "Failure preparing request") + } + + resp, err := client.DeleteHybridConnectionSender(req) + if err != nil { + result.Response = resp + return result, autorest.NewErrorWithError(err, "web.AppServicePlansClient", "DeleteHybridConnection", resp, "Failure sending request") + } + + result, err = client.DeleteHybridConnectionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "DeleteHybridConnection", resp, "Failure responding to request") + } + + return +} + +// DeleteHybridConnectionPreparer prepares the DeleteHybridConnection request. +func (client AppServicePlansClient) DeleteHybridConnectionPreparer(resourceGroupName string, name string, namespaceName string, relayName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "namespaceName": autorest.Encode("path", namespaceName), + "relayName": autorest.Encode("path", relayName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-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.Web/serverfarms/{name}/hybridConnectionNamespaces/{namespaceName}/relays/{relayName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DeleteHybridConnectionSender sends the DeleteHybridConnection request. The method will close the +// http.Response Body if it receives an error. +func (client AppServicePlansClient) DeleteHybridConnectionSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteHybridConnectionResponder handles the response to the DeleteHybridConnection request. The method always +// closes the http.Response Body. +func (client AppServicePlansClient) DeleteHybridConnectionResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// DeleteVnetRoute delete a Virtual Network route in an App Service plan. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the App Service plan. vnetName is name of the +// Virtual Network. routeName is name of the Virtual Network route. +func (client AppServicePlansClient) DeleteVnetRoute(resourceGroupName string, name string, vnetName string, routeName string) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppServicePlansClient", "DeleteVnetRoute") + } + + req, err := client.DeleteVnetRoutePreparer(resourceGroupName, name, vnetName, routeName) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppServicePlansClient", "DeleteVnetRoute", nil, "Failure preparing request") + } + + resp, err := client.DeleteVnetRouteSender(req) + if err != nil { + result.Response = resp + return result, autorest.NewErrorWithError(err, "web.AppServicePlansClient", "DeleteVnetRoute", resp, "Failure sending request") + } + + result, err = client.DeleteVnetRouteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "DeleteVnetRoute", resp, "Failure responding to request") + } + + return +} + +// DeleteVnetRoutePreparer prepares the DeleteVnetRoute request. +func (client AppServicePlansClient) DeleteVnetRoutePreparer(resourceGroupName string, name string, vnetName string, routeName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "routeName": autorest.Encode("path", routeName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vnetName": autorest.Encode("path", vnetName), + } + + const APIVersion = "2016-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.Web/serverfarms/{name}/virtualNetworkConnections/{vnetName}/routes/{routeName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DeleteVnetRouteSender sends the DeleteVnetRoute request. The method will close the +// http.Response Body if it receives an error. +func (client AppServicePlansClient) DeleteVnetRouteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteVnetRouteResponder handles the response to the DeleteVnetRoute request. The method always +// closes the http.Response Body. +func (client AppServicePlansClient) DeleteVnetRouteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNotFound), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get get an App Service plan. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the App Service plan. +func (client AppServicePlansClient) Get(resourceGroupName string, name string) (result AppServicePlan, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppServicePlansClient", "Get") + } + + req, err := client.GetPreparer(resourceGroupName, name) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppServicePlansClient", "Get", nil, "Failure preparing request") + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppServicePlansClient", "Get", resp, "Failure sending request") + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client AppServicePlansClient) GetPreparer(resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-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.Web/serverfarms/{name}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client AppServicePlansClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client AppServicePlansClient) GetResponder(resp *http.Response) (result AppServicePlan, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetHybridConnection retrieve a Hybrid Connection in use in an App Service +// plan. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the App Service plan. namespaceName is name of the +// Service Bus namespace. relayName is name of the Service Bus relay. +func (client AppServicePlansClient) GetHybridConnection(resourceGroupName string, name string, namespaceName string, relayName string) (result HybridConnection, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppServicePlansClient", "GetHybridConnection") + } + + req, err := client.GetHybridConnectionPreparer(resourceGroupName, name, namespaceName, relayName) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppServicePlansClient", "GetHybridConnection", nil, "Failure preparing request") + } + + resp, err := client.GetHybridConnectionSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppServicePlansClient", "GetHybridConnection", resp, "Failure sending request") + } + + result, err = client.GetHybridConnectionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "GetHybridConnection", resp, "Failure responding to request") + } + + return +} + +// GetHybridConnectionPreparer prepares the GetHybridConnection request. +func (client AppServicePlansClient) GetHybridConnectionPreparer(resourceGroupName string, name string, namespaceName string, relayName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "namespaceName": autorest.Encode("path", namespaceName), + "relayName": autorest.Encode("path", relayName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-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.Web/serverfarms/{name}/hybridConnectionNamespaces/{namespaceName}/relays/{relayName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetHybridConnectionSender sends the GetHybridConnection request. The method will close the +// http.Response Body if it receives an error. +func (client AppServicePlansClient) GetHybridConnectionSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetHybridConnectionResponder handles the response to the GetHybridConnection request. The method always +// closes the http.Response Body. +func (client AppServicePlansClient) GetHybridConnectionResponder(resp *http.Response) (result HybridConnection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetHybridConnectionPlanLimit get the maximum number of Hybrid Connections +// allowed in an App Service plan. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the App Service plan. +func (client AppServicePlansClient) GetHybridConnectionPlanLimit(resourceGroupName string, name string) (result HybridConnectionLimits, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppServicePlansClient", "GetHybridConnectionPlanLimit") + } + + req, err := client.GetHybridConnectionPlanLimitPreparer(resourceGroupName, name) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppServicePlansClient", "GetHybridConnectionPlanLimit", nil, "Failure preparing request") + } + + resp, err := client.GetHybridConnectionPlanLimitSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppServicePlansClient", "GetHybridConnectionPlanLimit", resp, "Failure sending request") + } + + result, err = client.GetHybridConnectionPlanLimitResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "GetHybridConnectionPlanLimit", resp, "Failure responding to request") + } + + return +} + +// GetHybridConnectionPlanLimitPreparer prepares the GetHybridConnectionPlanLimit request. +func (client AppServicePlansClient) GetHybridConnectionPlanLimitPreparer(resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-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.Web/serverfarms/{name}/hybridConnectionPlanLimits/limit", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetHybridConnectionPlanLimitSender sends the GetHybridConnectionPlanLimit request. The method will close the +// http.Response Body if it receives an error. +func (client AppServicePlansClient) GetHybridConnectionPlanLimitSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetHybridConnectionPlanLimitResponder handles the response to the GetHybridConnectionPlanLimit request. The method always +// closes the http.Response Body. +func (client AppServicePlansClient) GetHybridConnectionPlanLimitResponder(resp *http.Response) (result HybridConnectionLimits, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetRouteForVnet get a Virtual Network route in an App Service plan. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the App Service plan. vnetName is name of the +// Virtual Network. routeName is name of the Virtual Network route. +func (client AppServicePlansClient) GetRouteForVnet(resourceGroupName string, name string, vnetName string, routeName string) (result ListVnetRoute, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppServicePlansClient", "GetRouteForVnet") + } + + req, err := client.GetRouteForVnetPreparer(resourceGroupName, name, vnetName, routeName) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppServicePlansClient", "GetRouteForVnet", nil, "Failure preparing request") + } + + resp, err := client.GetRouteForVnetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppServicePlansClient", "GetRouteForVnet", resp, "Failure sending request") + } + + result, err = client.GetRouteForVnetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "GetRouteForVnet", resp, "Failure responding to request") + } + + return +} + +// GetRouteForVnetPreparer prepares the GetRouteForVnet request. +func (client AppServicePlansClient) GetRouteForVnetPreparer(resourceGroupName string, name string, vnetName string, routeName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "routeName": autorest.Encode("path", routeName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vnetName": autorest.Encode("path", vnetName), + } + + const APIVersion = "2016-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.Web/serverfarms/{name}/virtualNetworkConnections/{vnetName}/routes/{routeName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetRouteForVnetSender sends the GetRouteForVnet request. The method will close the +// http.Response Body if it receives an error. +func (client AppServicePlansClient) GetRouteForVnetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetRouteForVnetResponder handles the response to the GetRouteForVnet request. The method always +// closes the http.Response Body. +func (client AppServicePlansClient) GetRouteForVnetResponder(resp *http.Response) (result ListVnetRoute, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNotFound), + autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetVnetFromServerFarm get a Virtual Network associated with an App Service +// plan. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the App Service plan. vnetName is name of the +// Virtual Network. +func (client AppServicePlansClient) GetVnetFromServerFarm(resourceGroupName string, name string, vnetName string) (result VnetInfo, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppServicePlansClient", "GetVnetFromServerFarm") + } + + req, err := client.GetVnetFromServerFarmPreparer(resourceGroupName, name, vnetName) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppServicePlansClient", "GetVnetFromServerFarm", nil, "Failure preparing request") + } + + resp, err := client.GetVnetFromServerFarmSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppServicePlansClient", "GetVnetFromServerFarm", resp, "Failure sending request") + } + + result, err = client.GetVnetFromServerFarmResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "GetVnetFromServerFarm", resp, "Failure responding to request") + } + + return +} + +// GetVnetFromServerFarmPreparer prepares the GetVnetFromServerFarm request. +func (client AppServicePlansClient) GetVnetFromServerFarmPreparer(resourceGroupName string, name string, vnetName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vnetName": autorest.Encode("path", vnetName), + } + + const APIVersion = "2016-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.Web/serverfarms/{name}/virtualNetworkConnections/{vnetName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetVnetFromServerFarmSender sends the GetVnetFromServerFarm request. The method will close the +// http.Response Body if it receives an error. +func (client AppServicePlansClient) GetVnetFromServerFarmSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetVnetFromServerFarmResponder handles the response to the GetVnetFromServerFarm request. The method always +// closes the http.Response Body. +func (client AppServicePlansClient) GetVnetFromServerFarmResponder(resp *http.Response) (result VnetInfo, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNotFound), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetVnetGateway get a Virtual Network gateway. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the App Service plan. vnetName is name of the +// Virtual Network. gatewayName is name of the gateway. Only the 'primary' +// gateway is supported. +func (client AppServicePlansClient) GetVnetGateway(resourceGroupName string, name string, vnetName string, gatewayName string) (result VnetGateway, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppServicePlansClient", "GetVnetGateway") + } + + req, err := client.GetVnetGatewayPreparer(resourceGroupName, name, vnetName, gatewayName) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppServicePlansClient", "GetVnetGateway", nil, "Failure preparing request") + } + + resp, err := client.GetVnetGatewaySender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppServicePlansClient", "GetVnetGateway", resp, "Failure sending request") + } + + result, err = client.GetVnetGatewayResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "GetVnetGateway", resp, "Failure responding to request") + } + + return +} + +// GetVnetGatewayPreparer prepares the GetVnetGateway request. +func (client AppServicePlansClient) GetVnetGatewayPreparer(resourceGroupName string, name string, vnetName string, gatewayName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "gatewayName": autorest.Encode("path", gatewayName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vnetName": autorest.Encode("path", vnetName), + } + + const APIVersion = "2016-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.Web/serverfarms/{name}/virtualNetworkConnections/{vnetName}/gateways/{gatewayName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetVnetGatewaySender sends the GetVnetGateway request. The method will close the +// http.Response Body if it receives an error. +func (client AppServicePlansClient) GetVnetGatewaySender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetVnetGatewayResponder handles the response to the GetVnetGateway request. The method always +// closes the http.Response Body. +func (client AppServicePlansClient) GetVnetGatewayResponder(resp *http.Response) (result VnetGateway, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List get all App Service plans for a subcription. +// +// detailed is specify true to return all App Service plan +// properties. The default is false, which returns a subset of the +// properties. +// Retrieval of all properties may increase the API latency. +func (client AppServicePlansClient) List(detailed *bool) (result AppServicePlanCollection, err error) { + req, err := client.ListPreparer(detailed) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppServicePlansClient", "List", nil, "Failure preparing request") + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppServicePlansClient", "List", resp, "Failure sending request") + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client AppServicePlansClient) ListPreparer(detailed *bool) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if detailed != nil { + queryParameters["detailed"] = autorest.Encode("query", *detailed) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Web/serverfarms", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client AppServicePlansClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client AppServicePlansClient) ListResponder(resp *http.Response) (result AppServicePlanCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + 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 AppServicePlansClient) ListNextResults(lastResults AppServicePlanCollection) (result AppServicePlanCollection, err error) { + req, err := lastResults.AppServicePlanCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppServicePlansClient", "List", 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, "web.AppServicePlansClient", "List", resp, "Failure sending next results request") + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "List", resp, "Failure responding to next results request") + } + + return +} + +// ListByResourceGroup get all App Service plans in a resource group. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. +func (client AppServicePlansClient) ListByResourceGroup(resourceGroupName string) (result AppServicePlanCollection, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppServicePlansClient", "ListByResourceGroup") + } + + req, err := client.ListByResourceGroupPreparer(resourceGroupName) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppServicePlansClient", "ListByResourceGroup", nil, "Failure preparing request") + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppServicePlansClient", "ListByResourceGroup", resp, "Failure sending request") + } + + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "ListByResourceGroup", resp, "Failure responding to request") + } + + return +} + +// ListByResourceGroupPreparer prepares the ListByResourceGroup request. +func (client AppServicePlansClient) ListByResourceGroupPreparer(resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-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.Web/serverfarms", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the +// http.Response Body if it receives an error. +func (client AppServicePlansClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (client AppServicePlansClient) ListByResourceGroupResponder(resp *http.Response) (result AppServicePlanCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + 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 AppServicePlansClient) ListByResourceGroupNextResults(lastResults AppServicePlanCollection) (result AppServicePlanCollection, err error) { + req, err := lastResults.AppServicePlanCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppServicePlansClient", "ListByResourceGroup", 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, "web.AppServicePlansClient", "ListByResourceGroup", resp, "Failure sending next results request") + } + + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "ListByResourceGroup", resp, "Failure responding to next results request") + } + + return +} + +// ListCapabilities list all capabilities of an App Service plan. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the App Service plan. +func (client AppServicePlansClient) ListCapabilities(resourceGroupName string, name string) (result ListCapability, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppServicePlansClient", "ListCapabilities") + } + + req, err := client.ListCapabilitiesPreparer(resourceGroupName, name) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppServicePlansClient", "ListCapabilities", nil, "Failure preparing request") + } + + resp, err := client.ListCapabilitiesSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppServicePlansClient", "ListCapabilities", resp, "Failure sending request") + } + + result, err = client.ListCapabilitiesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "ListCapabilities", resp, "Failure responding to request") + } + + return +} + +// ListCapabilitiesPreparer prepares the ListCapabilities request. +func (client AppServicePlansClient) ListCapabilitiesPreparer(resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-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.Web/serverfarms/{name}/capabilities", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListCapabilitiesSender sends the ListCapabilities request. The method will close the +// http.Response Body if it receives an error. +func (client AppServicePlansClient) ListCapabilitiesSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListCapabilitiesResponder handles the response to the ListCapabilities request. The method always +// closes the http.Response Body. +func (client AppServicePlansClient) ListCapabilitiesResponder(resp *http.Response) (result ListCapability, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListHybridConnectionKeys get the send key name and value of a Hybrid +// Connection. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the App Service plan. namespaceName is the name of +// the Service Bus namespace. relayName is the name of the Service Bus relay. +func (client AppServicePlansClient) ListHybridConnectionKeys(resourceGroupName string, name string, namespaceName string, relayName string) (result HybridConnectionKey, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppServicePlansClient", "ListHybridConnectionKeys") + } + + req, err := client.ListHybridConnectionKeysPreparer(resourceGroupName, name, namespaceName, relayName) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppServicePlansClient", "ListHybridConnectionKeys", nil, "Failure preparing request") + } + + resp, err := client.ListHybridConnectionKeysSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppServicePlansClient", "ListHybridConnectionKeys", resp, "Failure sending request") + } + + result, err = client.ListHybridConnectionKeysResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "ListHybridConnectionKeys", resp, "Failure responding to request") + } + + return +} + +// ListHybridConnectionKeysPreparer prepares the ListHybridConnectionKeys request. +func (client AppServicePlansClient) ListHybridConnectionKeysPreparer(resourceGroupName string, name string, namespaceName string, relayName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "namespaceName": autorest.Encode("path", namespaceName), + "relayName": autorest.Encode("path", relayName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-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.Web/serverfarms/{name}/hybridConnectionNamespaces/{namespaceName}/relays/{relayName}/listKeys", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListHybridConnectionKeysSender sends the ListHybridConnectionKeys request. The method will close the +// http.Response Body if it receives an error. +func (client AppServicePlansClient) ListHybridConnectionKeysSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListHybridConnectionKeysResponder handles the response to the ListHybridConnectionKeys request. The method always +// closes the http.Response Body. +func (client AppServicePlansClient) ListHybridConnectionKeysResponder(resp *http.Response) (result HybridConnectionKey, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListHybridConnections retrieve all Hybrid Connections in use in an App +// Service plan. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the App Service plan. +func (client AppServicePlansClient) ListHybridConnections(resourceGroupName string, name string) (result HybridConnectionCollection, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppServicePlansClient", "ListHybridConnections") + } + + req, err := client.ListHybridConnectionsPreparer(resourceGroupName, name) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppServicePlansClient", "ListHybridConnections", nil, "Failure preparing request") + } + + resp, err := client.ListHybridConnectionsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppServicePlansClient", "ListHybridConnections", resp, "Failure sending request") + } + + result, err = client.ListHybridConnectionsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "ListHybridConnections", resp, "Failure responding to request") + } + + return +} + +// ListHybridConnectionsPreparer prepares the ListHybridConnections request. +func (client AppServicePlansClient) ListHybridConnectionsPreparer(resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-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.Web/serverfarms/{name}/hybridConnectionRelays", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListHybridConnectionsSender sends the ListHybridConnections request. The method will close the +// http.Response Body if it receives an error. +func (client AppServicePlansClient) ListHybridConnectionsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListHybridConnectionsResponder handles the response to the ListHybridConnections request. The method always +// closes the http.Response Body. +func (client AppServicePlansClient) ListHybridConnectionsResponder(resp *http.Response) (result HybridConnectionCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListHybridConnectionsNextResults retrieves the next set of results, if any. +func (client AppServicePlansClient) ListHybridConnectionsNextResults(lastResults HybridConnectionCollection) (result HybridConnectionCollection, err error) { + req, err := lastResults.HybridConnectionCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppServicePlansClient", "ListHybridConnections", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListHybridConnectionsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppServicePlansClient", "ListHybridConnections", resp, "Failure sending next results request") + } + + result, err = client.ListHybridConnectionsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "ListHybridConnections", resp, "Failure responding to next results request") + } + + return +} + +// ListMetricDefintions get metrics that can be queried for an App Service +// plan, and their definitions. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the App Service plan. +func (client AppServicePlansClient) ListMetricDefintions(resourceGroupName string, name string) (result ResourceMetricDefinitionCollection, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppServicePlansClient", "ListMetricDefintions") + } + + req, err := client.ListMetricDefintionsPreparer(resourceGroupName, name) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppServicePlansClient", "ListMetricDefintions", nil, "Failure preparing request") + } + + resp, err := client.ListMetricDefintionsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppServicePlansClient", "ListMetricDefintions", resp, "Failure sending request") + } + + result, err = client.ListMetricDefintionsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "ListMetricDefintions", resp, "Failure responding to request") + } + + return +} + +// ListMetricDefintionsPreparer prepares the ListMetricDefintions request. +func (client AppServicePlansClient) ListMetricDefintionsPreparer(resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-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.Web/serverfarms/{name}/metricdefinitions", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListMetricDefintionsSender sends the ListMetricDefintions request. The method will close the +// http.Response Body if it receives an error. +func (client AppServicePlansClient) ListMetricDefintionsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListMetricDefintionsResponder handles the response to the ListMetricDefintions request. The method always +// closes the http.Response Body. +func (client AppServicePlansClient) ListMetricDefintionsResponder(resp *http.Response) (result ResourceMetricDefinitionCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListMetricDefintionsNextResults retrieves the next set of results, if any. +func (client AppServicePlansClient) ListMetricDefintionsNextResults(lastResults ResourceMetricDefinitionCollection) (result ResourceMetricDefinitionCollection, err error) { + req, err := lastResults.ResourceMetricDefinitionCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppServicePlansClient", "ListMetricDefintions", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListMetricDefintionsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppServicePlansClient", "ListMetricDefintions", resp, "Failure sending next results request") + } + + result, err = client.ListMetricDefintionsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "ListMetricDefintions", resp, "Failure responding to next results request") + } + + return +} + +// ListMetrics get metrics for an App Serice plan. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the App Service plan. details is specify +// true to include instance details. The default is +// false. filter is return only usages/metrics specified in the +// filter. Filter conforms to odata syntax. Example: $filter=(name.value eq +// 'Metric1' or name.value eq 'Metric2') and startTime eq +// '2014-01-01T00:00:00Z' and endTime eq '2014-12-31T23:59:59Z' and timeGrain +// eq duration'[Hour|Minute|Day]'. +func (client AppServicePlansClient) ListMetrics(resourceGroupName string, name string, details *bool, filter string) (result ResourceMetricCollection, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppServicePlansClient", "ListMetrics") + } + + req, err := client.ListMetricsPreparer(resourceGroupName, name, details, filter) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppServicePlansClient", "ListMetrics", nil, "Failure preparing request") + } + + resp, err := client.ListMetricsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppServicePlansClient", "ListMetrics", resp, "Failure sending request") + } + + result, err = client.ListMetricsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "ListMetrics", resp, "Failure responding to request") + } + + return +} + +// ListMetricsPreparer prepares the ListMetrics request. +func (client AppServicePlansClient) ListMetricsPreparer(resourceGroupName string, name string, details *bool, filter string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if details != nil { + queryParameters["details"] = autorest.Encode("query", *details) + } + if len(filter) > 0 { + queryParameters["$filter"] = filter + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/metrics", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListMetricsSender sends the ListMetrics request. The method will close the +// http.Response Body if it receives an error. +func (client AppServicePlansClient) ListMetricsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListMetricsResponder handles the response to the ListMetrics request. The method always +// closes the http.Response Body. +func (client AppServicePlansClient) ListMetricsResponder(resp *http.Response) (result ResourceMetricCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListMetricsNextResults retrieves the next set of results, if any. +func (client AppServicePlansClient) ListMetricsNextResults(lastResults ResourceMetricCollection) (result ResourceMetricCollection, err error) { + req, err := lastResults.ResourceMetricCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppServicePlansClient", "ListMetrics", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListMetricsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppServicePlansClient", "ListMetrics", resp, "Failure sending next results request") + } + + result, err = client.ListMetricsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "ListMetrics", resp, "Failure responding to next results request") + } + + return +} + +// ListRoutesForVnet get all routes that are associated with a Virtual Network +// in an App Service plan. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the App Service plan. vnetName is name of the +// Virtual Network. +func (client AppServicePlansClient) ListRoutesForVnet(resourceGroupName string, name string, vnetName string) (result ListVnetRoute, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppServicePlansClient", "ListRoutesForVnet") + } + + req, err := client.ListRoutesForVnetPreparer(resourceGroupName, name, vnetName) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppServicePlansClient", "ListRoutesForVnet", nil, "Failure preparing request") + } + + resp, err := client.ListRoutesForVnetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppServicePlansClient", "ListRoutesForVnet", resp, "Failure sending request") + } + + result, err = client.ListRoutesForVnetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "ListRoutesForVnet", resp, "Failure responding to request") + } + + return +} + +// ListRoutesForVnetPreparer prepares the ListRoutesForVnet request. +func (client AppServicePlansClient) ListRoutesForVnetPreparer(resourceGroupName string, name string, vnetName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vnetName": autorest.Encode("path", vnetName), + } + + const APIVersion = "2016-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.Web/serverfarms/{name}/virtualNetworkConnections/{vnetName}/routes", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListRoutesForVnetSender sends the ListRoutesForVnet request. The method will close the +// http.Response Body if it receives an error. +func (client AppServicePlansClient) ListRoutesForVnetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListRoutesForVnetResponder handles the response to the ListRoutesForVnet request. The method always +// closes the http.Response Body. +func (client AppServicePlansClient) ListRoutesForVnetResponder(resp *http.Response) (result ListVnetRoute, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListVnets get all Virtual Networks associated with an App Service plan. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the App Service plan. +func (client AppServicePlansClient) ListVnets(resourceGroupName string, name string) (result ListVnetInfo, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppServicePlansClient", "ListVnets") + } + + req, err := client.ListVnetsPreparer(resourceGroupName, name) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppServicePlansClient", "ListVnets", nil, "Failure preparing request") + } + + resp, err := client.ListVnetsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppServicePlansClient", "ListVnets", resp, "Failure sending request") + } + + result, err = client.ListVnetsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "ListVnets", resp, "Failure responding to request") + } + + return +} + +// ListVnetsPreparer prepares the ListVnets request. +func (client AppServicePlansClient) ListVnetsPreparer(resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-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.Web/serverfarms/{name}/virtualNetworkConnections", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListVnetsSender sends the ListVnets request. The method will close the +// http.Response Body if it receives an error. +func (client AppServicePlansClient) ListVnetsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListVnetsResponder handles the response to the ListVnets request. The method always +// closes the http.Response Body. +func (client AppServicePlansClient) ListVnetsResponder(resp *http.Response) (result ListVnetInfo, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListWebApps get all apps associated with an App Service plan. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the App Service plan. skipToken is skip to a web +// app in the list of webapps associated with app service plan. If specified, +// the resulting list will contain web apps starting from (including) the +// skipToken. Otherwise, the resulting list contains web apps from the start of +// the list filter is supported filter: $filter=state eq running. Returns only +// web apps that are currently running top is list page size. If specified, +// results are paged. +func (client AppServicePlansClient) ListWebApps(resourceGroupName string, name string, skipToken string, filter string, top string) (result AppCollection, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppServicePlansClient", "ListWebApps") + } + + req, err := client.ListWebAppsPreparer(resourceGroupName, name, skipToken, filter, top) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppServicePlansClient", "ListWebApps", nil, "Failure preparing request") + } + + resp, err := client.ListWebAppsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppServicePlansClient", "ListWebApps", resp, "Failure sending request") + } + + result, err = client.ListWebAppsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "ListWebApps", resp, "Failure responding to request") + } + + return +} + +// ListWebAppsPreparer prepares the ListWebApps request. +func (client AppServicePlansClient) ListWebAppsPreparer(resourceGroupName string, name string, skipToken string, filter string, top string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(skipToken) > 0 { + queryParameters["$skipToken"] = autorest.Encode("query", skipToken) + } + if len(filter) > 0 { + queryParameters["$filter"] = filter + } + 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.Web/serverfarms/{name}/sites", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListWebAppsSender sends the ListWebApps request. The method will close the +// http.Response Body if it receives an error. +func (client AppServicePlansClient) ListWebAppsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListWebAppsResponder handles the response to the ListWebApps request. The method always +// closes the http.Response Body. +func (client AppServicePlansClient) ListWebAppsResponder(resp *http.Response) (result AppCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListWebAppsNextResults retrieves the next set of results, if any. +func (client AppServicePlansClient) ListWebAppsNextResults(lastResults AppCollection) (result AppCollection, err error) { + req, err := lastResults.AppCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppServicePlansClient", "ListWebApps", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListWebAppsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppServicePlansClient", "ListWebApps", resp, "Failure sending next results request") + } + + result, err = client.ListWebAppsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "ListWebApps", resp, "Failure responding to next results request") + } + + return +} + +// ListWebAppsByHybridConnection get all apps that use a Hybrid Connection in +// an App Service Plan. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the App Service plan. namespaceName is name of the +// Hybrid Connection namespace. relayName is name of the Hybrid Connection +// relay. +func (client AppServicePlansClient) ListWebAppsByHybridConnection(resourceGroupName string, name string, namespaceName string, relayName string) (result ResourceCollection, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppServicePlansClient", "ListWebAppsByHybridConnection") + } + + req, err := client.ListWebAppsByHybridConnectionPreparer(resourceGroupName, name, namespaceName, relayName) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppServicePlansClient", "ListWebAppsByHybridConnection", nil, "Failure preparing request") + } + + resp, err := client.ListWebAppsByHybridConnectionSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppServicePlansClient", "ListWebAppsByHybridConnection", resp, "Failure sending request") + } + + result, err = client.ListWebAppsByHybridConnectionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "ListWebAppsByHybridConnection", resp, "Failure responding to request") + } + + return +} + +// ListWebAppsByHybridConnectionPreparer prepares the ListWebAppsByHybridConnection request. +func (client AppServicePlansClient) ListWebAppsByHybridConnectionPreparer(resourceGroupName string, name string, namespaceName string, relayName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "namespaceName": autorest.Encode("path", namespaceName), + "relayName": autorest.Encode("path", relayName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-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.Web/serverfarms/{name}/hybridConnectionNamespaces/{namespaceName}/relays/{relayName}/sites", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListWebAppsByHybridConnectionSender sends the ListWebAppsByHybridConnection request. The method will close the +// http.Response Body if it receives an error. +func (client AppServicePlansClient) ListWebAppsByHybridConnectionSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListWebAppsByHybridConnectionResponder handles the response to the ListWebAppsByHybridConnection request. The method always +// closes the http.Response Body. +func (client AppServicePlansClient) ListWebAppsByHybridConnectionResponder(resp *http.Response) (result ResourceCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListWebAppsByHybridConnectionNextResults retrieves the next set of results, if any. +func (client AppServicePlansClient) ListWebAppsByHybridConnectionNextResults(lastResults ResourceCollection) (result ResourceCollection, err error) { + req, err := lastResults.ResourceCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppServicePlansClient", "ListWebAppsByHybridConnection", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListWebAppsByHybridConnectionSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppServicePlansClient", "ListWebAppsByHybridConnection", resp, "Failure sending next results request") + } + + result, err = client.ListWebAppsByHybridConnectionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "ListWebAppsByHybridConnection", resp, "Failure responding to next results request") + } + + return +} + +// RebootWorker reboot a worker machine in an App Service plan. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the App Service plan. workerName is name of worker +// machine, which typically starts with RD. +func (client AppServicePlansClient) RebootWorker(resourceGroupName string, name string, workerName string) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppServicePlansClient", "RebootWorker") + } + + req, err := client.RebootWorkerPreparer(resourceGroupName, name, workerName) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppServicePlansClient", "RebootWorker", nil, "Failure preparing request") + } + + resp, err := client.RebootWorkerSender(req) + if err != nil { + result.Response = resp + return result, autorest.NewErrorWithError(err, "web.AppServicePlansClient", "RebootWorker", resp, "Failure sending request") + } + + result, err = client.RebootWorkerResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "RebootWorker", resp, "Failure responding to request") + } + + return +} + +// RebootWorkerPreparer prepares the RebootWorker request. +func (client AppServicePlansClient) RebootWorkerPreparer(resourceGroupName string, name string, workerName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workerName": autorest.Encode("path", workerName), + } + + const APIVersion = "2016-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.Web/serverfarms/{name}/workers/{workerName}/reboot", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// RebootWorkerSender sends the RebootWorker request. The method will close the +// http.Response Body if it receives an error. +func (client AppServicePlansClient) RebootWorkerSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// RebootWorkerResponder handles the response to the RebootWorker request. The method always +// closes the http.Response Body. +func (client AppServicePlansClient) RebootWorkerResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// RestartWebApps restart all apps in an App Service plan. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the App Service plan. softRestart is specify +// true to performa a soft restart, applies the configuration +// settings and restarts the apps if necessary. The default is +// false, which always restarts and reprovisions the apps +func (client AppServicePlansClient) RestartWebApps(resourceGroupName string, name string, softRestart *bool) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppServicePlansClient", "RestartWebApps") + } + + req, err := client.RestartWebAppsPreparer(resourceGroupName, name, softRestart) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppServicePlansClient", "RestartWebApps", nil, "Failure preparing request") + } + + resp, err := client.RestartWebAppsSender(req) + if err != nil { + result.Response = resp + return result, autorest.NewErrorWithError(err, "web.AppServicePlansClient", "RestartWebApps", resp, "Failure sending request") + } + + result, err = client.RestartWebAppsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "RestartWebApps", resp, "Failure responding to request") + } + + return +} + +// RestartWebAppsPreparer prepares the RestartWebApps request. +func (client AppServicePlansClient) RestartWebAppsPreparer(resourceGroupName string, name string, softRestart *bool) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if softRestart != nil { + queryParameters["softRestart"] = autorest.Encode("query", *softRestart) + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/restartSites", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// RestartWebAppsSender sends the RestartWebApps request. The method will close the +// http.Response Body if it receives an error. +func (client AppServicePlansClient) RestartWebAppsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// RestartWebAppsResponder handles the response to the RestartWebApps request. The method always +// closes the http.Response Body. +func (client AppServicePlansClient) RestartWebAppsResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// UpdateVnetGateway update a Virtual Network gateway. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the App Service plan. vnetName is name of the +// Virtual Network. gatewayName is name of the gateway. Only the 'primary' +// gateway is supported. connectionEnvelope is definition of the gateway. +func (client AppServicePlansClient) UpdateVnetGateway(resourceGroupName string, name string, vnetName string, gatewayName string, connectionEnvelope VnetGateway) (result VnetGateway, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppServicePlansClient", "UpdateVnetGateway") + } + + req, err := client.UpdateVnetGatewayPreparer(resourceGroupName, name, vnetName, gatewayName, connectionEnvelope) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppServicePlansClient", "UpdateVnetGateway", nil, "Failure preparing request") + } + + resp, err := client.UpdateVnetGatewaySender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppServicePlansClient", "UpdateVnetGateway", resp, "Failure sending request") + } + + result, err = client.UpdateVnetGatewayResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "UpdateVnetGateway", resp, "Failure responding to request") + } + + return +} + +// UpdateVnetGatewayPreparer prepares the UpdateVnetGateway request. +func (client AppServicePlansClient) UpdateVnetGatewayPreparer(resourceGroupName string, name string, vnetName string, gatewayName string, connectionEnvelope VnetGateway) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "gatewayName": autorest.Encode("path", gatewayName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vnetName": autorest.Encode("path", vnetName), + } + + const APIVersion = "2016-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/virtualNetworkConnections/{vnetName}/gateways/{gatewayName}", pathParameters), + autorest.WithJSON(connectionEnvelope), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// UpdateVnetGatewaySender sends the UpdateVnetGateway request. The method will close the +// http.Response Body if it receives an error. +func (client AppServicePlansClient) UpdateVnetGatewaySender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// UpdateVnetGatewayResponder handles the response to the UpdateVnetGateway request. The method always +// closes the http.Response Body. +func (client AppServicePlansClient) UpdateVnetGatewayResponder(resp *http.Response) (result VnetGateway, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// UpdateVnetRoute create or update a Virtual Network route in an App Service +// plan. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the App Service plan. vnetName is name of the +// Virtual Network. routeName is name of the Virtual Network route. route is +// definition of the Virtual Network route. +func (client AppServicePlansClient) UpdateVnetRoute(resourceGroupName string, name string, vnetName string, routeName string, route VnetRoute) (result VnetRoute, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppServicePlansClient", "UpdateVnetRoute") + } + + req, err := client.UpdateVnetRoutePreparer(resourceGroupName, name, vnetName, routeName, route) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppServicePlansClient", "UpdateVnetRoute", nil, "Failure preparing request") + } + + resp, err := client.UpdateVnetRouteSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppServicePlansClient", "UpdateVnetRoute", resp, "Failure sending request") + } + + result, err = client.UpdateVnetRouteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "UpdateVnetRoute", resp, "Failure responding to request") + } + + return +} + +// UpdateVnetRoutePreparer prepares the UpdateVnetRoute request. +func (client AppServicePlansClient) UpdateVnetRoutePreparer(resourceGroupName string, name string, vnetName string, routeName string, route VnetRoute) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "routeName": autorest.Encode("path", routeName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vnetName": autorest.Encode("path", vnetName), + } + + const APIVersion = "2016-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/virtualNetworkConnections/{vnetName}/routes/{routeName}", pathParameters), + autorest.WithJSON(route), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// UpdateVnetRouteSender sends the UpdateVnetRoute request. The method will close the +// http.Response Body if it receives an error. +func (client AppServicePlansClient) UpdateVnetRouteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// UpdateVnetRouteResponder handles the response to the UpdateVnetRoute request. The method always +// closes the http.Response Body. +func (client AppServicePlansClient) UpdateVnetRouteResponder(resp *http.Response) (result VnetRoute, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusBadRequest, http.StatusNotFound), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/arm/web/certificateorders.go b/arm/web/certificateorders.go deleted file mode 100644 index 54be7d9ed8cf..000000000000 --- a/arm/web/certificateorders.go +++ /dev/null @@ -1,1122 +0,0 @@ -package web - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// -// See the License for the specific language governing permissions and -// limitations under the License. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// 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/azure" - "net/http" -) - -// CertificateOrdersClient is the use these APIs to manage Azure Websites -// resources through the Azure Resource Manager. All task operations conform to -// the HTTP/1.1 protocol specification and each operation returns an -// x-ms-request-id header that can be used to obtain information about the -// request. You must make sure that requests made to these resources are -// secure. For more information, see -// https://msdn.microsoft.com/en-us/library/azure/dn790557.aspx. -type CertificateOrdersClient struct { - ManagementClient -} - -// NewCertificateOrdersClient creates an instance of the -// CertificateOrdersClient client. -func NewCertificateOrdersClient(subscriptionID string) CertificateOrdersClient { - return NewCertificateOrdersClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewCertificateOrdersClientWithBaseURI creates an instance of the -// CertificateOrdersClient client. -func NewCertificateOrdersClientWithBaseURI(baseURI string, subscriptionID string) CertificateOrdersClient { - return CertificateOrdersClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdateCertificate sends the create or update certificate request. -// -// resourceGroupName is azure resource group name certificateOrderName is -// certificate name name is certificate name keyVaultCertificate is key Vault -// secret csm Id -func (client CertificateOrdersClient) CreateOrUpdateCertificate(resourceGroupName string, certificateOrderName string, name string, keyVaultCertificate CertificateOrderCertificate) (result CertificateOrderCertificate, err error) { - req, err := client.CreateOrUpdateCertificatePreparer(resourceGroupName, certificateOrderName, name, keyVaultCertificate) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.CertificateOrdersClient", "CreateOrUpdateCertificate", nil, "Failure preparing request") - } - - resp, err := client.CreateOrUpdateCertificateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.CertificateOrdersClient", "CreateOrUpdateCertificate", resp, "Failure sending request") - } - - result, err = client.CreateOrUpdateCertificateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.CertificateOrdersClient", "CreateOrUpdateCertificate", resp, "Failure responding to request") - } - - return -} - -// CreateOrUpdateCertificatePreparer prepares the CreateOrUpdateCertificate request. -func (client CertificateOrdersClient) CreateOrUpdateCertificatePreparer(resourceGroupName string, certificateOrderName string, name string, keyVaultCertificate CertificateOrderCertificate) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "certificateOrderName": autorest.Encode("path", certificateOrderName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName}/certificates/{name}", pathParameters), - autorest.WithJSON(keyVaultCertificate), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CreateOrUpdateCertificateSender sends the CreateOrUpdateCertificate request. The method will close the -// http.Response Body if it receives an error. -func (client CertificateOrdersClient) CreateOrUpdateCertificateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CreateOrUpdateCertificateResponder handles the response to the CreateOrUpdateCertificate request. The method always -// closes the http.Response Body. -func (client CertificateOrdersClient) CreateOrUpdateCertificateResponder(resp *http.Response) (result CertificateOrderCertificate, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// CreateOrUpdateCertificateOrder sends the create or update certificate order -// request. -// -// resourceGroupName is azure resource group name name is certificate name -// certificateDistinguishedName is distinguished name to be used for purchasing -// certificate -func (client CertificateOrdersClient) CreateOrUpdateCertificateOrder(resourceGroupName string, name string, certificateDistinguishedName CertificateOrder) (result CertificateOrder, err error) { - req, err := client.CreateOrUpdateCertificateOrderPreparer(resourceGroupName, name, certificateDistinguishedName) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.CertificateOrdersClient", "CreateOrUpdateCertificateOrder", nil, "Failure preparing request") - } - - resp, err := client.CreateOrUpdateCertificateOrderSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.CertificateOrdersClient", "CreateOrUpdateCertificateOrder", resp, "Failure sending request") - } - - result, err = client.CreateOrUpdateCertificateOrderResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.CertificateOrdersClient", "CreateOrUpdateCertificateOrder", resp, "Failure responding to request") - } - - return -} - -// CreateOrUpdateCertificateOrderPreparer prepares the CreateOrUpdateCertificateOrder request. -func (client CertificateOrdersClient) CreateOrUpdateCertificateOrderPreparer(resourceGroupName string, name string, certificateDistinguishedName CertificateOrder) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{name}", pathParameters), - autorest.WithJSON(certificateDistinguishedName), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CreateOrUpdateCertificateOrderSender sends the CreateOrUpdateCertificateOrder request. The method will close the -// http.Response Body if it receives an error. -func (client CertificateOrdersClient) CreateOrUpdateCertificateOrderSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CreateOrUpdateCertificateOrderResponder handles the response to the CreateOrUpdateCertificateOrder request. The method always -// closes the http.Response Body. -func (client CertificateOrdersClient) CreateOrUpdateCertificateOrderResponder(resp *http.Response) (result CertificateOrder, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// DeleteCertificate sends the delete certificate request. -// -// resourceGroupName is azure resource group name certificateOrderName is -// certificate name name is certificate name -func (client CertificateOrdersClient) DeleteCertificate(resourceGroupName string, certificateOrderName string, name string) (result SetObject, err error) { - req, err := client.DeleteCertificatePreparer(resourceGroupName, certificateOrderName, name) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.CertificateOrdersClient", "DeleteCertificate", nil, "Failure preparing request") - } - - resp, err := client.DeleteCertificateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.CertificateOrdersClient", "DeleteCertificate", resp, "Failure sending request") - } - - result, err = client.DeleteCertificateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.CertificateOrdersClient", "DeleteCertificate", resp, "Failure responding to request") - } - - return -} - -// DeleteCertificatePreparer prepares the DeleteCertificate request. -func (client CertificateOrdersClient) DeleteCertificatePreparer(resourceGroupName string, certificateOrderName string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "certificateOrderName": autorest.Encode("path", certificateOrderName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName}/certificates/{name}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// DeleteCertificateSender sends the DeleteCertificate request. The method will close the -// http.Response Body if it receives an error. -func (client CertificateOrdersClient) DeleteCertificateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DeleteCertificateResponder handles the response to the DeleteCertificate request. The method always -// closes the http.Response Body. -func (client CertificateOrdersClient) DeleteCertificateResponder(resp *http.Response) (result SetObject, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Value), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// DeleteCertificateOrder sends the delete certificate order request. -// -// resourceGroupName is azure resource group name name is certificate name -func (client CertificateOrdersClient) DeleteCertificateOrder(resourceGroupName string, name string) (result SetObject, err error) { - req, err := client.DeleteCertificateOrderPreparer(resourceGroupName, name) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.CertificateOrdersClient", "DeleteCertificateOrder", nil, "Failure preparing request") - } - - resp, err := client.DeleteCertificateOrderSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.CertificateOrdersClient", "DeleteCertificateOrder", resp, "Failure sending request") - } - - result, err = client.DeleteCertificateOrderResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.CertificateOrdersClient", "DeleteCertificateOrder", resp, "Failure responding to request") - } - - return -} - -// DeleteCertificateOrderPreparer prepares the DeleteCertificateOrder request. -func (client CertificateOrdersClient) DeleteCertificateOrderPreparer(resourceGroupName string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{name}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// DeleteCertificateOrderSender sends the DeleteCertificateOrder request. The method will close the -// http.Response Body if it receives an error. -func (client CertificateOrdersClient) DeleteCertificateOrderSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DeleteCertificateOrderResponder handles the response to the DeleteCertificateOrder request. The method always -// closes the http.Response Body. -func (client CertificateOrdersClient) DeleteCertificateOrderResponder(resp *http.Response) (result SetObject, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Value), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetCertificate sends the get certificate request. -// -// resourceGroupName is azure resource group name certificateOrderName is -// certificate name name is certificate name -func (client CertificateOrdersClient) GetCertificate(resourceGroupName string, certificateOrderName string, name string) (result CertificateOrderCertificate, err error) { - req, err := client.GetCertificatePreparer(resourceGroupName, certificateOrderName, name) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.CertificateOrdersClient", "GetCertificate", nil, "Failure preparing request") - } - - resp, err := client.GetCertificateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.CertificateOrdersClient", "GetCertificate", resp, "Failure sending request") - } - - result, err = client.GetCertificateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.CertificateOrdersClient", "GetCertificate", resp, "Failure responding to request") - } - - return -} - -// GetCertificatePreparer prepares the GetCertificate request. -func (client CertificateOrdersClient) GetCertificatePreparer(resourceGroupName string, certificateOrderName string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "certificateOrderName": autorest.Encode("path", certificateOrderName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName}/certificates/{name}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetCertificateSender sends the GetCertificate request. The method will close the -// http.Response Body if it receives an error. -func (client CertificateOrdersClient) GetCertificateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetCertificateResponder handles the response to the GetCertificate request. The method always -// closes the http.Response Body. -func (client CertificateOrdersClient) GetCertificateResponder(resp *http.Response) (result CertificateOrderCertificate, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetCertificateOrder sends the get certificate order request. -// -// resourceGroupName is azure resource group name name is certificate name -func (client CertificateOrdersClient) GetCertificateOrder(resourceGroupName string, name string) (result CertificateOrder, err error) { - req, err := client.GetCertificateOrderPreparer(resourceGroupName, name) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.CertificateOrdersClient", "GetCertificateOrder", nil, "Failure preparing request") - } - - resp, err := client.GetCertificateOrderSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.CertificateOrdersClient", "GetCertificateOrder", resp, "Failure sending request") - } - - result, err = client.GetCertificateOrderResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.CertificateOrdersClient", "GetCertificateOrder", resp, "Failure responding to request") - } - - return -} - -// GetCertificateOrderPreparer prepares the GetCertificateOrder request. -func (client CertificateOrdersClient) GetCertificateOrderPreparer(resourceGroupName string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{name}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetCertificateOrderSender sends the GetCertificateOrder request. The method will close the -// http.Response Body if it receives an error. -func (client CertificateOrdersClient) GetCertificateOrderSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetCertificateOrderResponder handles the response to the GetCertificateOrder request. The method always -// closes the http.Response Body. -func (client CertificateOrdersClient) GetCertificateOrderResponder(resp *http.Response) (result CertificateOrder, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetCertificateOrders sends the get certificate orders request. -// -// resourceGroupName is azure resource group name -func (client CertificateOrdersClient) GetCertificateOrders(resourceGroupName string) (result CertificateOrderCollection, err error) { - req, err := client.GetCertificateOrdersPreparer(resourceGroupName) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.CertificateOrdersClient", "GetCertificateOrders", nil, "Failure preparing request") - } - - resp, err := client.GetCertificateOrdersSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.CertificateOrdersClient", "GetCertificateOrders", resp, "Failure sending request") - } - - result, err = client.GetCertificateOrdersResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.CertificateOrdersClient", "GetCertificateOrders", resp, "Failure responding to request") - } - - return -} - -// GetCertificateOrdersPreparer prepares the GetCertificateOrders request. -func (client CertificateOrdersClient) GetCertificateOrdersPreparer(resourceGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetCertificateOrdersSender sends the GetCertificateOrders request. The method will close the -// http.Response Body if it receives an error. -func (client CertificateOrdersClient) GetCertificateOrdersSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetCertificateOrdersResponder handles the response to the GetCertificateOrders request. The method always -// closes the http.Response Body. -func (client CertificateOrdersClient) GetCertificateOrdersResponder(resp *http.Response) (result CertificateOrderCollection, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetCertificateOrdersNextResults retrieves the next set of results, if any. -func (client CertificateOrdersClient) GetCertificateOrdersNextResults(lastResults CertificateOrderCollection) (result CertificateOrderCollection, err error) { - req, err := lastResults.CertificateOrderCollectionPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "web.CertificateOrdersClient", "GetCertificateOrders", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.GetCertificateOrdersSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.CertificateOrdersClient", "GetCertificateOrders", resp, "Failure sending next results request") - } - - result, err = client.GetCertificateOrdersResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.CertificateOrdersClient", "GetCertificateOrders", resp, "Failure responding to next results request") - } - - return -} - -// GetCertificates sends the get certificates request. -// -// resourceGroupName is azure resource group name certificateOrderName is -// certificate name -func (client CertificateOrdersClient) GetCertificates(resourceGroupName string, certificateOrderName string) (result CertificateOrderCertificateCollection, err error) { - req, err := client.GetCertificatesPreparer(resourceGroupName, certificateOrderName) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.CertificateOrdersClient", "GetCertificates", nil, "Failure preparing request") - } - - resp, err := client.GetCertificatesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.CertificateOrdersClient", "GetCertificates", resp, "Failure sending request") - } - - result, err = client.GetCertificatesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.CertificateOrdersClient", "GetCertificates", resp, "Failure responding to request") - } - - return -} - -// GetCertificatesPreparer prepares the GetCertificates request. -func (client CertificateOrdersClient) GetCertificatesPreparer(resourceGroupName string, certificateOrderName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "certificateOrderName": autorest.Encode("path", certificateOrderName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName}/certificates", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetCertificatesSender sends the GetCertificates request. The method will close the -// http.Response Body if it receives an error. -func (client CertificateOrdersClient) GetCertificatesSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetCertificatesResponder handles the response to the GetCertificates request. The method always -// closes the http.Response Body. -func (client CertificateOrdersClient) GetCertificatesResponder(resp *http.Response) (result CertificateOrderCertificateCollection, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetCertificatesNextResults retrieves the next set of results, if any. -func (client CertificateOrdersClient) GetCertificatesNextResults(lastResults CertificateOrderCertificateCollection) (result CertificateOrderCertificateCollection, err error) { - req, err := lastResults.CertificateOrderCertificateCollectionPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "web.CertificateOrdersClient", "GetCertificates", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.GetCertificatesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.CertificateOrdersClient", "GetCertificates", resp, "Failure sending next results request") - } - - result, err = client.GetCertificatesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.CertificateOrdersClient", "GetCertificates", resp, "Failure responding to next results request") - } - - return -} - -// ReissueCertificateOrder sends the reissue certificate order request. -// -// resourceGroupName is azure resource group name name is certificate name -// reissueCertificateOrderRequest is reissue parameters -func (client CertificateOrdersClient) ReissueCertificateOrder(resourceGroupName string, name string, reissueCertificateOrderRequest ReissueCertificateOrderRequest) (result SetObject, err error) { - req, err := client.ReissueCertificateOrderPreparer(resourceGroupName, name, reissueCertificateOrderRequest) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.CertificateOrdersClient", "ReissueCertificateOrder", nil, "Failure preparing request") - } - - resp, err := client.ReissueCertificateOrderSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.CertificateOrdersClient", "ReissueCertificateOrder", resp, "Failure sending request") - } - - result, err = client.ReissueCertificateOrderResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.CertificateOrdersClient", "ReissueCertificateOrder", resp, "Failure responding to request") - } - - return -} - -// ReissueCertificateOrderPreparer prepares the ReissueCertificateOrder request. -func (client CertificateOrdersClient) ReissueCertificateOrderPreparer(resourceGroupName string, name string, reissueCertificateOrderRequest ReissueCertificateOrderRequest) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{name}/reissue", pathParameters), - autorest.WithJSON(reissueCertificateOrderRequest), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ReissueCertificateOrderSender sends the ReissueCertificateOrder request. The method will close the -// http.Response Body if it receives an error. -func (client CertificateOrdersClient) ReissueCertificateOrderSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ReissueCertificateOrderResponder handles the response to the ReissueCertificateOrder request. The method always -// closes the http.Response Body. -func (client CertificateOrdersClient) ReissueCertificateOrderResponder(resp *http.Response) (result SetObject, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Value), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// RenewCertificateOrder sends the renew certificate order request. -// -// resourceGroupName is azure resource group name name is certificate name -// renewCertificateOrderRequest is renew parameters -func (client CertificateOrdersClient) RenewCertificateOrder(resourceGroupName string, name string, renewCertificateOrderRequest RenewCertificateOrderRequest) (result SetObject, err error) { - req, err := client.RenewCertificateOrderPreparer(resourceGroupName, name, renewCertificateOrderRequest) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.CertificateOrdersClient", "RenewCertificateOrder", nil, "Failure preparing request") - } - - resp, err := client.RenewCertificateOrderSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.CertificateOrdersClient", "RenewCertificateOrder", resp, "Failure sending request") - } - - result, err = client.RenewCertificateOrderResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.CertificateOrdersClient", "RenewCertificateOrder", resp, "Failure responding to request") - } - - return -} - -// RenewCertificateOrderPreparer prepares the RenewCertificateOrder request. -func (client CertificateOrdersClient) RenewCertificateOrderPreparer(resourceGroupName string, name string, renewCertificateOrderRequest RenewCertificateOrderRequest) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{name}/renew", pathParameters), - autorest.WithJSON(renewCertificateOrderRequest), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// RenewCertificateOrderSender sends the RenewCertificateOrder request. The method will close the -// http.Response Body if it receives an error. -func (client CertificateOrdersClient) RenewCertificateOrderSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// RenewCertificateOrderResponder handles the response to the RenewCertificateOrder request. The method always -// closes the http.Response Body. -func (client CertificateOrdersClient) RenewCertificateOrderResponder(resp *http.Response) (result SetObject, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Value), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ResendCertificateEmail sends the resend certificate email request. -// -// resourceGroupName is azure resource group name name is certificate order -// name -func (client CertificateOrdersClient) ResendCertificateEmail(resourceGroupName string, name string) (result SetObject, err error) { - req, err := client.ResendCertificateEmailPreparer(resourceGroupName, name) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.CertificateOrdersClient", "ResendCertificateEmail", nil, "Failure preparing request") - } - - resp, err := client.ResendCertificateEmailSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.CertificateOrdersClient", "ResendCertificateEmail", resp, "Failure sending request") - } - - result, err = client.ResendCertificateEmailResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.CertificateOrdersClient", "ResendCertificateEmail", resp, "Failure responding to request") - } - - return -} - -// ResendCertificateEmailPreparer prepares the ResendCertificateEmail request. -func (client CertificateOrdersClient) ResendCertificateEmailPreparer(resourceGroupName string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{name}/resendEmail", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ResendCertificateEmailSender sends the ResendCertificateEmail request. The method will close the -// http.Response Body if it receives an error. -func (client CertificateOrdersClient) ResendCertificateEmailSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ResendCertificateEmailResponder handles the response to the ResendCertificateEmail request. The method always -// closes the http.Response Body. -func (client CertificateOrdersClient) ResendCertificateEmailResponder(resp *http.Response) (result SetObject, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Value), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// RetrieveCertificateActions sends the retrieve certificate actions request. -// -// resourceGroupName is azure resource group name name is certificate order -// name -func (client CertificateOrdersClient) RetrieveCertificateActions(resourceGroupName string, name string) (result ListCertificateOrderAction, err error) { - req, err := client.RetrieveCertificateActionsPreparer(resourceGroupName, name) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.CertificateOrdersClient", "RetrieveCertificateActions", nil, "Failure preparing request") - } - - resp, err := client.RetrieveCertificateActionsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.CertificateOrdersClient", "RetrieveCertificateActions", resp, "Failure sending request") - } - - result, err = client.RetrieveCertificateActionsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.CertificateOrdersClient", "RetrieveCertificateActions", resp, "Failure responding to request") - } - - return -} - -// RetrieveCertificateActionsPreparer prepares the RetrieveCertificateActions request. -func (client CertificateOrdersClient) RetrieveCertificateActionsPreparer(resourceGroupName string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{name}/retrieveCertificateActions", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// RetrieveCertificateActionsSender sends the RetrieveCertificateActions request. The method will close the -// http.Response Body if it receives an error. -func (client CertificateOrdersClient) RetrieveCertificateActionsSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// RetrieveCertificateActionsResponder handles the response to the RetrieveCertificateActions request. The method always -// closes the http.Response Body. -func (client CertificateOrdersClient) RetrieveCertificateActionsResponder(resp *http.Response) (result ListCertificateOrderAction, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Value), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// RetrieveCertificateEmailHistory sends the retrieve certificate email history -// request. -// -// resourceGroupName is azure resource group name name is certificate order -// name -func (client CertificateOrdersClient) RetrieveCertificateEmailHistory(resourceGroupName string, name string) (result ListCertificateEmail, err error) { - req, err := client.RetrieveCertificateEmailHistoryPreparer(resourceGroupName, name) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.CertificateOrdersClient", "RetrieveCertificateEmailHistory", nil, "Failure preparing request") - } - - resp, err := client.RetrieveCertificateEmailHistorySender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.CertificateOrdersClient", "RetrieveCertificateEmailHistory", resp, "Failure sending request") - } - - result, err = client.RetrieveCertificateEmailHistoryResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.CertificateOrdersClient", "RetrieveCertificateEmailHistory", resp, "Failure responding to request") - } - - return -} - -// RetrieveCertificateEmailHistoryPreparer prepares the RetrieveCertificateEmailHistory request. -func (client CertificateOrdersClient) RetrieveCertificateEmailHistoryPreparer(resourceGroupName string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{name}/retrieveEmailHistory", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// RetrieveCertificateEmailHistorySender sends the RetrieveCertificateEmailHistory request. The method will close the -// http.Response Body if it receives an error. -func (client CertificateOrdersClient) RetrieveCertificateEmailHistorySender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// RetrieveCertificateEmailHistoryResponder handles the response to the RetrieveCertificateEmailHistory request. The method always -// closes the http.Response Body. -func (client CertificateOrdersClient) RetrieveCertificateEmailHistoryResponder(resp *http.Response) (result ListCertificateEmail, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Value), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// UpdateCertificate sends the update certificate request. -// -// resourceGroupName is azure resource group name certificateOrderName is -// certificate name name is certificate name keyVaultCertificate is key Vault -// secret csm Id -func (client CertificateOrdersClient) UpdateCertificate(resourceGroupName string, certificateOrderName string, name string, keyVaultCertificate CertificateOrderCertificate) (result CertificateOrderCertificate, err error) { - req, err := client.UpdateCertificatePreparer(resourceGroupName, certificateOrderName, name, keyVaultCertificate) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.CertificateOrdersClient", "UpdateCertificate", nil, "Failure preparing request") - } - - resp, err := client.UpdateCertificateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.CertificateOrdersClient", "UpdateCertificate", resp, "Failure sending request") - } - - result, err = client.UpdateCertificateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.CertificateOrdersClient", "UpdateCertificate", resp, "Failure responding to request") - } - - return -} - -// UpdateCertificatePreparer prepares the UpdateCertificate request. -func (client CertificateOrdersClient) UpdateCertificatePreparer(resourceGroupName string, certificateOrderName string, name string, keyVaultCertificate CertificateOrderCertificate) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "certificateOrderName": autorest.Encode("path", certificateOrderName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName}/certificates/{name}", pathParameters), - autorest.WithJSON(keyVaultCertificate), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// UpdateCertificateSender sends the UpdateCertificate request. The method will close the -// http.Response Body if it receives an error. -func (client CertificateOrdersClient) UpdateCertificateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// UpdateCertificateResponder handles the response to the UpdateCertificate request. The method always -// closes the http.Response Body. -func (client CertificateOrdersClient) UpdateCertificateResponder(resp *http.Response) (result CertificateOrderCertificate, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// UpdateCertificateOrder sends the update certificate order request. -// -// resourceGroupName is azure resource group name name is certificate name -// certificateDistinguishedName is distinguished name to be used for purchasing -// certificate -func (client CertificateOrdersClient) UpdateCertificateOrder(resourceGroupName string, name string, certificateDistinguishedName CertificateOrder) (result CertificateOrder, err error) { - req, err := client.UpdateCertificateOrderPreparer(resourceGroupName, name, certificateDistinguishedName) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.CertificateOrdersClient", "UpdateCertificateOrder", nil, "Failure preparing request") - } - - resp, err := client.UpdateCertificateOrderSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.CertificateOrdersClient", "UpdateCertificateOrder", resp, "Failure sending request") - } - - result, err = client.UpdateCertificateOrderResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.CertificateOrdersClient", "UpdateCertificateOrder", resp, "Failure responding to request") - } - - return -} - -// UpdateCertificateOrderPreparer prepares the UpdateCertificateOrder request. -func (client CertificateOrdersClient) UpdateCertificateOrderPreparer(resourceGroupName string, name string, certificateDistinguishedName CertificateOrder) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{name}", pathParameters), - autorest.WithJSON(certificateDistinguishedName), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// UpdateCertificateOrderSender sends the UpdateCertificateOrder request. The method will close the -// http.Response Body if it receives an error. -func (client CertificateOrdersClient) UpdateCertificateOrderSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// UpdateCertificateOrderResponder handles the response to the UpdateCertificateOrder request. The method always -// closes the http.Response Body. -func (client CertificateOrdersClient) UpdateCertificateOrderResponder(resp *http.Response) (result CertificateOrder, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// VerifyDomainOwnership sends the verify domain ownership request. -// -// resourceGroupName is azure resource group name name is certificate order -// name -func (client CertificateOrdersClient) VerifyDomainOwnership(resourceGroupName string, name string) (result SetObject, err error) { - req, err := client.VerifyDomainOwnershipPreparer(resourceGroupName, name) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.CertificateOrdersClient", "VerifyDomainOwnership", nil, "Failure preparing request") - } - - resp, err := client.VerifyDomainOwnershipSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.CertificateOrdersClient", "VerifyDomainOwnership", resp, "Failure sending request") - } - - result, err = client.VerifyDomainOwnershipResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.CertificateOrdersClient", "VerifyDomainOwnership", resp, "Failure responding to request") - } - - return -} - -// VerifyDomainOwnershipPreparer prepares the VerifyDomainOwnership request. -func (client CertificateOrdersClient) VerifyDomainOwnershipPreparer(resourceGroupName string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{name}/verifyDomainOwnership", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// VerifyDomainOwnershipSender sends the VerifyDomainOwnership request. The method will close the -// http.Response Body if it receives an error. -func (client CertificateOrdersClient) VerifyDomainOwnershipSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// VerifyDomainOwnershipResponder handles the response to the VerifyDomainOwnership request. The method always -// closes the http.Response Body. -func (client CertificateOrdersClient) VerifyDomainOwnershipResponder(resp *http.Response) (result SetObject, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Value), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/arm/web/certificates.go b/arm/web/certificates.go old mode 100644 new mode 100755 index c000941c2e80..a3934fa67014 --- a/arm/web/certificates.go +++ b/arm/web/certificates.go @@ -21,16 +21,11 @@ package web import ( "github.com/Azure/go-autorest/autorest" "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" "net/http" ) -// CertificatesClient is the use these APIs to manage Azure Websites resources -// through the Azure Resource Manager. All task operations conform to the -// HTTP/1.1 protocol specification and each operation returns an -// x-ms-request-id header that can be used to obtain information about the -// request. You must make sure that requests made to these resources are -// secure. For more information, see -// https://msdn.microsoft.com/en-us/library/azure/dn790557.aspx. +// CertificatesClient is the composite Swagger for WebSite Management Client type CertificatesClient struct { ManagementClient } @@ -46,41 +41,50 @@ func NewCertificatesClientWithBaseURI(baseURI string, subscriptionID string) Cer return CertificatesClient{NewWithBaseURI(baseURI, subscriptionID)} } -// CreateOrUpdateCertificate sends the create or update certificate request. +// CreateOrUpdate create or update a certificate. // -// resourceGroupName is name of the resource group name is name of the -// certificate. certificateEnvelope is details of certificate if it exists -// already. -func (client CertificatesClient) CreateOrUpdateCertificate(resourceGroupName string, name string, certificateEnvelope Certificate) (result Certificate, err error) { - req, err := client.CreateOrUpdateCertificatePreparer(resourceGroupName, name, certificateEnvelope) +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the certificate. certificateEnvelope is details of +// certificate, if it exists already. +func (client CertificatesClient) CreateOrUpdate(resourceGroupName string, name string, certificateEnvelope Certificate) (result Certificate, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.CertificatesClient", "CreateOrUpdate") + } + + req, err := client.CreateOrUpdatePreparer(resourceGroupName, name, certificateEnvelope) if err != nil { - return result, autorest.NewErrorWithError(err, "web.CertificatesClient", "CreateOrUpdateCertificate", nil, "Failure preparing request") + return result, autorest.NewErrorWithError(err, "web.CertificatesClient", "CreateOrUpdate", nil, "Failure preparing request") } - resp, err := client.CreateOrUpdateCertificateSender(req) + resp, err := client.CreateOrUpdateSender(req) if err != nil { result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.CertificatesClient", "CreateOrUpdateCertificate", resp, "Failure sending request") + return result, autorest.NewErrorWithError(err, "web.CertificatesClient", "CreateOrUpdate", resp, "Failure sending request") } - result, err = client.CreateOrUpdateCertificateResponder(resp) + result, err = client.CreateOrUpdateResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "web.CertificatesClient", "CreateOrUpdateCertificate", resp, "Failure responding to request") + err = autorest.NewErrorWithError(err, "web.CertificatesClient", "CreateOrUpdate", resp, "Failure responding to request") } return } -// CreateOrUpdateCertificatePreparer prepares the CreateOrUpdateCertificate request. -func (client CertificatesClient) CreateOrUpdateCertificatePreparer(resourceGroupName string, name string, certificateEnvelope Certificate) (*http.Request, error) { +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client CertificatesClient) CreateOrUpdatePreparer(resourceGroupName string, name string, certificateEnvelope Certificate) (*http.Request, error) { pathParameters := map[string]interface{}{ "name": autorest.Encode("path", name), "resourceGroupName": autorest.Encode("path", resourceGroupName), "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-03-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -93,15 +97,15 @@ func (client CertificatesClient) CreateOrUpdateCertificatePreparer(resourceGroup return preparer.Prepare(&http.Request{}) } -// CreateOrUpdateCertificateSender sends the CreateOrUpdateCertificate request. The method will close the +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the // http.Response Body if it receives an error. -func (client CertificatesClient) CreateOrUpdateCertificateSender(req *http.Request) (*http.Response, error) { +func (client CertificatesClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { return autorest.SendWithSender(client, req) } -// CreateOrUpdateCertificateResponder handles the response to the CreateOrUpdateCertificate request. The method always +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always // closes the http.Response Body. -func (client CertificatesClient) CreateOrUpdateCertificateResponder(resp *http.Response) (result Certificate, err error) { +func (client CertificatesClient) CreateOrUpdateResponder(resp *http.Response) (result Certificate, err error) { err = autorest.Respond( resp, client.ByInspecting(), @@ -112,41 +116,50 @@ func (client CertificatesClient) CreateOrUpdateCertificateResponder(resp *http.R return } -// CreateOrUpdateCsr sends the create or update csr request. +// CreateOrUpdateSigningRequest create or update a certificate signing request. // -// resourceGroupName is name of the resource group name is name of the -// certificate. csrEnvelope is details of certificate signing request if it -// exists already. -func (client CertificatesClient) CreateOrUpdateCsr(resourceGroupName string, name string, csrEnvelope Csr) (result Csr, err error) { - req, err := client.CreateOrUpdateCsrPreparer(resourceGroupName, name, csrEnvelope) +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the certificate signing request. csrEnvelope is +// details of certificate signing request, if it exists already. +func (client CertificatesClient) CreateOrUpdateSigningRequest(resourceGroupName string, name string, csrEnvelope Csr) (result Csr, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.CertificatesClient", "CreateOrUpdateSigningRequest") + } + + req, err := client.CreateOrUpdateSigningRequestPreparer(resourceGroupName, name, csrEnvelope) if err != nil { - return result, autorest.NewErrorWithError(err, "web.CertificatesClient", "CreateOrUpdateCsr", nil, "Failure preparing request") + return result, autorest.NewErrorWithError(err, "web.CertificatesClient", "CreateOrUpdateSigningRequest", nil, "Failure preparing request") } - resp, err := client.CreateOrUpdateCsrSender(req) + resp, err := client.CreateOrUpdateSigningRequestSender(req) if err != nil { result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.CertificatesClient", "CreateOrUpdateCsr", resp, "Failure sending request") + return result, autorest.NewErrorWithError(err, "web.CertificatesClient", "CreateOrUpdateSigningRequest", resp, "Failure sending request") } - result, err = client.CreateOrUpdateCsrResponder(resp) + result, err = client.CreateOrUpdateSigningRequestResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "web.CertificatesClient", "CreateOrUpdateCsr", resp, "Failure responding to request") + err = autorest.NewErrorWithError(err, "web.CertificatesClient", "CreateOrUpdateSigningRequest", resp, "Failure responding to request") } return } -// CreateOrUpdateCsrPreparer prepares the CreateOrUpdateCsr request. -func (client CertificatesClient) CreateOrUpdateCsrPreparer(resourceGroupName string, name string, csrEnvelope Csr) (*http.Request, error) { +// CreateOrUpdateSigningRequestPreparer prepares the CreateOrUpdateSigningRequest request. +func (client CertificatesClient) CreateOrUpdateSigningRequestPreparer(resourceGroupName string, name string, csrEnvelope Csr) (*http.Request, error) { pathParameters := map[string]interface{}{ "name": autorest.Encode("path", name), "resourceGroupName": autorest.Encode("path", resourceGroupName), "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-03-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -159,15 +172,15 @@ func (client CertificatesClient) CreateOrUpdateCsrPreparer(resourceGroupName str return preparer.Prepare(&http.Request{}) } -// CreateOrUpdateCsrSender sends the CreateOrUpdateCsr request. The method will close the +// CreateOrUpdateSigningRequestSender sends the CreateOrUpdateSigningRequest request. The method will close the // http.Response Body if it receives an error. -func (client CertificatesClient) CreateOrUpdateCsrSender(req *http.Request) (*http.Response, error) { +func (client CertificatesClient) CreateOrUpdateSigningRequestSender(req *http.Request) (*http.Response, error) { return autorest.SendWithSender(client, req) } -// CreateOrUpdateCsrResponder handles the response to the CreateOrUpdateCsr request. The method always +// CreateOrUpdateSigningRequestResponder handles the response to the CreateOrUpdateSigningRequest request. The method always // closes the http.Response Body. -func (client CertificatesClient) CreateOrUpdateCsrResponder(resp *http.Response) (result Csr, err error) { +func (client CertificatesClient) CreateOrUpdateSigningRequestResponder(resp *http.Response) (result Csr, err error) { err = autorest.Respond( resp, client.ByInspecting(), @@ -178,40 +191,49 @@ func (client CertificatesClient) CreateOrUpdateCsrResponder(resp *http.Response) return } -// DeleteCertificate sends the delete certificate request. +// Delete delete a certificate. // -// resourceGroupName is name of the resource group name is name of the -// certificate to be deleted. -func (client CertificatesClient) DeleteCertificate(resourceGroupName string, name string) (result SetObject, err error) { - req, err := client.DeleteCertificatePreparer(resourceGroupName, name) +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the certificate. +func (client CertificatesClient) Delete(resourceGroupName string, name string) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.CertificatesClient", "Delete") + } + + req, err := client.DeletePreparer(resourceGroupName, name) if err != nil { - return result, autorest.NewErrorWithError(err, "web.CertificatesClient", "DeleteCertificate", nil, "Failure preparing request") + return result, autorest.NewErrorWithError(err, "web.CertificatesClient", "Delete", nil, "Failure preparing request") } - resp, err := client.DeleteCertificateSender(req) + resp, err := client.DeleteSender(req) if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.CertificatesClient", "DeleteCertificate", resp, "Failure sending request") + result.Response = resp + return result, autorest.NewErrorWithError(err, "web.CertificatesClient", "Delete", resp, "Failure sending request") } - result, err = client.DeleteCertificateResponder(resp) + result, err = client.DeleteResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "web.CertificatesClient", "DeleteCertificate", resp, "Failure responding to request") + err = autorest.NewErrorWithError(err, "web.CertificatesClient", "Delete", resp, "Failure responding to request") } return } -// DeleteCertificatePreparer prepares the DeleteCertificate request. -func (client CertificatesClient) DeleteCertificatePreparer(resourceGroupName string, name string) (*http.Request, error) { +// DeletePreparer prepares the Delete request. +func (client CertificatesClient) DeletePreparer(resourceGroupName string, name string) (*http.Request, error) { pathParameters := map[string]interface{}{ "name": autorest.Encode("path", name), "resourceGroupName": autorest.Encode("path", resourceGroupName), "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-03-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -222,59 +244,67 @@ func (client CertificatesClient) DeleteCertificatePreparer(resourceGroupName str return preparer.Prepare(&http.Request{}) } -// DeleteCertificateSender sends the DeleteCertificate request. The method will close the +// DeleteSender sends the Delete request. The method will close the // http.Response Body if it receives an error. -func (client CertificatesClient) DeleteCertificateSender(req *http.Request) (*http.Response, error) { +func (client CertificatesClient) DeleteSender(req *http.Request) (*http.Response, error) { return autorest.SendWithSender(client, req) } -// DeleteCertificateResponder handles the response to the DeleteCertificate request. The method always +// DeleteResponder handles the response to the Delete request. The method always // closes the http.Response Body. -func (client CertificatesClient) DeleteCertificateResponder(resp *http.Response) (result SetObject, err error) { +func (client CertificatesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { err = autorest.Respond( resp, client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Value), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} + result.Response = resp return } -// DeleteCsr sends the delete csr request. +// DeleteSigningRequest delete a certificate signing request. // -// resourceGroupName is name of the resource group name is name of the -// certificate signing request. -func (client CertificatesClient) DeleteCsr(resourceGroupName string, name string) (result SetObject, err error) { - req, err := client.DeleteCsrPreparer(resourceGroupName, name) +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the certificate signing request. +func (client CertificatesClient) DeleteSigningRequest(resourceGroupName string, name string) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.CertificatesClient", "DeleteSigningRequest") + } + + req, err := client.DeleteSigningRequestPreparer(resourceGroupName, name) if err != nil { - return result, autorest.NewErrorWithError(err, "web.CertificatesClient", "DeleteCsr", nil, "Failure preparing request") + return result, autorest.NewErrorWithError(err, "web.CertificatesClient", "DeleteSigningRequest", nil, "Failure preparing request") } - resp, err := client.DeleteCsrSender(req) + resp, err := client.DeleteSigningRequestSender(req) if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.CertificatesClient", "DeleteCsr", resp, "Failure sending request") + result.Response = resp + return result, autorest.NewErrorWithError(err, "web.CertificatesClient", "DeleteSigningRequest", resp, "Failure sending request") } - result, err = client.DeleteCsrResponder(resp) + result, err = client.DeleteSigningRequestResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "web.CertificatesClient", "DeleteCsr", resp, "Failure responding to request") + err = autorest.NewErrorWithError(err, "web.CertificatesClient", "DeleteSigningRequest", resp, "Failure responding to request") } return } -// DeleteCsrPreparer prepares the DeleteCsr request. -func (client CertificatesClient) DeleteCsrPreparer(resourceGroupName string, name string) (*http.Request, error) { +// DeleteSigningRequestPreparer prepares the DeleteSigningRequest request. +func (client CertificatesClient) DeleteSigningRequestPreparer(resourceGroupName string, name string) (*http.Request, error) { pathParameters := map[string]interface{}{ "name": autorest.Encode("path", name), "resourceGroupName": autorest.Encode("path", resourceGroupName), "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-03-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -285,59 +315,67 @@ func (client CertificatesClient) DeleteCsrPreparer(resourceGroupName string, nam return preparer.Prepare(&http.Request{}) } -// DeleteCsrSender sends the DeleteCsr request. The method will close the +// DeleteSigningRequestSender sends the DeleteSigningRequest request. The method will close the // http.Response Body if it receives an error. -func (client CertificatesClient) DeleteCsrSender(req *http.Request) (*http.Response, error) { +func (client CertificatesClient) DeleteSigningRequestSender(req *http.Request) (*http.Response, error) { return autorest.SendWithSender(client, req) } -// DeleteCsrResponder handles the response to the DeleteCsr request. The method always +// DeleteSigningRequestResponder handles the response to the DeleteSigningRequest request. The method always // closes the http.Response Body. -func (client CertificatesClient) DeleteCsrResponder(resp *http.Response) (result SetObject, err error) { +func (client CertificatesClient) DeleteSigningRequestResponder(resp *http.Response) (result autorest.Response, err error) { err = autorest.Respond( resp, client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Value), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} + result.Response = resp return } -// GetCertificate sends the get certificate request. +// Get get a certificate. // -// resourceGroupName is name of the resource group name is name of the -// certificate. -func (client CertificatesClient) GetCertificate(resourceGroupName string, name string) (result Certificate, err error) { - req, err := client.GetCertificatePreparer(resourceGroupName, name) +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the certificate. +func (client CertificatesClient) Get(resourceGroupName string, name string) (result Certificate, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.CertificatesClient", "Get") + } + + req, err := client.GetPreparer(resourceGroupName, name) if err != nil { - return result, autorest.NewErrorWithError(err, "web.CertificatesClient", "GetCertificate", nil, "Failure preparing request") + return result, autorest.NewErrorWithError(err, "web.CertificatesClient", "Get", nil, "Failure preparing request") } - resp, err := client.GetCertificateSender(req) + resp, err := client.GetSender(req) if err != nil { result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.CertificatesClient", "GetCertificate", resp, "Failure sending request") + return result, autorest.NewErrorWithError(err, "web.CertificatesClient", "Get", resp, "Failure sending request") } - result, err = client.GetCertificateResponder(resp) + result, err = client.GetResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "web.CertificatesClient", "GetCertificate", resp, "Failure responding to request") + err = autorest.NewErrorWithError(err, "web.CertificatesClient", "Get", resp, "Failure responding to request") } return } -// GetCertificatePreparer prepares the GetCertificate request. -func (client CertificatesClient) GetCertificatePreparer(resourceGroupName string, name string) (*http.Request, error) { +// GetPreparer prepares the Get request. +func (client CertificatesClient) GetPreparer(resourceGroupName string, name string) (*http.Request, error) { pathParameters := map[string]interface{}{ "name": autorest.Encode("path", name), "resourceGroupName": autorest.Encode("path", resourceGroupName), "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-03-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -348,15 +386,15 @@ func (client CertificatesClient) GetCertificatePreparer(resourceGroupName string return preparer.Prepare(&http.Request{}) } -// GetCertificateSender sends the GetCertificate request. The method will close the +// GetSender sends the Get request. The method will close the // http.Response Body if it receives an error. -func (client CertificatesClient) GetCertificateSender(req *http.Request) (*http.Response, error) { +func (client CertificatesClient) GetSender(req *http.Request) (*http.Response, error) { return autorest.SendWithSender(client, req) } -// GetCertificateResponder handles the response to the GetCertificate request. The method always +// GetResponder handles the response to the Get request. The method always // closes the http.Response Body. -func (client CertificatesClient) GetCertificateResponder(resp *http.Response) (result Certificate, err error) { +func (client CertificatesClient) GetResponder(resp *http.Response) (result Certificate, err error) { err = autorest.Respond( resp, client.ByInspecting(), @@ -367,57 +405,68 @@ func (client CertificatesClient) GetCertificateResponder(resp *http.Response) (r return } -// GetCertificates sends the get certificates request. +// GetSigningRequest get a certificate signing request. // -// resourceGroupName is name of the resource group -func (client CertificatesClient) GetCertificates(resourceGroupName string) (result CertificateCollection, err error) { - req, err := client.GetCertificatesPreparer(resourceGroupName) +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the certificate signing request. +func (client CertificatesClient) GetSigningRequest(resourceGroupName string, name string) (result Csr, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.CertificatesClient", "GetSigningRequest") + } + + req, err := client.GetSigningRequestPreparer(resourceGroupName, name) if err != nil { - return result, autorest.NewErrorWithError(err, "web.CertificatesClient", "GetCertificates", nil, "Failure preparing request") + return result, autorest.NewErrorWithError(err, "web.CertificatesClient", "GetSigningRequest", nil, "Failure preparing request") } - resp, err := client.GetCertificatesSender(req) + resp, err := client.GetSigningRequestSender(req) if err != nil { result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.CertificatesClient", "GetCertificates", resp, "Failure sending request") + return result, autorest.NewErrorWithError(err, "web.CertificatesClient", "GetSigningRequest", resp, "Failure sending request") } - result, err = client.GetCertificatesResponder(resp) + result, err = client.GetSigningRequestResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "web.CertificatesClient", "GetCertificates", resp, "Failure responding to request") + err = autorest.NewErrorWithError(err, "web.CertificatesClient", "GetSigningRequest", resp, "Failure responding to request") } return } -// GetCertificatesPreparer prepares the GetCertificates request. -func (client CertificatesClient) GetCertificatesPreparer(resourceGroupName string) (*http.Request, error) { +// GetSigningRequestPreparer prepares the GetSigningRequest request. +func (client CertificatesClient) GetSigningRequestPreparer(resourceGroupName string, name string) (*http.Request, error) { pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), "resourceGroupName": autorest.Encode("path", resourceGroupName), "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-03-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/certificates", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/csrs/{name}", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare(&http.Request{}) } -// GetCertificatesSender sends the GetCertificates request. The method will close the +// GetSigningRequestSender sends the GetSigningRequest request. The method will close the // http.Response Body if it receives an error. -func (client CertificatesClient) GetCertificatesSender(req *http.Request) (*http.Response, error) { +func (client CertificatesClient) GetSigningRequestSender(req *http.Request) (*http.Response, error) { return autorest.SendWithSender(client, req) } -// GetCertificatesResponder handles the response to the GetCertificates request. The method always +// GetSigningRequestResponder handles the response to the GetSigningRequest request. The method always // closes the http.Response Body. -func (client CertificatesClient) GetCertificatesResponder(resp *http.Response) (result CertificateCollection, err error) { +func (client CertificatesClient) GetSigningRequestResponder(resp *http.Response) (result Csr, err error) { err = autorest.Respond( resp, client.ByInspecting(), @@ -428,83 +477,150 @@ func (client CertificatesClient) GetCertificatesResponder(resp *http.Response) ( return } -// GetCertificatesNextResults retrieves the next set of results, if any. -func (client CertificatesClient) GetCertificatesNextResults(lastResults CertificateCollection) (result CertificateCollection, err error) { +// List get all certificates for a subscription. +func (client CertificatesClient) List() (result CertificateCollection, err error) { + req, err := client.ListPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "web.CertificatesClient", "List", nil, "Failure preparing request") + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.CertificatesClient", "List", resp, "Failure sending request") + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.CertificatesClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client CertificatesClient) ListPreparer() (*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.Web/certificates", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client CertificatesClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client CertificatesClient) ListResponder(resp *http.Response) (result CertificateCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + 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 CertificatesClient) ListNextResults(lastResults CertificateCollection) (result CertificateCollection, err error) { req, err := lastResults.CertificateCollectionPreparer() if err != nil { - return result, autorest.NewErrorWithError(err, "web.CertificatesClient", "GetCertificates", nil, "Failure preparing next results request") + return result, autorest.NewErrorWithError(err, "web.CertificatesClient", "List", nil, "Failure preparing next results request") } if req == nil { return } - resp, err := client.GetCertificatesSender(req) + resp, err := client.ListSender(req) if err != nil { result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.CertificatesClient", "GetCertificates", resp, "Failure sending next results request") + return result, autorest.NewErrorWithError(err, "web.CertificatesClient", "List", resp, "Failure sending next results request") } - result, err = client.GetCertificatesResponder(resp) + result, err = client.ListResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "web.CertificatesClient", "GetCertificates", resp, "Failure responding to next results request") + err = autorest.NewErrorWithError(err, "web.CertificatesClient", "List", resp, "Failure responding to next results request") } return } -// GetCsr sends the get csr request. +// ListByResourceGroup get all certificates in a resource group. // -// resourceGroupName is name of the resource group name is name of the -// certificate. -func (client CertificatesClient) GetCsr(resourceGroupName string, name string) (result Csr, err error) { - req, err := client.GetCsrPreparer(resourceGroupName, name) +// resourceGroupName is name of the resource group to which the resource +// belongs. +func (client CertificatesClient) ListByResourceGroup(resourceGroupName string) (result CertificateCollection, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.CertificatesClient", "ListByResourceGroup") + } + + req, err := client.ListByResourceGroupPreparer(resourceGroupName) if err != nil { - return result, autorest.NewErrorWithError(err, "web.CertificatesClient", "GetCsr", nil, "Failure preparing request") + return result, autorest.NewErrorWithError(err, "web.CertificatesClient", "ListByResourceGroup", nil, "Failure preparing request") } - resp, err := client.GetCsrSender(req) + resp, err := client.ListByResourceGroupSender(req) if err != nil { result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.CertificatesClient", "GetCsr", resp, "Failure sending request") + return result, autorest.NewErrorWithError(err, "web.CertificatesClient", "ListByResourceGroup", resp, "Failure sending request") } - result, err = client.GetCsrResponder(resp) + result, err = client.ListByResourceGroupResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "web.CertificatesClient", "GetCsr", resp, "Failure responding to request") + err = autorest.NewErrorWithError(err, "web.CertificatesClient", "ListByResourceGroup", resp, "Failure responding to request") } return } -// GetCsrPreparer prepares the GetCsr request. -func (client CertificatesClient) GetCsrPreparer(resourceGroupName string, name string) (*http.Request, error) { +// ListByResourceGroupPreparer prepares the ListByResourceGroup request. +func (client CertificatesClient) ListByResourceGroupPreparer(resourceGroupName string) (*http.Request, error) { pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), "resourceGroupName": autorest.Encode("path", resourceGroupName), "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-03-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/csrs/{name}", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/certificates", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare(&http.Request{}) } -// GetCsrSender sends the GetCsr request. The method will close the +// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the // http.Response Body if it receives an error. -func (client CertificatesClient) GetCsrSender(req *http.Request) (*http.Response, error) { +func (client CertificatesClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { return autorest.SendWithSender(client, req) } -// GetCsrResponder handles the response to the GetCsr request. The method always +// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always // closes the http.Response Body. -func (client CertificatesClient) GetCsrResponder(resp *http.Response) (result Csr, err error) { +func (client CertificatesClient) ListByResourceGroupResponder(resp *http.Response) (result CertificateCollection, err error) { err = autorest.Respond( resp, client.ByInspecting(), @@ -515,38 +631,73 @@ func (client CertificatesClient) GetCsrResponder(resp *http.Response) (result Cs return } -// GetCsrs sends the get csrs request. +// ListByResourceGroupNextResults retrieves the next set of results, if any. +func (client CertificatesClient) ListByResourceGroupNextResults(lastResults CertificateCollection) (result CertificateCollection, err error) { + req, err := lastResults.CertificateCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "web.CertificatesClient", "ListByResourceGroup", 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, "web.CertificatesClient", "ListByResourceGroup", resp, "Failure sending next results request") + } + + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.CertificatesClient", "ListByResourceGroup", resp, "Failure responding to next results request") + } + + return +} + +// ListSigningRequestByResourceGroup get all certificate signing requests in a +// resource group. // -// resourceGroupName is name of the resource group -func (client CertificatesClient) GetCsrs(resourceGroupName string) (result ListCsr, err error) { - req, err := client.GetCsrsPreparer(resourceGroupName) +// resourceGroupName is name of the resource group to which the resource +// belongs. +func (client CertificatesClient) ListSigningRequestByResourceGroup(resourceGroupName string) (result CsrCollection, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.CertificatesClient", "ListSigningRequestByResourceGroup") + } + + req, err := client.ListSigningRequestByResourceGroupPreparer(resourceGroupName) if err != nil { - return result, autorest.NewErrorWithError(err, "web.CertificatesClient", "GetCsrs", nil, "Failure preparing request") + return result, autorest.NewErrorWithError(err, "web.CertificatesClient", "ListSigningRequestByResourceGroup", nil, "Failure preparing request") } - resp, err := client.GetCsrsSender(req) + resp, err := client.ListSigningRequestByResourceGroupSender(req) if err != nil { result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.CertificatesClient", "GetCsrs", resp, "Failure sending request") + return result, autorest.NewErrorWithError(err, "web.CertificatesClient", "ListSigningRequestByResourceGroup", resp, "Failure sending request") } - result, err = client.GetCsrsResponder(resp) + result, err = client.ListSigningRequestByResourceGroupResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "web.CertificatesClient", "GetCsrs", resp, "Failure responding to request") + err = autorest.NewErrorWithError(err, "web.CertificatesClient", "ListSigningRequestByResourceGroup", resp, "Failure responding to request") } return } -// GetCsrsPreparer prepares the GetCsrs request. -func (client CertificatesClient) GetCsrsPreparer(resourceGroupName string) (*http.Request, error) { +// ListSigningRequestByResourceGroupPreparer prepares the ListSigningRequestByResourceGroup request. +func (client CertificatesClient) ListSigningRequestByResourceGroupPreparer(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": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -557,60 +708,93 @@ func (client CertificatesClient) GetCsrsPreparer(resourceGroupName string) (*htt return preparer.Prepare(&http.Request{}) } -// GetCsrsSender sends the GetCsrs request. The method will close the +// ListSigningRequestByResourceGroupSender sends the ListSigningRequestByResourceGroup request. The method will close the // http.Response Body if it receives an error. -func (client CertificatesClient) GetCsrsSender(req *http.Request) (*http.Response, error) { +func (client CertificatesClient) ListSigningRequestByResourceGroupSender(req *http.Request) (*http.Response, error) { return autorest.SendWithSender(client, req) } -// GetCsrsResponder handles the response to the GetCsrs request. The method always +// ListSigningRequestByResourceGroupResponder handles the response to the ListSigningRequestByResourceGroup request. The method always // closes the http.Response Body. -func (client CertificatesClient) GetCsrsResponder(resp *http.Response) (result ListCsr, err error) { +func (client CertificatesClient) ListSigningRequestByResourceGroupResponder(resp *http.Response) (result CsrCollection, err error) { err = autorest.Respond( resp, client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) result.Response = autorest.Response{Response: resp} return } -// UpdateCertificate sends the update certificate request. +// ListSigningRequestByResourceGroupNextResults retrieves the next set of results, if any. +func (client CertificatesClient) ListSigningRequestByResourceGroupNextResults(lastResults CsrCollection) (result CsrCollection, err error) { + req, err := lastResults.CsrCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "web.CertificatesClient", "ListSigningRequestByResourceGroup", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListSigningRequestByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.CertificatesClient", "ListSigningRequestByResourceGroup", resp, "Failure sending next results request") + } + + result, err = client.ListSigningRequestByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.CertificatesClient", "ListSigningRequestByResourceGroup", resp, "Failure responding to next results request") + } + + return +} + +// Update create or update a certificate. // -// resourceGroupName is name of the resource group name is name of the -// certificate. certificateEnvelope is details of certificate if it exists -// already. -func (client CertificatesClient) UpdateCertificate(resourceGroupName string, name string, certificateEnvelope Certificate) (result Certificate, err error) { - req, err := client.UpdateCertificatePreparer(resourceGroupName, name, certificateEnvelope) +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the certificate. certificateEnvelope is details of +// certificate, if it exists already. +func (client CertificatesClient) Update(resourceGroupName string, name string, certificateEnvelope Certificate) (result Certificate, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.CertificatesClient", "Update") + } + + req, err := client.UpdatePreparer(resourceGroupName, name, certificateEnvelope) if err != nil { - return result, autorest.NewErrorWithError(err, "web.CertificatesClient", "UpdateCertificate", nil, "Failure preparing request") + return result, autorest.NewErrorWithError(err, "web.CertificatesClient", "Update", nil, "Failure preparing request") } - resp, err := client.UpdateCertificateSender(req) + resp, err := client.UpdateSender(req) if err != nil { result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.CertificatesClient", "UpdateCertificate", resp, "Failure sending request") + return result, autorest.NewErrorWithError(err, "web.CertificatesClient", "Update", resp, "Failure sending request") } - result, err = client.UpdateCertificateResponder(resp) + result, err = client.UpdateResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "web.CertificatesClient", "UpdateCertificate", resp, "Failure responding to request") + err = autorest.NewErrorWithError(err, "web.CertificatesClient", "Update", resp, "Failure responding to request") } return } -// UpdateCertificatePreparer prepares the UpdateCertificate request. -func (client CertificatesClient) UpdateCertificatePreparer(resourceGroupName string, name string, certificateEnvelope Certificate) (*http.Request, error) { +// UpdatePreparer prepares the Update request. +func (client CertificatesClient) UpdatePreparer(resourceGroupName string, name string, certificateEnvelope Certificate) (*http.Request, error) { pathParameters := map[string]interface{}{ "name": autorest.Encode("path", name), "resourceGroupName": autorest.Encode("path", resourceGroupName), "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-03-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -623,15 +807,15 @@ func (client CertificatesClient) UpdateCertificatePreparer(resourceGroupName str return preparer.Prepare(&http.Request{}) } -// UpdateCertificateSender sends the UpdateCertificate request. The method will close the +// UpdateSender sends the Update request. The method will close the // http.Response Body if it receives an error. -func (client CertificatesClient) UpdateCertificateSender(req *http.Request) (*http.Response, error) { +func (client CertificatesClient) UpdateSender(req *http.Request) (*http.Response, error) { return autorest.SendWithSender(client, req) } -// UpdateCertificateResponder handles the response to the UpdateCertificate request. The method always +// UpdateResponder handles the response to the Update request. The method always // closes the http.Response Body. -func (client CertificatesClient) UpdateCertificateResponder(resp *http.Response) (result Certificate, err error) { +func (client CertificatesClient) UpdateResponder(resp *http.Response) (result Certificate, err error) { err = autorest.Respond( resp, client.ByInspecting(), @@ -642,41 +826,50 @@ func (client CertificatesClient) UpdateCertificateResponder(resp *http.Response) return } -// UpdateCsr sends the update csr request. +// UpdateSigningRequest create or update a certificate signing request. // -// resourceGroupName is name of the resource group name is name of the -// certificate. csrEnvelope is details of certificate signing request if it -// exists already. -func (client CertificatesClient) UpdateCsr(resourceGroupName string, name string, csrEnvelope Csr) (result Csr, err error) { - req, err := client.UpdateCsrPreparer(resourceGroupName, name, csrEnvelope) +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the certificate signing request. csrEnvelope is +// details of certificate signing request, if it exists already. +func (client CertificatesClient) UpdateSigningRequest(resourceGroupName string, name string, csrEnvelope Csr) (result Csr, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.CertificatesClient", "UpdateSigningRequest") + } + + req, err := client.UpdateSigningRequestPreparer(resourceGroupName, name, csrEnvelope) if err != nil { - return result, autorest.NewErrorWithError(err, "web.CertificatesClient", "UpdateCsr", nil, "Failure preparing request") + return result, autorest.NewErrorWithError(err, "web.CertificatesClient", "UpdateSigningRequest", nil, "Failure preparing request") } - resp, err := client.UpdateCsrSender(req) + resp, err := client.UpdateSigningRequestSender(req) if err != nil { result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.CertificatesClient", "UpdateCsr", resp, "Failure sending request") + return result, autorest.NewErrorWithError(err, "web.CertificatesClient", "UpdateSigningRequest", resp, "Failure sending request") } - result, err = client.UpdateCsrResponder(resp) + result, err = client.UpdateSigningRequestResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "web.CertificatesClient", "UpdateCsr", resp, "Failure responding to request") + err = autorest.NewErrorWithError(err, "web.CertificatesClient", "UpdateSigningRequest", resp, "Failure responding to request") } return } -// UpdateCsrPreparer prepares the UpdateCsr request. -func (client CertificatesClient) UpdateCsrPreparer(resourceGroupName string, name string, csrEnvelope Csr) (*http.Request, error) { +// UpdateSigningRequestPreparer prepares the UpdateSigningRequest request. +func (client CertificatesClient) UpdateSigningRequestPreparer(resourceGroupName string, name string, csrEnvelope Csr) (*http.Request, error) { pathParameters := map[string]interface{}{ "name": autorest.Encode("path", name), "resourceGroupName": autorest.Encode("path", resourceGroupName), "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-03-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -689,15 +882,15 @@ func (client CertificatesClient) UpdateCsrPreparer(resourceGroupName string, nam return preparer.Prepare(&http.Request{}) } -// UpdateCsrSender sends the UpdateCsr request. The method will close the +// UpdateSigningRequestSender sends the UpdateSigningRequest request. The method will close the // http.Response Body if it receives an error. -func (client CertificatesClient) UpdateCsrSender(req *http.Request) (*http.Response, error) { +func (client CertificatesClient) UpdateSigningRequestSender(req *http.Request) (*http.Response, error) { return autorest.SendWithSender(client, req) } -// UpdateCsrResponder handles the response to the UpdateCsr request. The method always +// UpdateSigningRequestResponder handles the response to the UpdateSigningRequest request. The method always // closes the http.Response Body. -func (client CertificatesClient) UpdateCsrResponder(resp *http.Response) (result Csr, err error) { +func (client CertificatesClient) UpdateSigningRequestResponder(resp *http.Response) (result Csr, err error) { err = autorest.Respond( resp, client.ByInspecting(), diff --git a/arm/web/classicmobileservices.go b/arm/web/classicmobileservices.go deleted file mode 100644 index af206cc36493..000000000000 --- a/arm/web/classicmobileservices.go +++ /dev/null @@ -1,257 +0,0 @@ -package web - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// -// See the License for the specific language governing permissions and -// limitations under the License. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// 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/azure" - "net/http" -) - -// ClassicMobileServicesClient is the use these APIs to manage Azure Websites -// resources through the Azure Resource Manager. All task operations conform to -// the HTTP/1.1 protocol specification and each operation returns an -// x-ms-request-id header that can be used to obtain information about the -// request. You must make sure that requests made to these resources are -// secure. For more information, see -// https://msdn.microsoft.com/en-us/library/azure/dn790557.aspx. -type ClassicMobileServicesClient struct { - ManagementClient -} - -// NewClassicMobileServicesClient creates an instance of the -// ClassicMobileServicesClient client. -func NewClassicMobileServicesClient(subscriptionID string) ClassicMobileServicesClient { - return NewClassicMobileServicesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewClassicMobileServicesClientWithBaseURI creates an instance of the -// ClassicMobileServicesClient client. -func NewClassicMobileServicesClientWithBaseURI(baseURI string, subscriptionID string) ClassicMobileServicesClient { - return ClassicMobileServicesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// DeleteClassicMobileService sends the delete classic mobile service request. -// -// resourceGroupName is name of resource group name is name of mobile service -func (client ClassicMobileServicesClient) DeleteClassicMobileService(resourceGroupName string, name string) (result SetObject, err error) { - req, err := client.DeleteClassicMobileServicePreparer(resourceGroupName, name) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.ClassicMobileServicesClient", "DeleteClassicMobileService", nil, "Failure preparing request") - } - - resp, err := client.DeleteClassicMobileServiceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.ClassicMobileServicesClient", "DeleteClassicMobileService", resp, "Failure sending request") - } - - result, err = client.DeleteClassicMobileServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.ClassicMobileServicesClient", "DeleteClassicMobileService", resp, "Failure responding to request") - } - - return -} - -// DeleteClassicMobileServicePreparer prepares the DeleteClassicMobileService request. -func (client ClassicMobileServicesClient) DeleteClassicMobileServicePreparer(resourceGroupName string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/classicMobileServices/{name}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// DeleteClassicMobileServiceSender sends the DeleteClassicMobileService request. The method will close the -// http.Response Body if it receives an error. -func (client ClassicMobileServicesClient) DeleteClassicMobileServiceSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DeleteClassicMobileServiceResponder handles the response to the DeleteClassicMobileService request. The method always -// closes the http.Response Body. -func (client ClassicMobileServicesClient) DeleteClassicMobileServiceResponder(resp *http.Response) (result SetObject, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Value), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetClassicMobileService sends the get classic mobile service request. -// -// resourceGroupName is name of resource group name is name of mobile service -func (client ClassicMobileServicesClient) GetClassicMobileService(resourceGroupName string, name string) (result ClassicMobileService, err error) { - req, err := client.GetClassicMobileServicePreparer(resourceGroupName, name) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.ClassicMobileServicesClient", "GetClassicMobileService", nil, "Failure preparing request") - } - - resp, err := client.GetClassicMobileServiceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.ClassicMobileServicesClient", "GetClassicMobileService", resp, "Failure sending request") - } - - result, err = client.GetClassicMobileServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.ClassicMobileServicesClient", "GetClassicMobileService", resp, "Failure responding to request") - } - - return -} - -// GetClassicMobileServicePreparer prepares the GetClassicMobileService request. -func (client ClassicMobileServicesClient) GetClassicMobileServicePreparer(resourceGroupName string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/classicMobileServices/{name}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetClassicMobileServiceSender sends the GetClassicMobileService request. The method will close the -// http.Response Body if it receives an error. -func (client ClassicMobileServicesClient) GetClassicMobileServiceSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetClassicMobileServiceResponder handles the response to the GetClassicMobileService request. The method always -// closes the http.Response Body. -func (client ClassicMobileServicesClient) GetClassicMobileServiceResponder(resp *http.Response) (result ClassicMobileService, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetClassicMobileServices sends the get classic mobile services request. -// -// resourceGroupName is name of resource group -func (client ClassicMobileServicesClient) GetClassicMobileServices(resourceGroupName string) (result ClassicMobileServiceCollection, err error) { - req, err := client.GetClassicMobileServicesPreparer(resourceGroupName) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.ClassicMobileServicesClient", "GetClassicMobileServices", nil, "Failure preparing request") - } - - resp, err := client.GetClassicMobileServicesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.ClassicMobileServicesClient", "GetClassicMobileServices", resp, "Failure sending request") - } - - result, err = client.GetClassicMobileServicesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.ClassicMobileServicesClient", "GetClassicMobileServices", resp, "Failure responding to request") - } - - return -} - -// GetClassicMobileServicesPreparer prepares the GetClassicMobileServices request. -func (client ClassicMobileServicesClient) GetClassicMobileServicesPreparer(resourceGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/classicMobileServices", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetClassicMobileServicesSender sends the GetClassicMobileServices request. The method will close the -// http.Response Body if it receives an error. -func (client ClassicMobileServicesClient) GetClassicMobileServicesSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetClassicMobileServicesResponder handles the response to the GetClassicMobileServices request. The method always -// closes the http.Response Body. -func (client ClassicMobileServicesClient) GetClassicMobileServicesResponder(resp *http.Response) (result ClassicMobileServiceCollection, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetClassicMobileServicesNextResults retrieves the next set of results, if any. -func (client ClassicMobileServicesClient) GetClassicMobileServicesNextResults(lastResults ClassicMobileServiceCollection) (result ClassicMobileServiceCollection, err error) { - req, err := lastResults.ClassicMobileServiceCollectionPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "web.ClassicMobileServicesClient", "GetClassicMobileServices", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.GetClassicMobileServicesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.ClassicMobileServicesClient", "GetClassicMobileServices", resp, "Failure sending next results request") - } - - result, err = client.GetClassicMobileServicesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.ClassicMobileServicesClient", "GetClassicMobileServices", resp, "Failure responding to next results request") - } - - return -} diff --git a/arm/web/client.go b/arm/web/client.go old mode 100644 new mode 100755 index 3505b16675f6..c51232c0880d --- a/arm/web/client.go +++ b/arm/web/client.go @@ -1,11 +1,6 @@ -// Package web implements the Azure ARM Web service API version 2015-08-01. -// -// Use these APIs to manage Azure Websites resources through the Azure Resource -// Manager. All task operations conform to the HTTP/1.1 protocol specification -// and each operation returns an x-ms-request-id header that can be used to -// obtain information about the request. You must make sure that requests made -// to these resources are secure. For more information, see -// https://msdn.microsoft.com/en-us/library/azure/dn790557.aspx. +// Package web implements the Azure ARM Web service API version . +// +// Composite Swagger for WebSite Management Client package web // Copyright (c) Microsoft and contributors. All rights reserved. @@ -28,12 +23,12 @@ package web import ( "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" ) const ( - // APIVersion is the version of the Web - APIVersion = "2015-08-01" - // DefaultBaseURI is the default URI used for the service Web DefaultBaseURI = "https://management.azure.com" ) @@ -42,7 +37,6 @@ const ( type ManagementClient struct { autorest.Client BaseURI string - APIVersion string SubscriptionID string } @@ -56,7 +50,805 @@ func NewWithBaseURI(baseURI string, subscriptionID string) ManagementClient { return ManagementClient{ Client: autorest.NewClientWithUserAgent(UserAgent()), BaseURI: baseURI, - APIVersion: APIVersion, SubscriptionID: subscriptionID, } } + +// CheckNameAvailability check if a resource name is available. +// +// request is name availability request. +func (client ManagementClient) CheckNameAvailability(request ResourceNameAvailabilityRequest) (result ResourceNameAvailability, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: request, + Constraints: []validation.Constraint{{Target: "request.Name", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.ManagementClient", "CheckNameAvailability") + } + + req, err := client.CheckNameAvailabilityPreparer(request) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.ManagementClient", "CheckNameAvailability", nil, "Failure preparing request") + } + + resp, err := client.CheckNameAvailabilitySender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.ManagementClient", "CheckNameAvailability", resp, "Failure sending request") + } + + result, err = client.CheckNameAvailabilityResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.ManagementClient", "CheckNameAvailability", resp, "Failure responding to request") + } + + return +} + +// CheckNameAvailabilityPreparer prepares the CheckNameAvailability request. +func (client ManagementClient) CheckNameAvailabilityPreparer(request ResourceNameAvailabilityRequest) (*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.AsJSON(), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Web/checknameavailability", pathParameters), + autorest.WithJSON(request), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CheckNameAvailabilitySender sends the CheckNameAvailability request. The method will close the +// http.Response Body if it receives an error. +func (client ManagementClient) CheckNameAvailabilitySender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CheckNameAvailabilityResponder handles the response to the CheckNameAvailability request. The method always +// closes the http.Response Body. +func (client ManagementClient) CheckNameAvailabilityResponder(resp *http.Response) (result ResourceNameAvailability, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetPublishingUser gets publishing user +func (client ManagementClient) GetPublishingUser() (result User, err error) { + req, err := client.GetPublishingUserPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "web.ManagementClient", "GetPublishingUser", nil, "Failure preparing request") + } + + resp, err := client.GetPublishingUserSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.ManagementClient", "GetPublishingUser", resp, "Failure sending request") + } + + result, err = client.GetPublishingUserResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.ManagementClient", "GetPublishingUser", resp, "Failure responding to request") + } + + return +} + +// GetPublishingUserPreparer prepares the GetPublishingUser request. +func (client ManagementClient) GetPublishingUserPreparer() (*http.Request, error) { + const APIVersion = "2016-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPath("/providers/Microsoft.Web/publishingUsers/web"), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetPublishingUserSender sends the GetPublishingUser request. The method will close the +// http.Response Body if it receives an error. +func (client ManagementClient) GetPublishingUserSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetPublishingUserResponder handles the response to the GetPublishingUser request. The method always +// closes the http.Response Body. +func (client ManagementClient) GetPublishingUserResponder(resp *http.Response) (result User, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListGeoRegions get a list of available geographical regions. +// +// sku is name of SKU used to filter the regions. linuxWorkersEnabled is +// specify true if you want to filter to only regions that support +// Linux workers. +func (client ManagementClient) ListGeoRegions(sku SkuName, linuxWorkersEnabled *bool) (result GeoRegionCollection, err error) { + req, err := client.ListGeoRegionsPreparer(sku, linuxWorkersEnabled) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.ManagementClient", "ListGeoRegions", nil, "Failure preparing request") + } + + resp, err := client.ListGeoRegionsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.ManagementClient", "ListGeoRegions", resp, "Failure sending request") + } + + result, err = client.ListGeoRegionsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.ManagementClient", "ListGeoRegions", resp, "Failure responding to request") + } + + return +} + +// ListGeoRegionsPreparer prepares the ListGeoRegions request. +func (client ManagementClient) ListGeoRegionsPreparer(sku SkuName, linuxWorkersEnabled *bool) (*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, + } + if len(string(sku)) > 0 { + queryParameters["sku"] = autorest.Encode("query", sku) + } + if linuxWorkersEnabled != nil { + queryParameters["linuxWorkersEnabled"] = autorest.Encode("query", *linuxWorkersEnabled) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Web/geoRegions", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListGeoRegionsSender sends the ListGeoRegions request. The method will close the +// http.Response Body if it receives an error. +func (client ManagementClient) ListGeoRegionsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListGeoRegionsResponder handles the response to the ListGeoRegions request. The method always +// closes the http.Response Body. +func (client ManagementClient) ListGeoRegionsResponder(resp *http.Response) (result GeoRegionCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListGeoRegionsNextResults retrieves the next set of results, if any. +func (client ManagementClient) ListGeoRegionsNextResults(lastResults GeoRegionCollection) (result GeoRegionCollection, err error) { + req, err := lastResults.GeoRegionCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "web.ManagementClient", "ListGeoRegions", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListGeoRegionsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.ManagementClient", "ListGeoRegions", resp, "Failure sending next results request") + } + + result, err = client.ListGeoRegionsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.ManagementClient", "ListGeoRegions", resp, "Failure responding to next results request") + } + + return +} + +// ListPremierAddOnOffers list all premier add-on offers. +func (client ManagementClient) ListPremierAddOnOffers() (result PremierAddOnOfferCollection, err error) { + req, err := client.ListPremierAddOnOffersPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "web.ManagementClient", "ListPremierAddOnOffers", nil, "Failure preparing request") + } + + resp, err := client.ListPremierAddOnOffersSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.ManagementClient", "ListPremierAddOnOffers", resp, "Failure sending request") + } + + result, err = client.ListPremierAddOnOffersResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.ManagementClient", "ListPremierAddOnOffers", resp, "Failure responding to request") + } + + return +} + +// ListPremierAddOnOffersPreparer prepares the ListPremierAddOnOffers request. +func (client ManagementClient) ListPremierAddOnOffersPreparer() (*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.Web/premieraddonoffers", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListPremierAddOnOffersSender sends the ListPremierAddOnOffers request. The method will close the +// http.Response Body if it receives an error. +func (client ManagementClient) ListPremierAddOnOffersSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListPremierAddOnOffersResponder handles the response to the ListPremierAddOnOffers request. The method always +// closes the http.Response Body. +func (client ManagementClient) ListPremierAddOnOffersResponder(resp *http.Response) (result PremierAddOnOfferCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListPremierAddOnOffersNextResults retrieves the next set of results, if any. +func (client ManagementClient) ListPremierAddOnOffersNextResults(lastResults PremierAddOnOfferCollection) (result PremierAddOnOfferCollection, err error) { + req, err := lastResults.PremierAddOnOfferCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "web.ManagementClient", "ListPremierAddOnOffers", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListPremierAddOnOffersSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.ManagementClient", "ListPremierAddOnOffers", resp, "Failure sending next results request") + } + + result, err = client.ListPremierAddOnOffersResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.ManagementClient", "ListPremierAddOnOffers", resp, "Failure responding to next results request") + } + + return +} + +// ListSkus list all SKUs. +func (client ManagementClient) ListSkus() (result SkuInfos, err error) { + req, err := client.ListSkusPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "web.ManagementClient", "ListSkus", nil, "Failure preparing request") + } + + resp, err := client.ListSkusSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.ManagementClient", "ListSkus", resp, "Failure sending request") + } + + result, err = client.ListSkusResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.ManagementClient", "ListSkus", resp, "Failure responding to request") + } + + return +} + +// ListSkusPreparer prepares the ListSkus request. +func (client ManagementClient) ListSkusPreparer() (*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.Web/skus", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSkusSender sends the ListSkus request. The method will close the +// http.Response Body if it receives an error. +func (client ManagementClient) ListSkusSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListSkusResponder handles the response to the ListSkus request. The method always +// closes the http.Response Body. +func (client ManagementClient) ListSkusResponder(resp *http.Response) (result SkuInfos, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListSourceControls gets the source controls available for Azure websites. +func (client ManagementClient) ListSourceControls() (result SourceControlCollection, err error) { + req, err := client.ListSourceControlsPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "web.ManagementClient", "ListSourceControls", nil, "Failure preparing request") + } + + resp, err := client.ListSourceControlsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.ManagementClient", "ListSourceControls", resp, "Failure sending request") + } + + result, err = client.ListSourceControlsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.ManagementClient", "ListSourceControls", resp, "Failure responding to request") + } + + return +} + +// ListSourceControlsPreparer prepares the ListSourceControls request. +func (client ManagementClient) ListSourceControlsPreparer() (*http.Request, error) { + const APIVersion = "2016-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPath("/providers/Microsoft.Web/sourcecontrols"), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSourceControlsSender sends the ListSourceControls request. The method will close the +// http.Response Body if it receives an error. +func (client ManagementClient) ListSourceControlsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListSourceControlsResponder handles the response to the ListSourceControls request. The method always +// closes the http.Response Body. +func (client ManagementClient) ListSourceControlsResponder(resp *http.Response) (result SourceControlCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListSourceControlsNextResults retrieves the next set of results, if any. +func (client ManagementClient) ListSourceControlsNextResults(lastResults SourceControlCollection) (result SourceControlCollection, err error) { + req, err := lastResults.SourceControlCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "web.ManagementClient", "ListSourceControls", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListSourceControlsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.ManagementClient", "ListSourceControls", resp, "Failure sending next results request") + } + + result, err = client.ListSourceControlsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.ManagementClient", "ListSourceControls", resp, "Failure responding to next results request") + } + + return +} + +// Move move resources between resource groups. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. moveResourceEnvelope is object that represents the resource to +// move. +func (client ManagementClient) Move(resourceGroupName string, moveResourceEnvelope CsmMoveResourceEnvelope) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}, + {TargetValue: moveResourceEnvelope, + Constraints: []validation.Constraint{{Target: "moveResourceEnvelope.TargetResourceGroup", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "moveResourceEnvelope.TargetResourceGroup", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "moveResourceEnvelope.TargetResourceGroup", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "moveResourceEnvelope.TargetResourceGroup", Name: validation.Pattern, Rule: ` ^[-\w\._\(\)]+[^\.]$`, Chain: nil}, + }}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.ManagementClient", "Move") + } + + req, err := client.MovePreparer(resourceGroupName, moveResourceEnvelope) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.ManagementClient", "Move", nil, "Failure preparing request") + } + + resp, err := client.MoveSender(req) + if err != nil { + result.Response = resp + return result, autorest.NewErrorWithError(err, "web.ManagementClient", "Move", resp, "Failure sending request") + } + + result, err = client.MoveResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.ManagementClient", "Move", resp, "Failure responding to request") + } + + return +} + +// MovePreparer prepares the Move request. +func (client ManagementClient) MovePreparer(resourceGroupName string, moveResourceEnvelope CsmMoveResourceEnvelope) (*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.AsJSON(), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/moveResources", pathParameters), + autorest.WithJSON(moveResourceEnvelope), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// MoveSender sends the Move request. The method will close the +// http.Response Body if it receives an error. +func (client ManagementClient) MoveSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// MoveResponder handles the response to the Move request. The method always +// closes the http.Response Body. +func (client ManagementClient) MoveResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// UpdatePublishingUser updates publishing user +// +// userDetails is details of publishing user +func (client ManagementClient) UpdatePublishingUser(userDetails User) (result User, err error) { + req, err := client.UpdatePublishingUserPreparer(userDetails) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.ManagementClient", "UpdatePublishingUser", nil, "Failure preparing request") + } + + resp, err := client.UpdatePublishingUserSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.ManagementClient", "UpdatePublishingUser", resp, "Failure sending request") + } + + result, err = client.UpdatePublishingUserResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.ManagementClient", "UpdatePublishingUser", resp, "Failure responding to request") + } + + return +} + +// UpdatePublishingUserPreparer prepares the UpdatePublishingUser request. +func (client ManagementClient) UpdatePublishingUserPreparer(userDetails User) (*http.Request, error) { + const APIVersion = "2016-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPath("/providers/Microsoft.Web/publishingUsers/web"), + autorest.WithJSON(userDetails), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// UpdatePublishingUserSender sends the UpdatePublishingUser request. The method will close the +// http.Response Body if it receives an error. +func (client ManagementClient) UpdatePublishingUserSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// UpdatePublishingUserResponder handles the response to the UpdatePublishingUser request. The method always +// closes the http.Response Body. +func (client ManagementClient) UpdatePublishingUserResponder(resp *http.Response) (result User, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// UpdateSourceControl updates source control token +// +// sourceControlType is type of source control requestMessage is source control +// token information +func (client ManagementClient) UpdateSourceControl(sourceControlType string, requestMessage SourceControl) (result SourceControl, err error) { + req, err := client.UpdateSourceControlPreparer(sourceControlType, requestMessage) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.ManagementClient", "UpdateSourceControl", nil, "Failure preparing request") + } + + resp, err := client.UpdateSourceControlSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.ManagementClient", "UpdateSourceControl", resp, "Failure sending request") + } + + result, err = client.UpdateSourceControlResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.ManagementClient", "UpdateSourceControl", resp, "Failure responding to request") + } + + return +} + +// UpdateSourceControlPreparer prepares the UpdateSourceControl request. +func (client ManagementClient) UpdateSourceControlPreparer(sourceControlType string, requestMessage SourceControl) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "sourceControlType": autorest.Encode("path", sourceControlType), + } + + const APIVersion = "2016-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/providers/Microsoft.Web/sourcecontrols/{sourceControlType}", pathParameters), + autorest.WithJSON(requestMessage), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// UpdateSourceControlSender sends the UpdateSourceControl request. The method will close the +// http.Response Body if it receives an error. +func (client ManagementClient) UpdateSourceControlSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// UpdateSourceControlResponder handles the response to the UpdateSourceControl request. The method always +// closes the http.Response Body. +func (client ManagementClient) UpdateSourceControlResponder(resp *http.Response) (result SourceControl, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Validate validate if a resource can be created. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. validateRequest is request with the resources to validate. +func (client ManagementClient) Validate(resourceGroupName string, validateRequest ValidateRequest) (result ValidateResponse, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}, + {TargetValue: validateRequest, + Constraints: []validation.Constraint{{Target: "validateRequest.Name", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "validateRequest.Location", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "validateRequest.ValidateProperties", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "validateRequest.ValidateProperties.Capacity", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "validateRequest.ValidateProperties.Capacity", Name: validation.InclusiveMinimum, Rule: 1, Chain: nil}}}, + }}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.ManagementClient", "Validate") + } + + req, err := client.ValidatePreparer(resourceGroupName, validateRequest) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.ManagementClient", "Validate", nil, "Failure preparing request") + } + + resp, err := client.ValidateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.ManagementClient", "Validate", resp, "Failure sending request") + } + + result, err = client.ValidateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.ManagementClient", "Validate", resp, "Failure responding to request") + } + + return +} + +// ValidatePreparer prepares the Validate request. +func (client ManagementClient) ValidatePreparer(resourceGroupName string, validateRequest ValidateRequest) (*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.AsJSON(), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/validate", pathParameters), + autorest.WithJSON(validateRequest), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ValidateSender sends the Validate request. The method will close the +// http.Response Body if it receives an error. +func (client ManagementClient) ValidateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ValidateResponder handles the response to the Validate request. The method always +// closes the http.Response Body. +func (client ManagementClient) ValidateResponder(resp *http.Response) (result ValidateResponse, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ValidateMove validate whether a resource can be moved. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. moveResourceEnvelope is object that represents the resource to +// move. +func (client ManagementClient) ValidateMove(resourceGroupName string, moveResourceEnvelope CsmMoveResourceEnvelope) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}, + {TargetValue: moveResourceEnvelope, + Constraints: []validation.Constraint{{Target: "moveResourceEnvelope.TargetResourceGroup", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "moveResourceEnvelope.TargetResourceGroup", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "moveResourceEnvelope.TargetResourceGroup", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "moveResourceEnvelope.TargetResourceGroup", Name: validation.Pattern, Rule: ` ^[-\w\._\(\)]+[^\.]$`, Chain: nil}, + }}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.ManagementClient", "ValidateMove") + } + + req, err := client.ValidateMovePreparer(resourceGroupName, moveResourceEnvelope) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.ManagementClient", "ValidateMove", nil, "Failure preparing request") + } + + resp, err := client.ValidateMoveSender(req) + if err != nil { + result.Response = resp + return result, autorest.NewErrorWithError(err, "web.ManagementClient", "ValidateMove", resp, "Failure sending request") + } + + result, err = client.ValidateMoveResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.ManagementClient", "ValidateMove", resp, "Failure responding to request") + } + + return +} + +// ValidateMovePreparer prepares the ValidateMove request. +func (client ManagementClient) ValidateMovePreparer(resourceGroupName string, moveResourceEnvelope CsmMoveResourceEnvelope) (*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.AsJSON(), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/validateMoveResources", pathParameters), + autorest.WithJSON(moveResourceEnvelope), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ValidateMoveSender sends the ValidateMove request. The method will close the +// http.Response Body if it receives an error. +func (client ManagementClient) ValidateMoveSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ValidateMoveResponder handles the response to the ValidateMove request. The method always +// closes the http.Response Body. +func (client ManagementClient) ValidateMoveResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} diff --git a/arm/web/deletedwebapps.go b/arm/web/deletedwebapps.go new file mode 100755 index 000000000000..0e34875f6bfb --- /dev/null +++ b/arm/web/deletedwebapps.go @@ -0,0 +1,221 @@ +package web + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// 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/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// DeletedWebAppsClient is the composite Swagger for WebSite Management Client +type DeletedWebAppsClient struct { + ManagementClient +} + +// NewDeletedWebAppsClient creates an instance of the DeletedWebAppsClient +// client. +func NewDeletedWebAppsClient(subscriptionID string) DeletedWebAppsClient { + return NewDeletedWebAppsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewDeletedWebAppsClientWithBaseURI creates an instance of the +// DeletedWebAppsClient client. +func NewDeletedWebAppsClientWithBaseURI(baseURI string, subscriptionID string) DeletedWebAppsClient { + return DeletedWebAppsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List get all deleted apps for a subscription. +func (client DeletedWebAppsClient) List() (result DeletedWebAppCollection, err error) { + req, err := client.ListPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "web.DeletedWebAppsClient", "List", nil, "Failure preparing request") + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.DeletedWebAppsClient", "List", resp, "Failure sending request") + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.DeletedWebAppsClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client DeletedWebAppsClient) ListPreparer() (*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.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Web/deletedSites", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client DeletedWebAppsClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client DeletedWebAppsClient) ListResponder(resp *http.Response) (result DeletedWebAppCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + 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 DeletedWebAppsClient) ListNextResults(lastResults DeletedWebAppCollection) (result DeletedWebAppCollection, err error) { + req, err := lastResults.DeletedWebAppCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "web.DeletedWebAppsClient", "List", 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, "web.DeletedWebAppsClient", "List", resp, "Failure sending next results request") + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.DeletedWebAppsClient", "List", resp, "Failure responding to next results request") + } + + return +} + +// ListByResourceGroup gets deleted web apps in subscription. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. +func (client DeletedWebAppsClient) ListByResourceGroup(resourceGroupName string) (result DeletedWebAppCollection, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.DeletedWebAppsClient", "ListByResourceGroup") + } + + req, err := client.ListByResourceGroupPreparer(resourceGroupName) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.DeletedWebAppsClient", "ListByResourceGroup", nil, "Failure preparing request") + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.DeletedWebAppsClient", "ListByResourceGroup", resp, "Failure sending request") + } + + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.DeletedWebAppsClient", "ListByResourceGroup", resp, "Failure responding to request") + } + + return +} + +// ListByResourceGroupPreparer prepares the ListByResourceGroup request. +func (client DeletedWebAppsClient) ListByResourceGroupPreparer(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.Web/deletedSites", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the +// http.Response Body if it receives an error. +func (client DeletedWebAppsClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (client DeletedWebAppsClient) ListByResourceGroupResponder(resp *http.Response) (result DeletedWebAppCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + 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 DeletedWebAppsClient) ListByResourceGroupNextResults(lastResults DeletedWebAppCollection) (result DeletedWebAppCollection, err error) { + req, err := lastResults.DeletedWebAppCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "web.DeletedWebAppsClient", "ListByResourceGroup", 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, "web.DeletedWebAppsClient", "ListByResourceGroup", resp, "Failure sending next results request") + } + + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.DeletedWebAppsClient", "ListByResourceGroup", resp, "Failure responding to next results request") + } + + return +} diff --git a/arm/web/domains.go b/arm/web/domains.go old mode 100644 new mode 100755 index da3c754fb392..3bdcba8fe2c3 --- a/arm/web/domains.go +++ b/arm/web/domains.go @@ -21,16 +21,11 @@ package web import ( "github.com/Azure/go-autorest/autorest" "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" "net/http" ) -// DomainsClient is the use these APIs to manage Azure Websites resources -// through the Azure Resource Manager. All task operations conform to the -// HTTP/1.1 protocol specification and each operation returns an -// x-ms-request-id header that can be used to obtain information about the -// request. You must make sure that requests made to these resources are -// secure. For more information, see -// https://msdn.microsoft.com/en-us/library/azure/dn790557.aspx. +// DomainsClient is the composite Swagger for WebSite Management Client type DomainsClient struct { ManagementClient } @@ -45,40 +40,173 @@ func NewDomainsClientWithBaseURI(baseURI string, subscriptionID string) DomainsC return DomainsClient{NewWithBaseURI(baseURI, subscriptionID)} } -// CreateOrUpdateDomain sends the create or update domain request. +// CheckAvailability check if a domain is available for registration. // -// resourceGroupName is >Name of the resource group domainName is name of -// the domain domain is domain registration information -func (client DomainsClient) CreateOrUpdateDomain(resourceGroupName string, domainName string, domain Domain) (result Domain, err error) { - req, err := client.CreateOrUpdateDomainPreparer(resourceGroupName, domainName, domain) +// identifier is name of the domain. +func (client DomainsClient) CheckAvailability(identifier NameIdentifier) (result DomainAvailablilityCheckResult, err error) { + req, err := client.CheckAvailabilityPreparer(identifier) if err != nil { - return result, autorest.NewErrorWithError(err, "web.DomainsClient", "CreateOrUpdateDomain", nil, "Failure preparing request") + return result, autorest.NewErrorWithError(err, "web.DomainsClient", "CheckAvailability", nil, "Failure preparing request") } - resp, err := client.CreateOrUpdateDomainSender(req) + resp, err := client.CheckAvailabilitySender(req) if err != nil { result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.DomainsClient", "CreateOrUpdateDomain", resp, "Failure sending request") + return result, autorest.NewErrorWithError(err, "web.DomainsClient", "CheckAvailability", resp, "Failure sending request") } - result, err = client.CreateOrUpdateDomainResponder(resp) + result, err = client.CheckAvailabilityResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "web.DomainsClient", "CreateOrUpdateDomain", resp, "Failure responding to request") + err = autorest.NewErrorWithError(err, "web.DomainsClient", "CheckAvailability", resp, "Failure responding to request") } return } -// CreateOrUpdateDomainPreparer prepares the CreateOrUpdateDomain request. -func (client DomainsClient) CreateOrUpdateDomainPreparer(resourceGroupName string, domainName string, domain Domain) (*http.Request, error) { +// CheckAvailabilityPreparer prepares the CheckAvailability request. +func (client DomainsClient) CheckAvailabilityPreparer(identifier NameIdentifier) (*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.AsJSON(), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.DomainRegistration/checkDomainAvailability", pathParameters), + autorest.WithJSON(identifier), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CheckAvailabilitySender sends the CheckAvailability request. The method will close the +// http.Response Body if it receives an error. +func (client DomainsClient) CheckAvailabilitySender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CheckAvailabilityResponder handles the response to the CheckAvailability request. The method always +// closes the http.Response Body. +func (client DomainsClient) CheckAvailabilityResponder(resp *http.Response) (result DomainAvailablilityCheckResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// CreateOrUpdate creates or updates a domain. This method may poll for +// completion. Polling can be canceled by passing the cancel channel argument. +// The channel will be used to cancel polling and any outstanding HTTP +// requests. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. domainName is name of the domain. domain is domain registration +// information. +func (client DomainsClient) CreateOrUpdate(resourceGroupName string, domainName string, domain Domain, cancel <-chan struct{}) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}, + {TargetValue: domainName, + Constraints: []validation.Constraint{{Target: "domainName", Name: validation.Pattern, Rule: `[a-zA-Z0-9][a-zA-Z0-9\.-]+`, Chain: nil}}}, + {TargetValue: domain, + Constraints: []validation.Constraint{{Target: "domain.DomainProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "domain.DomainProperties.ContactAdmin", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "domain.DomainProperties.ContactAdmin.AddressMailing", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "domain.DomainProperties.ContactAdmin.AddressMailing.Address1", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "domain.DomainProperties.ContactAdmin.AddressMailing.City", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "domain.DomainProperties.ContactAdmin.AddressMailing.Country", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "domain.DomainProperties.ContactAdmin.AddressMailing.PostalCode", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "domain.DomainProperties.ContactAdmin.AddressMailing.State", Name: validation.Null, Rule: true, Chain: nil}, + }}, + {Target: "domain.DomainProperties.ContactAdmin.Email", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "domain.DomainProperties.ContactAdmin.NameFirst", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "domain.DomainProperties.ContactAdmin.NameLast", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "domain.DomainProperties.ContactAdmin.Phone", Name: validation.Null, Rule: true, Chain: nil}, + }}, + {Target: "domain.DomainProperties.ContactBilling", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "domain.DomainProperties.ContactBilling.AddressMailing", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "domain.DomainProperties.ContactBilling.AddressMailing.Address1", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "domain.DomainProperties.ContactBilling.AddressMailing.City", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "domain.DomainProperties.ContactBilling.AddressMailing.Country", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "domain.DomainProperties.ContactBilling.AddressMailing.PostalCode", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "domain.DomainProperties.ContactBilling.AddressMailing.State", Name: validation.Null, Rule: true, Chain: nil}, + }}, + {Target: "domain.DomainProperties.ContactBilling.Email", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "domain.DomainProperties.ContactBilling.NameFirst", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "domain.DomainProperties.ContactBilling.NameLast", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "domain.DomainProperties.ContactBilling.Phone", Name: validation.Null, Rule: true, Chain: nil}, + }}, + {Target: "domain.DomainProperties.ContactRegistrant", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "domain.DomainProperties.ContactRegistrant.AddressMailing", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "domain.DomainProperties.ContactRegistrant.AddressMailing.Address1", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "domain.DomainProperties.ContactRegistrant.AddressMailing.City", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "domain.DomainProperties.ContactRegistrant.AddressMailing.Country", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "domain.DomainProperties.ContactRegistrant.AddressMailing.PostalCode", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "domain.DomainProperties.ContactRegistrant.AddressMailing.State", Name: validation.Null, Rule: true, Chain: nil}, + }}, + {Target: "domain.DomainProperties.ContactRegistrant.Email", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "domain.DomainProperties.ContactRegistrant.NameFirst", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "domain.DomainProperties.ContactRegistrant.NameLast", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "domain.DomainProperties.ContactRegistrant.Phone", Name: validation.Null, Rule: true, Chain: nil}, + }}, + {Target: "domain.DomainProperties.ContactTech", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "domain.DomainProperties.ContactTech.AddressMailing", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "domain.DomainProperties.ContactTech.AddressMailing.Address1", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "domain.DomainProperties.ContactTech.AddressMailing.City", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "domain.DomainProperties.ContactTech.AddressMailing.Country", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "domain.DomainProperties.ContactTech.AddressMailing.PostalCode", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "domain.DomainProperties.ContactTech.AddressMailing.State", Name: validation.Null, Rule: true, Chain: nil}, + }}, + {Target: "domain.DomainProperties.ContactTech.Email", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "domain.DomainProperties.ContactTech.NameFirst", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "domain.DomainProperties.ContactTech.NameLast", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "domain.DomainProperties.ContactTech.Phone", Name: validation.Null, Rule: true, Chain: nil}, + }}, + }}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.DomainsClient", "CreateOrUpdate") + } + + req, err := client.CreateOrUpdatePreparer(resourceGroupName, domainName, domain, cancel) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.DomainsClient", "CreateOrUpdate", nil, "Failure preparing request") + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = resp + return result, autorest.NewErrorWithError(err, "web.DomainsClient", "CreateOrUpdate", resp, "Failure sending request") + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.DomainsClient", "CreateOrUpdate", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client DomainsClient) CreateOrUpdatePreparer(resourceGroupName string, domainName string, domain Domain, cancel <-chan struct{}) (*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 = "2015-04-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -88,63 +216,152 @@ func (client DomainsClient) CreateOrUpdateDomainPreparer(resourceGroupName strin autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DomainRegistration/domains/{domainName}", pathParameters), autorest.WithJSON(domain), autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// 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) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client DomainsClient) CreateOrUpdateResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusAccepted, http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// CreateOrUpdateOwnershipIdentifier creates an ownership identifier for a +// domain or updates identifier details for an existing identifer +// +// resourceGroupName is name of the resource group to which the resource +// belongs. domainName is name of domain. name is name of identifier. +// domainOwnershipIdentifier is a JSON representation of the domain ownership +// properties. +func (client DomainsClient) CreateOrUpdateOwnershipIdentifier(resourceGroupName string, domainName string, name string, domainOwnershipIdentifier DomainOwnershipIdentifier) (result DomainOwnershipIdentifier, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.DomainsClient", "CreateOrUpdateOwnershipIdentifier") + } + + req, err := client.CreateOrUpdateOwnershipIdentifierPreparer(resourceGroupName, domainName, name, domainOwnershipIdentifier) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.DomainsClient", "CreateOrUpdateOwnershipIdentifier", nil, "Failure preparing request") + } + + resp, err := client.CreateOrUpdateOwnershipIdentifierSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.DomainsClient", "CreateOrUpdateOwnershipIdentifier", resp, "Failure sending request") + } + + result, err = client.CreateOrUpdateOwnershipIdentifierResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.DomainsClient", "CreateOrUpdateOwnershipIdentifier", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdateOwnershipIdentifierPreparer prepares the CreateOrUpdateOwnershipIdentifier request. +func (client DomainsClient) CreateOrUpdateOwnershipIdentifierPreparer(resourceGroupName string, domainName string, name string, domainOwnershipIdentifier DomainOwnershipIdentifier) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "domainName": autorest.Encode("path", domainName), + "name": autorest.Encode("path", name), + "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.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DomainRegistration/domains/{domainName}/domainOwnershipIdentifiers/{name}", pathParameters), + autorest.WithJSON(domainOwnershipIdentifier), + autorest.WithQueryParameters(queryParameters)) return preparer.Prepare(&http.Request{}) } -// CreateOrUpdateDomainSender sends the CreateOrUpdateDomain request. The method will close the +// CreateOrUpdateOwnershipIdentifierSender sends the CreateOrUpdateOwnershipIdentifier request. The method will close the // http.Response Body if it receives an error. -func (client DomainsClient) CreateOrUpdateDomainSender(req *http.Request) (*http.Response, error) { +func (client DomainsClient) CreateOrUpdateOwnershipIdentifierSender(req *http.Request) (*http.Response, error) { return autorest.SendWithSender(client, req) } -// CreateOrUpdateDomainResponder handles the response to the CreateOrUpdateDomain request. The method always +// CreateOrUpdateOwnershipIdentifierResponder handles the response to the CreateOrUpdateOwnershipIdentifier request. The method always // closes the http.Response Body. -func (client DomainsClient) CreateOrUpdateDomainResponder(resp *http.Response) (result Domain, err error) { +func (client DomainsClient) CreateOrUpdateOwnershipIdentifierResponder(resp *http.Response) (result DomainOwnershipIdentifier, err error) { err = autorest.Respond( resp, client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusAccepted, http.StatusOK), + azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) result.Response = autorest.Response{Response: resp} return } -// DeleteDomain sends the delete domain request. +// Delete delete a domain. // -// resourceGroupName is name of the resource group domainName is name of the -// domain forceHardDeleteDomain is if true then the domain will be deleted -// immediately instead of after 24 hours -func (client DomainsClient) DeleteDomain(resourceGroupName string, domainName string, forceHardDeleteDomain *bool) (result SetObject, err error) { - req, err := client.DeleteDomainPreparer(resourceGroupName, domainName, forceHardDeleteDomain) +// resourceGroupName is name of the resource group to which the resource +// belongs. domainName is name of the domain. forceHardDeleteDomain is specify +// true to delete the domain immediately. The default is +// false which deletes the domain after 24 hours. +func (client DomainsClient) Delete(resourceGroupName string, domainName string, forceHardDeleteDomain *bool) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.DomainsClient", "Delete") + } + + req, err := client.DeletePreparer(resourceGroupName, domainName, forceHardDeleteDomain) if err != nil { - return result, autorest.NewErrorWithError(err, "web.DomainsClient", "DeleteDomain", nil, "Failure preparing request") + return result, autorest.NewErrorWithError(err, "web.DomainsClient", "Delete", nil, "Failure preparing request") } - resp, err := client.DeleteDomainSender(req) + resp, err := client.DeleteSender(req) if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.DomainsClient", "DeleteDomain", resp, "Failure sending request") + result.Response = resp + return result, autorest.NewErrorWithError(err, "web.DomainsClient", "Delete", resp, "Failure sending request") } - result, err = client.DeleteDomainResponder(resp) + result, err = client.DeleteResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "web.DomainsClient", "DeleteDomain", resp, "Failure responding to request") + err = autorest.NewErrorWithError(err, "web.DomainsClient", "Delete", resp, "Failure responding to request") } return } -// DeleteDomainPreparer prepares the DeleteDomain request. -func (client DomainsClient) DeleteDomainPreparer(resourceGroupName string, domainName string, forceHardDeleteDomain *bool) (*http.Request, error) { +// DeletePreparer prepares the Delete request. +func (client DomainsClient) DeletePreparer(resourceGroupName string, domainName string, forceHardDeleteDomain *bool) (*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 = "2015-04-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } if forceHardDeleteDomain != nil { queryParameters["forceHardDeleteDomain"] = autorest.Encode("query", *forceHardDeleteDomain) @@ -158,59 +375,139 @@ func (client DomainsClient) DeleteDomainPreparer(resourceGroupName string, domai return preparer.Prepare(&http.Request{}) } -// DeleteDomainSender sends the DeleteDomain request. The method will close the +// DeleteSender sends the Delete request. The method will close the // http.Response Body if it receives an error. -func (client DomainsClient) DeleteDomainSender(req *http.Request) (*http.Response, error) { +func (client DomainsClient) DeleteSender(req *http.Request) (*http.Response, error) { return autorest.SendWithSender(client, req) } -// DeleteDomainResponder handles the response to the DeleteDomain request. The method always +// DeleteResponder handles the response to the Delete request. The method always // closes the http.Response Body. -func (client DomainsClient) DeleteDomainResponder(resp *http.Response) (result SetObject, err error) { +func (client DomainsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { err = autorest.Respond( resp, client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByUnmarshallingJSON(&result.Value), autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} + result.Response = resp return } -// GetDomain sends the get domain request. +// DeleteOwnershipIdentifier delete ownership identifier for domain // -// resourceGroupName is name of the resource group domainName is name of the -// domain -func (client DomainsClient) GetDomain(resourceGroupName string, domainName string) (result Domain, err error) { - req, err := client.GetDomainPreparer(resourceGroupName, domainName) +// resourceGroupName is name of the resource group to which the resource +// belongs. domainName is name of domain. name is name of identifier. +func (client DomainsClient) DeleteOwnershipIdentifier(resourceGroupName string, domainName string, name string) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.DomainsClient", "DeleteOwnershipIdentifier") + } + + req, err := client.DeleteOwnershipIdentifierPreparer(resourceGroupName, domainName, name) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.DomainsClient", "DeleteOwnershipIdentifier", nil, "Failure preparing request") + } + + resp, err := client.DeleteOwnershipIdentifierSender(req) + if err != nil { + result.Response = resp + return result, autorest.NewErrorWithError(err, "web.DomainsClient", "DeleteOwnershipIdentifier", resp, "Failure sending request") + } + + result, err = client.DeleteOwnershipIdentifierResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.DomainsClient", "DeleteOwnershipIdentifier", resp, "Failure responding to request") + } + + return +} + +// DeleteOwnershipIdentifierPreparer prepares the DeleteOwnershipIdentifier request. +func (client DomainsClient) DeleteOwnershipIdentifierPreparer(resourceGroupName string, domainName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "domainName": autorest.Encode("path", domainName), + "name": autorest.Encode("path", name), + "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.DomainRegistration/domains/{domainName}/domainOwnershipIdentifiers/{name}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DeleteOwnershipIdentifierSender sends the DeleteOwnershipIdentifier request. The method will close the +// http.Response Body if it receives an error. +func (client DomainsClient) DeleteOwnershipIdentifierSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteOwnershipIdentifierResponder handles the response to the DeleteOwnershipIdentifier request. The method always +// closes the http.Response Body. +func (client DomainsClient) DeleteOwnershipIdentifierResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get get a domain. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. domainName is name of the domain. +func (client DomainsClient) Get(resourceGroupName string, domainName string) (result Domain, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.DomainsClient", "Get") + } + + req, err := client.GetPreparer(resourceGroupName, domainName) if err != nil { - return result, autorest.NewErrorWithError(err, "web.DomainsClient", "GetDomain", nil, "Failure preparing request") + return result, autorest.NewErrorWithError(err, "web.DomainsClient", "Get", nil, "Failure preparing request") } - resp, err := client.GetDomainSender(req) + resp, err := client.GetSender(req) if err != nil { result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.DomainsClient", "GetDomain", resp, "Failure sending request") + return result, autorest.NewErrorWithError(err, "web.DomainsClient", "Get", resp, "Failure sending request") } - result, err = client.GetDomainResponder(resp) + result, err = client.GetResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "web.DomainsClient", "GetDomain", resp, "Failure responding to request") + err = autorest.NewErrorWithError(err, "web.DomainsClient", "Get", resp, "Failure responding to request") } return } -// GetDomainPreparer prepares the GetDomain request. -func (client DomainsClient) GetDomainPreparer(resourceGroupName string, domainName string) (*http.Request, error) { +// GetPreparer prepares the Get request. +func (client DomainsClient) GetPreparer(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 = "2015-04-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -221,15 +518,15 @@ func (client DomainsClient) GetDomainPreparer(resourceGroupName string, domainNa return preparer.Prepare(&http.Request{}) } -// GetDomainSender sends the GetDomain request. The method will close the +// GetSender sends the Get request. The method will close the // http.Response Body if it receives an error. -func (client DomainsClient) GetDomainSender(req *http.Request) (*http.Response, error) { +func (client DomainsClient) GetSender(req *http.Request) (*http.Response, error) { return autorest.SendWithSender(client, req) } -// GetDomainResponder handles the response to the GetDomain request. The method always +// GetResponder handles the response to the Get request. The method always // closes the http.Response Body. -func (client DomainsClient) GetDomainResponder(resp *http.Response) (result Domain, err error) { +func (client DomainsClient) GetResponder(resp *http.Response) (result Domain, err error) { err = autorest.Respond( resp, client.ByInspecting(), @@ -240,102 +537,264 @@ func (client DomainsClient) GetDomainResponder(resp *http.Response) (result Doma return } -// GetDomainOperation sends the get domain operation request. +// GetControlCenterSsoRequest generate a single sign-on request for the domain +// management portal. +func (client DomainsClient) GetControlCenterSsoRequest() (result DomainControlCenterSsoRequest, err error) { + req, err := client.GetControlCenterSsoRequestPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "web.DomainsClient", "GetControlCenterSsoRequest", nil, "Failure preparing request") + } + + resp, err := client.GetControlCenterSsoRequestSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.DomainsClient", "GetControlCenterSsoRequest", resp, "Failure sending request") + } + + result, err = client.GetControlCenterSsoRequestResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.DomainsClient", "GetControlCenterSsoRequest", resp, "Failure responding to request") + } + + return +} + +// GetControlCenterSsoRequestPreparer prepares the GetControlCenterSsoRequest request. +func (client DomainsClient) GetControlCenterSsoRequestPreparer() (*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.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.DomainRegistration/generateSsoRequest", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetControlCenterSsoRequestSender sends the GetControlCenterSsoRequest request. The method will close the +// http.Response Body if it receives an error. +func (client DomainsClient) GetControlCenterSsoRequestSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetControlCenterSsoRequestResponder handles the response to the GetControlCenterSsoRequest request. The method always +// closes the http.Response Body. +func (client DomainsClient) GetControlCenterSsoRequestResponder(resp *http.Response) (result DomainControlCenterSsoRequest, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetOwnershipIdentifier get ownership identifier for domain // -// resourceGroupName is name of the resource group domainName is name of the -// domain operationID is domain purchase operation Id -func (client DomainsClient) GetDomainOperation(resourceGroupName string, domainName string, operationID string) (result Domain, err error) { - req, err := client.GetDomainOperationPreparer(resourceGroupName, domainName, operationID) +// resourceGroupName is name of the resource group to which the resource +// belongs. domainName is name of domain. name is name of identifier. +func (client DomainsClient) GetOwnershipIdentifier(resourceGroupName string, domainName string, name string) (result DomainOwnershipIdentifier, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.DomainsClient", "GetOwnershipIdentifier") + } + + req, err := client.GetOwnershipIdentifierPreparer(resourceGroupName, domainName, name) if err != nil { - return result, autorest.NewErrorWithError(err, "web.DomainsClient", "GetDomainOperation", nil, "Failure preparing request") + return result, autorest.NewErrorWithError(err, "web.DomainsClient", "GetOwnershipIdentifier", nil, "Failure preparing request") } - resp, err := client.GetDomainOperationSender(req) + resp, err := client.GetOwnershipIdentifierSender(req) if err != nil { result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.DomainsClient", "GetDomainOperation", resp, "Failure sending request") + return result, autorest.NewErrorWithError(err, "web.DomainsClient", "GetOwnershipIdentifier", resp, "Failure sending request") } - result, err = client.GetDomainOperationResponder(resp) + result, err = client.GetOwnershipIdentifierResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "web.DomainsClient", "GetDomainOperation", resp, "Failure responding to request") + err = autorest.NewErrorWithError(err, "web.DomainsClient", "GetOwnershipIdentifier", resp, "Failure responding to request") } return } -// GetDomainOperationPreparer prepares the GetDomainOperation request. -func (client DomainsClient) GetDomainOperationPreparer(resourceGroupName string, domainName string, operationID string) (*http.Request, error) { +// GetOwnershipIdentifierPreparer prepares the GetOwnershipIdentifier request. +func (client DomainsClient) GetOwnershipIdentifierPreparer(resourceGroupName string, domainName string, name string) (*http.Request, error) { pathParameters := map[string]interface{}{ "domainName": autorest.Encode("path", domainName), - "operationId": autorest.Encode("path", operationID), + "name": autorest.Encode("path", name), "resourceGroupName": autorest.Encode("path", resourceGroupName), "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2015-04-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DomainRegistration/domains/{domainName}/operationresults/{operationId}", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DomainRegistration/domains/{domainName}/domainOwnershipIdentifiers/{name}", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare(&http.Request{}) } -// GetDomainOperationSender sends the GetDomainOperation request. The method will close the +// GetOwnershipIdentifierSender sends the GetOwnershipIdentifier request. The method will close the // http.Response Body if it receives an error. -func (client DomainsClient) GetDomainOperationSender(req *http.Request) (*http.Response, error) { +func (client DomainsClient) GetOwnershipIdentifierSender(req *http.Request) (*http.Response, error) { return autorest.SendWithSender(client, req) } -// GetDomainOperationResponder handles the response to the GetDomainOperation request. The method always +// GetOwnershipIdentifierResponder handles the response to the GetOwnershipIdentifier request. The method always // closes the http.Response Body. -func (client DomainsClient) GetDomainOperationResponder(resp *http.Response) (result Domain, err error) { +func (client DomainsClient) GetOwnershipIdentifierResponder(resp *http.Response) (result DomainOwnershipIdentifier, err error) { err = autorest.Respond( resp, client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusAccepted, http.StatusOK, http.StatusInternalServerError), + azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) result.Response = autorest.Response{Response: resp} return } -// GetDomains sends the get domains request. +// List get all domains in a subscription. +func (client DomainsClient) List() (result DomainCollection, err error) { + req, err := client.ListPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "web.DomainsClient", "List", nil, "Failure preparing request") + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.DomainsClient", "List", resp, "Failure sending request") + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.DomainsClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client DomainsClient) ListPreparer() (*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.DomainRegistration/domains", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client DomainsClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client DomainsClient) ListResponder(resp *http.Response) (result DomainCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + 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 DomainsClient) ListNextResults(lastResults DomainCollection) (result DomainCollection, err error) { + req, err := lastResults.DomainCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "web.DomainsClient", "List", 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, "web.DomainsClient", "List", resp, "Failure sending next results request") + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.DomainsClient", "List", resp, "Failure responding to next results request") + } + + return +} + +// ListByResourceGroup get all domains in a resource group. // -// resourceGroupName is name of the resource group -func (client DomainsClient) GetDomains(resourceGroupName string) (result DomainCollection, err error) { - req, err := client.GetDomainsPreparer(resourceGroupName) +// resourceGroupName is name of the resource group to which the resource +// belongs. +func (client DomainsClient) ListByResourceGroup(resourceGroupName string) (result DomainCollection, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.DomainsClient", "ListByResourceGroup") + } + + req, err := client.ListByResourceGroupPreparer(resourceGroupName) if err != nil { - return result, autorest.NewErrorWithError(err, "web.DomainsClient", "GetDomains", nil, "Failure preparing request") + return result, autorest.NewErrorWithError(err, "web.DomainsClient", "ListByResourceGroup", nil, "Failure preparing request") } - resp, err := client.GetDomainsSender(req) + resp, err := client.ListByResourceGroupSender(req) if err != nil { result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.DomainsClient", "GetDomains", resp, "Failure sending request") + return result, autorest.NewErrorWithError(err, "web.DomainsClient", "ListByResourceGroup", resp, "Failure sending request") } - result, err = client.GetDomainsResponder(resp) + result, err = client.ListByResourceGroupResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "web.DomainsClient", "GetDomains", resp, "Failure responding to request") + err = autorest.NewErrorWithError(err, "web.DomainsClient", "ListByResourceGroup", resp, "Failure responding to request") } return } -// GetDomainsPreparer prepares the GetDomains request. -func (client DomainsClient) GetDomainsPreparer(resourceGroupName string) (*http.Request, error) { +// ListByResourceGroupPreparer prepares the ListByResourceGroup request. +func (client DomainsClient) ListByResourceGroupPreparer(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": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -346,15 +805,15 @@ func (client DomainsClient) GetDomainsPreparer(resourceGroupName string) (*http. return preparer.Prepare(&http.Request{}) } -// GetDomainsSender sends the GetDomains request. The method will close the +// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the // http.Response Body if it receives an error. -func (client DomainsClient) GetDomainsSender(req *http.Request) (*http.Response, error) { +func (client DomainsClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { return autorest.SendWithSender(client, req) } -// GetDomainsResponder handles the response to the GetDomains request. The method always +// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always // closes the http.Response Body. -func (client DomainsClient) GetDomainsResponder(resp *http.Response) (result DomainCollection, err error) { +func (client DomainsClient) ListByResourceGroupResponder(resp *http.Response) (result DomainCollection, err error) { err = autorest.Respond( resp, client.ByInspecting(), @@ -365,89 +824,285 @@ func (client DomainsClient) GetDomainsResponder(resp *http.Response) (result Dom return } -// GetDomainsNextResults retrieves the next set of results, if any. -func (client DomainsClient) GetDomainsNextResults(lastResults DomainCollection) (result DomainCollection, err error) { +// ListByResourceGroupNextResults retrieves the next set of results, if any. +func (client DomainsClient) ListByResourceGroupNextResults(lastResults DomainCollection) (result DomainCollection, err error) { req, err := lastResults.DomainCollectionPreparer() if err != nil { - return result, autorest.NewErrorWithError(err, "web.DomainsClient", "GetDomains", nil, "Failure preparing next results request") + return result, autorest.NewErrorWithError(err, "web.DomainsClient", "ListByResourceGroup", 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, "web.DomainsClient", "ListByResourceGroup", resp, "Failure sending next results request") + } + + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.DomainsClient", "ListByResourceGroup", resp, "Failure responding to next results request") + } + + return +} + +// ListOwnershipIdentifiers lists domain ownership identifiers. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. domainName is name of domain. +func (client DomainsClient) ListOwnershipIdentifiers(resourceGroupName string, domainName string) (result DomainOwnershipIdentifierCollection, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.DomainsClient", "ListOwnershipIdentifiers") + } + + req, err := client.ListOwnershipIdentifiersPreparer(resourceGroupName, domainName) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.DomainsClient", "ListOwnershipIdentifiers", nil, "Failure preparing request") + } + + resp, err := client.ListOwnershipIdentifiersSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.DomainsClient", "ListOwnershipIdentifiers", resp, "Failure sending request") + } + + result, err = client.ListOwnershipIdentifiersResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.DomainsClient", "ListOwnershipIdentifiers", resp, "Failure responding to request") + } + + return +} + +// ListOwnershipIdentifiersPreparer prepares the ListOwnershipIdentifiers request. +func (client DomainsClient) ListOwnershipIdentifiersPreparer(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 = "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.DomainRegistration/domains/{domainName}/domainOwnershipIdentifiers", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListOwnershipIdentifiersSender sends the ListOwnershipIdentifiers request. The method will close the +// http.Response Body if it receives an error. +func (client DomainsClient) ListOwnershipIdentifiersSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListOwnershipIdentifiersResponder handles the response to the ListOwnershipIdentifiers request. The method always +// closes the http.Response Body. +func (client DomainsClient) ListOwnershipIdentifiersResponder(resp *http.Response) (result DomainOwnershipIdentifierCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListOwnershipIdentifiersNextResults retrieves the next set of results, if any. +func (client DomainsClient) ListOwnershipIdentifiersNextResults(lastResults DomainOwnershipIdentifierCollection) (result DomainOwnershipIdentifierCollection, err error) { + req, err := lastResults.DomainOwnershipIdentifierCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "web.DomainsClient", "ListOwnershipIdentifiers", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListOwnershipIdentifiersSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.DomainsClient", "ListOwnershipIdentifiers", resp, "Failure sending next results request") + } + + result, err = client.ListOwnershipIdentifiersResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.DomainsClient", "ListOwnershipIdentifiers", resp, "Failure responding to next results request") + } + + return +} + +// ListRecommendations get domain name recommendations based on keywords. +// +// parameters is search parameters for domain name recommendations. +func (client DomainsClient) ListRecommendations(parameters DomainRecommendationSearchParameters) (result NameIdentifierCollection, err error) { + req, err := client.ListRecommendationsPreparer(parameters) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.DomainsClient", "ListRecommendations", nil, "Failure preparing request") + } + + resp, err := client.ListRecommendationsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.DomainsClient", "ListRecommendations", resp, "Failure sending request") + } + + result, err = client.ListRecommendationsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.DomainsClient", "ListRecommendations", resp, "Failure responding to request") + } + + return +} + +// ListRecommendationsPreparer prepares the ListRecommendations request. +func (client DomainsClient) ListRecommendationsPreparer(parameters DomainRecommendationSearchParameters) (*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.AsJSON(), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.DomainRegistration/listDomainRecommendations", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListRecommendationsSender sends the ListRecommendations request. The method will close the +// http.Response Body if it receives an error. +func (client DomainsClient) ListRecommendationsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListRecommendationsResponder handles the response to the ListRecommendations request. The method always +// closes the http.Response Body. +func (client DomainsClient) ListRecommendationsResponder(resp *http.Response) (result NameIdentifierCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListRecommendationsNextResults retrieves the next set of results, if any. +func (client DomainsClient) ListRecommendationsNextResults(lastResults NameIdentifierCollection) (result NameIdentifierCollection, err error) { + req, err := lastResults.NameIdentifierCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "web.DomainsClient", "ListRecommendations", nil, "Failure preparing next results request") } if req == nil { return } - resp, err := client.GetDomainsSender(req) + resp, err := client.ListRecommendationsSender(req) if err != nil { result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.DomainsClient", "GetDomains", resp, "Failure sending next results request") + return result, autorest.NewErrorWithError(err, "web.DomainsClient", "ListRecommendations", resp, "Failure sending next results request") } - result, err = client.GetDomainsResponder(resp) + result, err = client.ListRecommendationsResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "web.DomainsClient", "GetDomains", resp, "Failure responding to next results request") + err = autorest.NewErrorWithError(err, "web.DomainsClient", "ListRecommendations", resp, "Failure responding to next results request") } return } -// UpdateDomain sends the update domain request. +// UpdateOwnershipIdentifier creates an ownership identifier for a domain or +// updates identifier details for an existing identifer // -// resourceGroupName is >Name of the resource group domainName is name of -// the domain domain is domain registration information -func (client DomainsClient) UpdateDomain(resourceGroupName string, domainName string, domain Domain) (result Domain, err error) { - req, err := client.UpdateDomainPreparer(resourceGroupName, domainName, domain) +// resourceGroupName is name of the resource group to which the resource +// belongs. domainName is name of domain. name is name of identifier. +// domainOwnershipIdentifier is a JSON representation of the domain ownership +// properties. +func (client DomainsClient) UpdateOwnershipIdentifier(resourceGroupName string, domainName string, name string, domainOwnershipIdentifier DomainOwnershipIdentifier) (result DomainOwnershipIdentifier, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.DomainsClient", "UpdateOwnershipIdentifier") + } + + req, err := client.UpdateOwnershipIdentifierPreparer(resourceGroupName, domainName, name, domainOwnershipIdentifier) if err != nil { - return result, autorest.NewErrorWithError(err, "web.DomainsClient", "UpdateDomain", nil, "Failure preparing request") + return result, autorest.NewErrorWithError(err, "web.DomainsClient", "UpdateOwnershipIdentifier", nil, "Failure preparing request") } - resp, err := client.UpdateDomainSender(req) + resp, err := client.UpdateOwnershipIdentifierSender(req) if err != nil { result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.DomainsClient", "UpdateDomain", resp, "Failure sending request") + return result, autorest.NewErrorWithError(err, "web.DomainsClient", "UpdateOwnershipIdentifier", resp, "Failure sending request") } - result, err = client.UpdateDomainResponder(resp) + result, err = client.UpdateOwnershipIdentifierResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "web.DomainsClient", "UpdateDomain", resp, "Failure responding to request") + err = autorest.NewErrorWithError(err, "web.DomainsClient", "UpdateOwnershipIdentifier", resp, "Failure responding to request") } return } -// UpdateDomainPreparer prepares the UpdateDomain request. -func (client DomainsClient) UpdateDomainPreparer(resourceGroupName string, domainName string, domain Domain) (*http.Request, error) { +// UpdateOwnershipIdentifierPreparer prepares the UpdateOwnershipIdentifier request. +func (client DomainsClient) UpdateOwnershipIdentifierPreparer(resourceGroupName string, domainName string, name string, domainOwnershipIdentifier DomainOwnershipIdentifier) (*http.Request, error) { pathParameters := map[string]interface{}{ "domainName": autorest.Encode("path", domainName), + "name": autorest.Encode("path", name), "resourceGroupName": autorest.Encode("path", resourceGroupName), "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2015-04-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( autorest.AsJSON(), autorest.AsPatch(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DomainRegistration/domains/{domainName}", pathParameters), - autorest.WithJSON(domain), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DomainRegistration/domains/{domainName}/domainOwnershipIdentifiers/{name}", pathParameters), + autorest.WithJSON(domainOwnershipIdentifier), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare(&http.Request{}) } -// UpdateDomainSender sends the UpdateDomain request. The method will close the +// UpdateOwnershipIdentifierSender sends the UpdateOwnershipIdentifier request. The method will close the // http.Response Body if it receives an error. -func (client DomainsClient) UpdateDomainSender(req *http.Request) (*http.Response, error) { +func (client DomainsClient) UpdateOwnershipIdentifierSender(req *http.Request) (*http.Response, error) { return autorest.SendWithSender(client, req) } -// UpdateDomainResponder handles the response to the UpdateDomain request. The method always +// UpdateOwnershipIdentifierResponder handles the response to the UpdateOwnershipIdentifier request. The method always // closes the http.Response Body. -func (client DomainsClient) UpdateDomainResponder(resp *http.Response) (result Domain, err error) { +func (client DomainsClient) UpdateOwnershipIdentifierResponder(resp *http.Response) (result DomainOwnershipIdentifier, err error) { err = autorest.Respond( resp, client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusAccepted, http.StatusOK), + azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) result.Response = autorest.Response{Response: resp} diff --git a/arm/web/global.go b/arm/web/global.go deleted file mode 100644 index 3dbe37e6870e..000000000000 --- a/arm/web/global.go +++ /dev/null @@ -1,1004 +0,0 @@ -package web - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// -// See the License for the specific language governing permissions and -// limitations under the License. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// 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/azure" - "net/http" -) - -// GlobalClient is the use these APIs to manage Azure Websites resources -// through the Azure Resource Manager. All task operations conform to the -// HTTP/1.1 protocol specification and each operation returns an -// x-ms-request-id header that can be used to obtain information about the -// request. You must make sure that requests made to these resources are -// secure. For more information, see -// https://msdn.microsoft.com/en-us/library/azure/dn790557.aspx. -type GlobalClient struct { - ManagementClient -} - -// NewGlobalClient creates an instance of the GlobalClient client. -func NewGlobalClient(subscriptionID string) GlobalClient { - return NewGlobalClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewGlobalClientWithBaseURI creates an instance of the GlobalClient client. -func NewGlobalClientWithBaseURI(baseURI string, subscriptionID string) GlobalClient { - return GlobalClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CheckNameAvailability sends the check name availability request. -// -// request is name availability request -func (client GlobalClient) CheckNameAvailability(request ResourceNameAvailabilityRequest) (result ResourceNameAvailability, err error) { - req, err := client.CheckNameAvailabilityPreparer(request) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.GlobalClient", "CheckNameAvailability", nil, "Failure preparing request") - } - - resp, err := client.CheckNameAvailabilitySender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.GlobalClient", "CheckNameAvailability", resp, "Failure sending request") - } - - result, err = client.CheckNameAvailabilityResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.GlobalClient", "CheckNameAvailability", resp, "Failure responding to request") - } - - return -} - -// CheckNameAvailabilityPreparer prepares the CheckNameAvailability request. -func (client GlobalClient) CheckNameAvailabilityPreparer(request ResourceNameAvailabilityRequest) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Web/checknameavailability", pathParameters), - autorest.WithJSON(request), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CheckNameAvailabilitySender sends the CheckNameAvailability request. The method will close the -// http.Response Body if it receives an error. -func (client GlobalClient) CheckNameAvailabilitySender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CheckNameAvailabilityResponder handles the response to the CheckNameAvailability request. The method always -// closes the http.Response Body. -func (client GlobalClient) CheckNameAvailabilityResponder(resp *http.Response) (result ResourceNameAvailability, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetAllCertificates sends the get all certificates request. -func (client GlobalClient) GetAllCertificates() (result CertificateCollection, err error) { - req, err := client.GetAllCertificatesPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "web.GlobalClient", "GetAllCertificates", nil, "Failure preparing request") - } - - resp, err := client.GetAllCertificatesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.GlobalClient", "GetAllCertificates", resp, "Failure sending request") - } - - result, err = client.GetAllCertificatesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.GlobalClient", "GetAllCertificates", resp, "Failure responding to request") - } - - return -} - -// GetAllCertificatesPreparer prepares the GetAllCertificates request. -func (client GlobalClient) GetAllCertificatesPreparer() (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Web/certificates", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetAllCertificatesSender sends the GetAllCertificates request. The method will close the -// http.Response Body if it receives an error. -func (client GlobalClient) GetAllCertificatesSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetAllCertificatesResponder handles the response to the GetAllCertificates request. The method always -// closes the http.Response Body. -func (client GlobalClient) GetAllCertificatesResponder(resp *http.Response) (result CertificateCollection, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetAllCertificatesNextResults retrieves the next set of results, if any. -func (client GlobalClient) GetAllCertificatesNextResults(lastResults CertificateCollection) (result CertificateCollection, err error) { - req, err := lastResults.CertificateCollectionPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "web.GlobalClient", "GetAllCertificates", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.GetAllCertificatesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.GlobalClient", "GetAllCertificates", resp, "Failure sending next results request") - } - - result, err = client.GetAllCertificatesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.GlobalClient", "GetAllCertificates", resp, "Failure responding to next results request") - } - - return -} - -// GetAllClassicMobileServices sends the get all classic mobile services -// request. -func (client GlobalClient) GetAllClassicMobileServices() (result ClassicMobileServiceCollection, err error) { - req, err := client.GetAllClassicMobileServicesPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "web.GlobalClient", "GetAllClassicMobileServices", nil, "Failure preparing request") - } - - resp, err := client.GetAllClassicMobileServicesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.GlobalClient", "GetAllClassicMobileServices", resp, "Failure sending request") - } - - result, err = client.GetAllClassicMobileServicesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.GlobalClient", "GetAllClassicMobileServices", resp, "Failure responding to request") - } - - return -} - -// GetAllClassicMobileServicesPreparer prepares the GetAllClassicMobileServices request. -func (client GlobalClient) GetAllClassicMobileServicesPreparer() (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Web/classicMobileServices", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetAllClassicMobileServicesSender sends the GetAllClassicMobileServices request. The method will close the -// http.Response Body if it receives an error. -func (client GlobalClient) GetAllClassicMobileServicesSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetAllClassicMobileServicesResponder handles the response to the GetAllClassicMobileServices request. The method always -// closes the http.Response Body. -func (client GlobalClient) GetAllClassicMobileServicesResponder(resp *http.Response) (result ClassicMobileServiceCollection, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetAllClassicMobileServicesNextResults retrieves the next set of results, if any. -func (client GlobalClient) GetAllClassicMobileServicesNextResults(lastResults ClassicMobileServiceCollection) (result ClassicMobileServiceCollection, err error) { - req, err := lastResults.ClassicMobileServiceCollectionPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "web.GlobalClient", "GetAllClassicMobileServices", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.GetAllClassicMobileServicesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.GlobalClient", "GetAllClassicMobileServices", resp, "Failure sending next results request") - } - - result, err = client.GetAllClassicMobileServicesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.GlobalClient", "GetAllClassicMobileServices", resp, "Failure responding to next results request") - } - - return -} - -// GetAllHostingEnvironments sends the get all hosting environments request. -func (client GlobalClient) GetAllHostingEnvironments() (result HostingEnvironmentCollection, err error) { - req, err := client.GetAllHostingEnvironmentsPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "web.GlobalClient", "GetAllHostingEnvironments", nil, "Failure preparing request") - } - - resp, err := client.GetAllHostingEnvironmentsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.GlobalClient", "GetAllHostingEnvironments", resp, "Failure sending request") - } - - result, err = client.GetAllHostingEnvironmentsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.GlobalClient", "GetAllHostingEnvironments", resp, "Failure responding to request") - } - - return -} - -// GetAllHostingEnvironmentsPreparer prepares the GetAllHostingEnvironments request. -func (client GlobalClient) GetAllHostingEnvironmentsPreparer() (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Web/hostingEnvironments", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetAllHostingEnvironmentsSender sends the GetAllHostingEnvironments request. The method will close the -// http.Response Body if it receives an error. -func (client GlobalClient) GetAllHostingEnvironmentsSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetAllHostingEnvironmentsResponder handles the response to the GetAllHostingEnvironments request. The method always -// closes the http.Response Body. -func (client GlobalClient) GetAllHostingEnvironmentsResponder(resp *http.Response) (result HostingEnvironmentCollection, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetAllHostingEnvironmentsNextResults retrieves the next set of results, if any. -func (client GlobalClient) GetAllHostingEnvironmentsNextResults(lastResults HostingEnvironmentCollection) (result HostingEnvironmentCollection, err error) { - req, err := lastResults.HostingEnvironmentCollectionPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "web.GlobalClient", "GetAllHostingEnvironments", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.GetAllHostingEnvironmentsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.GlobalClient", "GetAllHostingEnvironments", resp, "Failure sending next results request") - } - - result, err = client.GetAllHostingEnvironmentsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.GlobalClient", "GetAllHostingEnvironments", resp, "Failure responding to next results request") - } - - return -} - -// GetAllManagedHostingEnvironments sends the get all managed hosting -// environments request. -func (client GlobalClient) GetAllManagedHostingEnvironments() (result ManagedHostingEnvironmentCollection, err error) { - req, err := client.GetAllManagedHostingEnvironmentsPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "web.GlobalClient", "GetAllManagedHostingEnvironments", nil, "Failure preparing request") - } - - resp, err := client.GetAllManagedHostingEnvironmentsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.GlobalClient", "GetAllManagedHostingEnvironments", resp, "Failure sending request") - } - - result, err = client.GetAllManagedHostingEnvironmentsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.GlobalClient", "GetAllManagedHostingEnvironments", resp, "Failure responding to request") - } - - return -} - -// GetAllManagedHostingEnvironmentsPreparer prepares the GetAllManagedHostingEnvironments request. -func (client GlobalClient) GetAllManagedHostingEnvironmentsPreparer() (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Web/managedHostingEnvironments", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetAllManagedHostingEnvironmentsSender sends the GetAllManagedHostingEnvironments request. The method will close the -// http.Response Body if it receives an error. -func (client GlobalClient) GetAllManagedHostingEnvironmentsSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetAllManagedHostingEnvironmentsResponder handles the response to the GetAllManagedHostingEnvironments request. The method always -// closes the http.Response Body. -func (client GlobalClient) GetAllManagedHostingEnvironmentsResponder(resp *http.Response) (result ManagedHostingEnvironmentCollection, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetAllManagedHostingEnvironmentsNextResults retrieves the next set of results, if any. -func (client GlobalClient) GetAllManagedHostingEnvironmentsNextResults(lastResults ManagedHostingEnvironmentCollection) (result ManagedHostingEnvironmentCollection, err error) { - req, err := lastResults.ManagedHostingEnvironmentCollectionPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "web.GlobalClient", "GetAllManagedHostingEnvironments", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.GetAllManagedHostingEnvironmentsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.GlobalClient", "GetAllManagedHostingEnvironments", resp, "Failure sending next results request") - } - - result, err = client.GetAllManagedHostingEnvironmentsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.GlobalClient", "GetAllManagedHostingEnvironments", resp, "Failure responding to next results request") - } - - return -} - -// GetAllServerFarms sends the get all server farms request. -// -// detailed is false to return a subset of App Service Plan properties, true to -// return all of the properties. -// Retrieval of all properties may increase the API latency. -func (client GlobalClient) GetAllServerFarms(detailed *bool) (result ServerFarmCollection, err error) { - req, err := client.GetAllServerFarmsPreparer(detailed) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.GlobalClient", "GetAllServerFarms", nil, "Failure preparing request") - } - - resp, err := client.GetAllServerFarmsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.GlobalClient", "GetAllServerFarms", resp, "Failure sending request") - } - - result, err = client.GetAllServerFarmsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.GlobalClient", "GetAllServerFarms", resp, "Failure responding to request") - } - - return -} - -// GetAllServerFarmsPreparer prepares the GetAllServerFarms request. -func (client GlobalClient) GetAllServerFarmsPreparer(detailed *bool) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - if detailed != nil { - queryParameters["detailed"] = autorest.Encode("query", *detailed) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Web/serverfarms", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetAllServerFarmsSender sends the GetAllServerFarms request. The method will close the -// http.Response Body if it receives an error. -func (client GlobalClient) GetAllServerFarmsSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetAllServerFarmsResponder handles the response to the GetAllServerFarms request. The method always -// closes the http.Response Body. -func (client GlobalClient) GetAllServerFarmsResponder(resp *http.Response) (result ServerFarmCollection, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetAllServerFarmsNextResults retrieves the next set of results, if any. -func (client GlobalClient) GetAllServerFarmsNextResults(lastResults ServerFarmCollection) (result ServerFarmCollection, err error) { - req, err := lastResults.ServerFarmCollectionPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "web.GlobalClient", "GetAllServerFarms", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.GetAllServerFarmsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.GlobalClient", "GetAllServerFarms", resp, "Failure sending next results request") - } - - result, err = client.GetAllServerFarmsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.GlobalClient", "GetAllServerFarms", resp, "Failure responding to next results request") - } - - return -} - -// GetAllSites sends the get all sites request. -func (client GlobalClient) GetAllSites() (result SiteCollection, err error) { - req, err := client.GetAllSitesPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "web.GlobalClient", "GetAllSites", nil, "Failure preparing request") - } - - resp, err := client.GetAllSitesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.GlobalClient", "GetAllSites", resp, "Failure sending request") - } - - result, err = client.GetAllSitesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.GlobalClient", "GetAllSites", resp, "Failure responding to request") - } - - return -} - -// GetAllSitesPreparer prepares the GetAllSites request. -func (client GlobalClient) GetAllSitesPreparer() (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Web/sites", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetAllSitesSender sends the GetAllSites request. The method will close the -// http.Response Body if it receives an error. -func (client GlobalClient) GetAllSitesSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetAllSitesResponder handles the response to the GetAllSites request. The method always -// closes the http.Response Body. -func (client GlobalClient) GetAllSitesResponder(resp *http.Response) (result SiteCollection, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetAllSitesNextResults retrieves the next set of results, if any. -func (client GlobalClient) GetAllSitesNextResults(lastResults SiteCollection) (result SiteCollection, err error) { - req, err := lastResults.SiteCollectionPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "web.GlobalClient", "GetAllSites", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.GetAllSitesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.GlobalClient", "GetAllSites", resp, "Failure sending next results request") - } - - result, err = client.GetAllSitesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.GlobalClient", "GetAllSites", resp, "Failure responding to next results request") - } - - return -} - -// GetSubscriptionGeoRegions sends the get subscription geo regions request. -// -// sku is filter only to regions that support this sku linuxWorkersEnabled is -// filter only to regions that support linux workers -func (client GlobalClient) GetSubscriptionGeoRegions(sku string, linuxWorkersEnabled *bool) (result GeoRegionCollection, err error) { - req, err := client.GetSubscriptionGeoRegionsPreparer(sku, linuxWorkersEnabled) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.GlobalClient", "GetSubscriptionGeoRegions", nil, "Failure preparing request") - } - - resp, err := client.GetSubscriptionGeoRegionsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.GlobalClient", "GetSubscriptionGeoRegions", resp, "Failure sending request") - } - - result, err = client.GetSubscriptionGeoRegionsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.GlobalClient", "GetSubscriptionGeoRegions", resp, "Failure responding to request") - } - - return -} - -// GetSubscriptionGeoRegionsPreparer prepares the GetSubscriptionGeoRegions request. -func (client GlobalClient) GetSubscriptionGeoRegionsPreparer(sku string, linuxWorkersEnabled *bool) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - if len(sku) > 0 { - queryParameters["sku"] = autorest.Encode("query", sku) - } - if linuxWorkersEnabled != nil { - queryParameters["linuxWorkersEnabled"] = autorest.Encode("query", *linuxWorkersEnabled) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Web/geoRegions", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSubscriptionGeoRegionsSender sends the GetSubscriptionGeoRegions request. The method will close the -// http.Response Body if it receives an error. -func (client GlobalClient) GetSubscriptionGeoRegionsSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetSubscriptionGeoRegionsResponder handles the response to the GetSubscriptionGeoRegions request. The method always -// closes the http.Response Body. -func (client GlobalClient) GetSubscriptionGeoRegionsResponder(resp *http.Response) (result GeoRegionCollection, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetSubscriptionGeoRegionsNextResults retrieves the next set of results, if any. -func (client GlobalClient) GetSubscriptionGeoRegionsNextResults(lastResults GeoRegionCollection) (result GeoRegionCollection, err error) { - req, err := lastResults.GeoRegionCollectionPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "web.GlobalClient", "GetSubscriptionGeoRegions", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.GetSubscriptionGeoRegionsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.GlobalClient", "GetSubscriptionGeoRegions", resp, "Failure sending next results request") - } - - result, err = client.GetSubscriptionGeoRegionsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.GlobalClient", "GetSubscriptionGeoRegions", resp, "Failure responding to next results request") - } - - return -} - -// GetSubscriptionPublishingCredentials sends the get subscription publishing -// credentials request. -func (client GlobalClient) GetSubscriptionPublishingCredentials() (result User, err error) { - req, err := client.GetSubscriptionPublishingCredentialsPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "web.GlobalClient", "GetSubscriptionPublishingCredentials", nil, "Failure preparing request") - } - - resp, err := client.GetSubscriptionPublishingCredentialsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.GlobalClient", "GetSubscriptionPublishingCredentials", resp, "Failure sending request") - } - - result, err = client.GetSubscriptionPublishingCredentialsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.GlobalClient", "GetSubscriptionPublishingCredentials", resp, "Failure responding to request") - } - - return -} - -// GetSubscriptionPublishingCredentialsPreparer prepares the GetSubscriptionPublishingCredentials request. -func (client GlobalClient) GetSubscriptionPublishingCredentialsPreparer() (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Web/publishingCredentials", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSubscriptionPublishingCredentialsSender sends the GetSubscriptionPublishingCredentials request. The method will close the -// http.Response Body if it receives an error. -func (client GlobalClient) GetSubscriptionPublishingCredentialsSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetSubscriptionPublishingCredentialsResponder handles the response to the GetSubscriptionPublishingCredentials request. The method always -// closes the http.Response Body. -func (client GlobalClient) GetSubscriptionPublishingCredentialsResponder(resp *http.Response) (result User, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// IsHostingEnvironmentNameAvailable sends the is hosting environment name -// available request. -// -// name is hosting environment name -func (client GlobalClient) IsHostingEnvironmentNameAvailable(name string) (result SetObject, err error) { - req, err := client.IsHostingEnvironmentNameAvailablePreparer(name) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.GlobalClient", "IsHostingEnvironmentNameAvailable", nil, "Failure preparing request") - } - - resp, err := client.IsHostingEnvironmentNameAvailableSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.GlobalClient", "IsHostingEnvironmentNameAvailable", resp, "Failure sending request") - } - - result, err = client.IsHostingEnvironmentNameAvailableResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.GlobalClient", "IsHostingEnvironmentNameAvailable", resp, "Failure responding to request") - } - - return -} - -// IsHostingEnvironmentNameAvailablePreparer prepares the IsHostingEnvironmentNameAvailable request. -func (client GlobalClient) IsHostingEnvironmentNameAvailablePreparer(name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - "name": autorest.Encode("query", name), - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Web/ishostingenvironmentnameavailable", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// IsHostingEnvironmentNameAvailableSender sends the IsHostingEnvironmentNameAvailable request. The method will close the -// http.Response Body if it receives an error. -func (client GlobalClient) IsHostingEnvironmentNameAvailableSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// IsHostingEnvironmentNameAvailableResponder handles the response to the IsHostingEnvironmentNameAvailable request. The method always -// closes the http.Response Body. -func (client GlobalClient) IsHostingEnvironmentNameAvailableResponder(resp *http.Response) (result SetObject, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Value), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// IsHostingEnvironmentWithLegacyNameAvailable sends the is hosting environment -// with legacy name available request. -// -// name is hosting environment name -func (client GlobalClient) IsHostingEnvironmentWithLegacyNameAvailable(name string) (result SetObject, err error) { - req, err := client.IsHostingEnvironmentWithLegacyNameAvailablePreparer(name) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.GlobalClient", "IsHostingEnvironmentWithLegacyNameAvailable", nil, "Failure preparing request") - } - - resp, err := client.IsHostingEnvironmentWithLegacyNameAvailableSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.GlobalClient", "IsHostingEnvironmentWithLegacyNameAvailable", resp, "Failure sending request") - } - - result, err = client.IsHostingEnvironmentWithLegacyNameAvailableResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.GlobalClient", "IsHostingEnvironmentWithLegacyNameAvailable", resp, "Failure responding to request") - } - - return -} - -// IsHostingEnvironmentWithLegacyNameAvailablePreparer prepares the IsHostingEnvironmentWithLegacyNameAvailable request. -func (client GlobalClient) IsHostingEnvironmentWithLegacyNameAvailablePreparer(name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Web/ishostingenvironmentnameavailable/{name}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// IsHostingEnvironmentWithLegacyNameAvailableSender sends the IsHostingEnvironmentWithLegacyNameAvailable request. The method will close the -// http.Response Body if it receives an error. -func (client GlobalClient) IsHostingEnvironmentWithLegacyNameAvailableSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// IsHostingEnvironmentWithLegacyNameAvailableResponder handles the response to the IsHostingEnvironmentWithLegacyNameAvailable request. The method always -// closes the http.Response Body. -func (client GlobalClient) IsHostingEnvironmentWithLegacyNameAvailableResponder(resp *http.Response) (result SetObject, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Value), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListPremierAddOnOffers sends the list premier add on offers request. -func (client GlobalClient) ListPremierAddOnOffers() (result SetObject, err error) { - req, err := client.ListPremierAddOnOffersPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "web.GlobalClient", "ListPremierAddOnOffers", nil, "Failure preparing request") - } - - resp, err := client.ListPremierAddOnOffersSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.GlobalClient", "ListPremierAddOnOffers", resp, "Failure sending request") - } - - result, err = client.ListPremierAddOnOffersResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.GlobalClient", "ListPremierAddOnOffers", resp, "Failure responding to request") - } - - return -} - -// ListPremierAddOnOffersPreparer prepares the ListPremierAddOnOffers request. -func (client GlobalClient) ListPremierAddOnOffersPreparer() (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Web/premieraddonoffers", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListPremierAddOnOffersSender sends the ListPremierAddOnOffers request. The method will close the -// http.Response Body if it receives an error. -func (client GlobalClient) ListPremierAddOnOffersSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListPremierAddOnOffersResponder handles the response to the ListPremierAddOnOffers request. The method always -// closes the http.Response Body. -func (client GlobalClient) ListPremierAddOnOffersResponder(resp *http.Response) (result SetObject, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Value), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// UpdateSubscriptionPublishingCredentials sends the update subscription -// publishing credentials request. -// -// requestMessage is requestMessage with new publishing credentials -func (client GlobalClient) UpdateSubscriptionPublishingCredentials(requestMessage User) (result User, err error) { - req, err := client.UpdateSubscriptionPublishingCredentialsPreparer(requestMessage) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.GlobalClient", "UpdateSubscriptionPublishingCredentials", nil, "Failure preparing request") - } - - resp, err := client.UpdateSubscriptionPublishingCredentialsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.GlobalClient", "UpdateSubscriptionPublishingCredentials", resp, "Failure sending request") - } - - result, err = client.UpdateSubscriptionPublishingCredentialsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.GlobalClient", "UpdateSubscriptionPublishingCredentials", resp, "Failure responding to request") - } - - return -} - -// UpdateSubscriptionPublishingCredentialsPreparer prepares the UpdateSubscriptionPublishingCredentials request. -func (client GlobalClient) UpdateSubscriptionPublishingCredentialsPreparer(requestMessage User) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Web/publishingCredentials", pathParameters), - autorest.WithJSON(requestMessage), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// UpdateSubscriptionPublishingCredentialsSender sends the UpdateSubscriptionPublishingCredentials request. The method will close the -// http.Response Body if it receives an error. -func (client GlobalClient) UpdateSubscriptionPublishingCredentialsSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// UpdateSubscriptionPublishingCredentialsResponder handles the response to the UpdateSubscriptionPublishingCredentials request. The method always -// closes the http.Response Body. -func (client GlobalClient) UpdateSubscriptionPublishingCredentialsResponder(resp *http.Response) (result User, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/arm/web/globalcertificateorder.go b/arm/web/globalcertificateorder.go deleted file mode 100644 index 08f214f606ed..000000000000 --- a/arm/web/globalcertificateorder.go +++ /dev/null @@ -1,193 +0,0 @@ -package web - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// -// See the License for the specific language governing permissions and -// limitations under the License. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// 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/azure" - "net/http" -) - -// GlobalCertificateOrderClient is the use these APIs to manage Azure Websites -// resources through the Azure Resource Manager. All task operations conform to -// the HTTP/1.1 protocol specification and each operation returns an -// x-ms-request-id header that can be used to obtain information about the -// request. You must make sure that requests made to these resources are -// secure. For more information, see -// https://msdn.microsoft.com/en-us/library/azure/dn790557.aspx. -type GlobalCertificateOrderClient struct { - ManagementClient -} - -// NewGlobalCertificateOrderClient creates an instance of the -// GlobalCertificateOrderClient client. -func NewGlobalCertificateOrderClient(subscriptionID string) GlobalCertificateOrderClient { - return NewGlobalCertificateOrderClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewGlobalCertificateOrderClientWithBaseURI creates an instance of the -// GlobalCertificateOrderClient client. -func NewGlobalCertificateOrderClientWithBaseURI(baseURI string, subscriptionID string) GlobalCertificateOrderClient { - return GlobalCertificateOrderClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// GetAllCertificateOrders sends the get all certificate orders request. -func (client GlobalCertificateOrderClient) GetAllCertificateOrders() (result CertificateOrderCollection, err error) { - req, err := client.GetAllCertificateOrdersPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "web.GlobalCertificateOrderClient", "GetAllCertificateOrders", nil, "Failure preparing request") - } - - resp, err := client.GetAllCertificateOrdersSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.GlobalCertificateOrderClient", "GetAllCertificateOrders", resp, "Failure sending request") - } - - result, err = client.GetAllCertificateOrdersResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.GlobalCertificateOrderClient", "GetAllCertificateOrders", resp, "Failure responding to request") - } - - return -} - -// GetAllCertificateOrdersPreparer prepares the GetAllCertificateOrders request. -func (client GlobalCertificateOrderClient) GetAllCertificateOrdersPreparer() (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.CertificateRegistration/certificateOrders", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetAllCertificateOrdersSender sends the GetAllCertificateOrders request. The method will close the -// http.Response Body if it receives an error. -func (client GlobalCertificateOrderClient) GetAllCertificateOrdersSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetAllCertificateOrdersResponder handles the response to the GetAllCertificateOrders request. The method always -// closes the http.Response Body. -func (client GlobalCertificateOrderClient) GetAllCertificateOrdersResponder(resp *http.Response) (result CertificateOrderCollection, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetAllCertificateOrdersNextResults retrieves the next set of results, if any. -func (client GlobalCertificateOrderClient) GetAllCertificateOrdersNextResults(lastResults CertificateOrderCollection) (result CertificateOrderCollection, err error) { - req, err := lastResults.CertificateOrderCollectionPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "web.GlobalCertificateOrderClient", "GetAllCertificateOrders", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.GetAllCertificateOrdersSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.GlobalCertificateOrderClient", "GetAllCertificateOrders", resp, "Failure sending next results request") - } - - result, err = client.GetAllCertificateOrdersResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.GlobalCertificateOrderClient", "GetAllCertificateOrders", resp, "Failure responding to next results request") - } - - return -} - -// ValidateCertificatePurchaseInformation sends the validate certificate -// purchase information request. -// -// certificateOrder is certificate order -func (client GlobalCertificateOrderClient) ValidateCertificatePurchaseInformation(certificateOrder CertificateOrder) (result SetObject, err error) { - req, err := client.ValidateCertificatePurchaseInformationPreparer(certificateOrder) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.GlobalCertificateOrderClient", "ValidateCertificatePurchaseInformation", nil, "Failure preparing request") - } - - resp, err := client.ValidateCertificatePurchaseInformationSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.GlobalCertificateOrderClient", "ValidateCertificatePurchaseInformation", resp, "Failure sending request") - } - - result, err = client.ValidateCertificatePurchaseInformationResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.GlobalCertificateOrderClient", "ValidateCertificatePurchaseInformation", resp, "Failure responding to request") - } - - return -} - -// ValidateCertificatePurchaseInformationPreparer prepares the ValidateCertificatePurchaseInformation request. -func (client GlobalCertificateOrderClient) ValidateCertificatePurchaseInformationPreparer(certificateOrder CertificateOrder) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.CertificateRegistration/validateCertificateRegistrationInformation", pathParameters), - autorest.WithJSON(certificateOrder), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ValidateCertificatePurchaseInformationSender sends the ValidateCertificatePurchaseInformation request. The method will close the -// http.Response Body if it receives an error. -func (client GlobalCertificateOrderClient) ValidateCertificatePurchaseInformationSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ValidateCertificatePurchaseInformationResponder handles the response to the ValidateCertificatePurchaseInformation request. The method always -// closes the http.Response Body. -func (client GlobalCertificateOrderClient) ValidateCertificatePurchaseInformationResponder(resp *http.Response) (result SetObject, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Value), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/arm/web/globaldomainregistration.go b/arm/web/globaldomainregistration.go deleted file mode 100644 index f7d0709d8cf3..000000000000 --- a/arm/web/globaldomainregistration.go +++ /dev/null @@ -1,400 +0,0 @@ -package web - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// -// See the License for the specific language governing permissions and -// limitations under the License. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// 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/azure" - "net/http" -) - -// GlobalDomainRegistrationClient is the use these APIs to manage Azure -// Websites resources through the Azure Resource Manager. All task operations -// conform to the HTTP/1.1 protocol specification and each operation returns an -// x-ms-request-id header that can be used to obtain information about the -// request. You must make sure that requests made to these resources are -// secure. For more information, see -// https://msdn.microsoft.com/en-us/library/azure/dn790557.aspx. -type GlobalDomainRegistrationClient struct { - ManagementClient -} - -// NewGlobalDomainRegistrationClient creates an instance of the -// GlobalDomainRegistrationClient client. -func NewGlobalDomainRegistrationClient(subscriptionID string) GlobalDomainRegistrationClient { - return NewGlobalDomainRegistrationClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewGlobalDomainRegistrationClientWithBaseURI creates an instance of the -// GlobalDomainRegistrationClient client. -func NewGlobalDomainRegistrationClientWithBaseURI(baseURI string, subscriptionID string) GlobalDomainRegistrationClient { - return GlobalDomainRegistrationClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CheckDomainAvailability sends the check domain availability request. -// -// identifier is name of the domain -func (client GlobalDomainRegistrationClient) CheckDomainAvailability(identifier NameIdentifier) (result DomainAvailablilityCheckResult, err error) { - req, err := client.CheckDomainAvailabilityPreparer(identifier) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.GlobalDomainRegistrationClient", "CheckDomainAvailability", nil, "Failure preparing request") - } - - resp, err := client.CheckDomainAvailabilitySender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.GlobalDomainRegistrationClient", "CheckDomainAvailability", resp, "Failure sending request") - } - - result, err = client.CheckDomainAvailabilityResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.GlobalDomainRegistrationClient", "CheckDomainAvailability", resp, "Failure responding to request") - } - - return -} - -// CheckDomainAvailabilityPreparer prepares the CheckDomainAvailability request. -func (client GlobalDomainRegistrationClient) CheckDomainAvailabilityPreparer(identifier NameIdentifier) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.DomainRegistration/checkDomainAvailability", pathParameters), - autorest.WithJSON(identifier), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CheckDomainAvailabilitySender sends the CheckDomainAvailability request. The method will close the -// http.Response Body if it receives an error. -func (client GlobalDomainRegistrationClient) CheckDomainAvailabilitySender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CheckDomainAvailabilityResponder handles the response to the CheckDomainAvailability request. The method always -// closes the http.Response Body. -func (client GlobalDomainRegistrationClient) CheckDomainAvailabilityResponder(resp *http.Response) (result DomainAvailablilityCheckResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetAllDomains sends the get all domains request. -func (client GlobalDomainRegistrationClient) GetAllDomains() (result DomainCollection, err error) { - req, err := client.GetAllDomainsPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "web.GlobalDomainRegistrationClient", "GetAllDomains", nil, "Failure preparing request") - } - - resp, err := client.GetAllDomainsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.GlobalDomainRegistrationClient", "GetAllDomains", resp, "Failure sending request") - } - - result, err = client.GetAllDomainsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.GlobalDomainRegistrationClient", "GetAllDomains", resp, "Failure responding to request") - } - - return -} - -// GetAllDomainsPreparer prepares the GetAllDomains request. -func (client GlobalDomainRegistrationClient) GetAllDomainsPreparer() (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.DomainRegistration/domains", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetAllDomainsSender sends the GetAllDomains request. The method will close the -// http.Response Body if it receives an error. -func (client GlobalDomainRegistrationClient) GetAllDomainsSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetAllDomainsResponder handles the response to the GetAllDomains request. The method always -// closes the http.Response Body. -func (client GlobalDomainRegistrationClient) GetAllDomainsResponder(resp *http.Response) (result DomainCollection, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetAllDomainsNextResults retrieves the next set of results, if any. -func (client GlobalDomainRegistrationClient) GetAllDomainsNextResults(lastResults DomainCollection) (result DomainCollection, err error) { - req, err := lastResults.DomainCollectionPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "web.GlobalDomainRegistrationClient", "GetAllDomains", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.GetAllDomainsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.GlobalDomainRegistrationClient", "GetAllDomains", resp, "Failure sending next results request") - } - - result, err = client.GetAllDomainsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.GlobalDomainRegistrationClient", "GetAllDomains", resp, "Failure responding to next results request") - } - - return -} - -// GetDomainControlCenterSsoRequest sends the get domain control center sso -// request request. -func (client GlobalDomainRegistrationClient) GetDomainControlCenterSsoRequest() (result DomainControlCenterSsoRequest, err error) { - req, err := client.GetDomainControlCenterSsoRequestPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "web.GlobalDomainRegistrationClient", "GetDomainControlCenterSsoRequest", nil, "Failure preparing request") - } - - resp, err := client.GetDomainControlCenterSsoRequestSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.GlobalDomainRegistrationClient", "GetDomainControlCenterSsoRequest", resp, "Failure sending request") - } - - result, err = client.GetDomainControlCenterSsoRequestResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.GlobalDomainRegistrationClient", "GetDomainControlCenterSsoRequest", resp, "Failure responding to request") - } - - return -} - -// GetDomainControlCenterSsoRequestPreparer prepares the GetDomainControlCenterSsoRequest request. -func (client GlobalDomainRegistrationClient) GetDomainControlCenterSsoRequestPreparer() (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.DomainRegistration/generateSsoRequest", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetDomainControlCenterSsoRequestSender sends the GetDomainControlCenterSsoRequest request. The method will close the -// http.Response Body if it receives an error. -func (client GlobalDomainRegistrationClient) GetDomainControlCenterSsoRequestSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetDomainControlCenterSsoRequestResponder handles the response to the GetDomainControlCenterSsoRequest request. The method always -// closes the http.Response Body. -func (client GlobalDomainRegistrationClient) GetDomainControlCenterSsoRequestResponder(resp *http.Response) (result DomainControlCenterSsoRequest, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListDomainRecommendations sends the list domain recommendations request. -// -// parameters is domain recommendation search parameters -func (client GlobalDomainRegistrationClient) ListDomainRecommendations(parameters DomainRecommendationSearchParameters) (result NameIdentifierCollection, err error) { - req, err := client.ListDomainRecommendationsPreparer(parameters) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.GlobalDomainRegistrationClient", "ListDomainRecommendations", nil, "Failure preparing request") - } - - resp, err := client.ListDomainRecommendationsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.GlobalDomainRegistrationClient", "ListDomainRecommendations", resp, "Failure sending request") - } - - result, err = client.ListDomainRecommendationsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.GlobalDomainRegistrationClient", "ListDomainRecommendations", resp, "Failure responding to request") - } - - return -} - -// ListDomainRecommendationsPreparer prepares the ListDomainRecommendations request. -func (client GlobalDomainRegistrationClient) ListDomainRecommendationsPreparer(parameters DomainRecommendationSearchParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.DomainRegistration/listDomainRecommendations", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListDomainRecommendationsSender sends the ListDomainRecommendations request. The method will close the -// http.Response Body if it receives an error. -func (client GlobalDomainRegistrationClient) ListDomainRecommendationsSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListDomainRecommendationsResponder handles the response to the ListDomainRecommendations request. The method always -// closes the http.Response Body. -func (client GlobalDomainRegistrationClient) ListDomainRecommendationsResponder(resp *http.Response) (result NameIdentifierCollection, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListDomainRecommendationsNextResults retrieves the next set of results, if any. -func (client GlobalDomainRegistrationClient) ListDomainRecommendationsNextResults(lastResults NameIdentifierCollection) (result NameIdentifierCollection, err error) { - req, err := lastResults.NameIdentifierCollectionPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "web.GlobalDomainRegistrationClient", "ListDomainRecommendations", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListDomainRecommendationsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.GlobalDomainRegistrationClient", "ListDomainRecommendations", resp, "Failure sending next results request") - } - - result, err = client.ListDomainRecommendationsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.GlobalDomainRegistrationClient", "ListDomainRecommendations", resp, "Failure responding to next results request") - } - - return -} - -// ValidateDomainPurchaseInformation sends the validate domain purchase -// information request. -// -// domainRegistrationInput is domain registration information -func (client GlobalDomainRegistrationClient) ValidateDomainPurchaseInformation(domainRegistrationInput DomainRegistrationInput) (result SetObject, err error) { - req, err := client.ValidateDomainPurchaseInformationPreparer(domainRegistrationInput) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.GlobalDomainRegistrationClient", "ValidateDomainPurchaseInformation", nil, "Failure preparing request") - } - - resp, err := client.ValidateDomainPurchaseInformationSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.GlobalDomainRegistrationClient", "ValidateDomainPurchaseInformation", resp, "Failure sending request") - } - - result, err = client.ValidateDomainPurchaseInformationResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.GlobalDomainRegistrationClient", "ValidateDomainPurchaseInformation", resp, "Failure responding to request") - } - - return -} - -// ValidateDomainPurchaseInformationPreparer prepares the ValidateDomainPurchaseInformation request. -func (client GlobalDomainRegistrationClient) ValidateDomainPurchaseInformationPreparer(domainRegistrationInput DomainRegistrationInput) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.DomainRegistration/validateDomainRegistrationInformation", pathParameters), - autorest.WithJSON(domainRegistrationInput), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ValidateDomainPurchaseInformationSender sends the ValidateDomainPurchaseInformation request. The method will close the -// http.Response Body if it receives an error. -func (client GlobalDomainRegistrationClient) ValidateDomainPurchaseInformationSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ValidateDomainPurchaseInformationResponder handles the response to the ValidateDomainPurchaseInformation request. The method always -// closes the http.Response Body. -func (client GlobalDomainRegistrationClient) ValidateDomainPurchaseInformationResponder(resp *http.Response) (result SetObject, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Value), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/arm/web/globalresourcegroups.go b/arm/web/globalresourcegroups.go deleted file mode 100644 index 28dd0678a91f..000000000000 --- a/arm/web/globalresourcegroups.go +++ /dev/null @@ -1,109 +0,0 @@ -package web - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// -// See the License for the specific language governing permissions and -// limitations under the License. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// 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/azure" - "net/http" -) - -// GlobalResourceGroupsClient is the use these APIs to manage Azure Websites -// resources through the Azure Resource Manager. All task operations conform to -// the HTTP/1.1 protocol specification and each operation returns an -// x-ms-request-id header that can be used to obtain information about the -// request. You must make sure that requests made to these resources are -// secure. For more information, see -// https://msdn.microsoft.com/en-us/library/azure/dn790557.aspx. -type GlobalResourceGroupsClient struct { - ManagementClient -} - -// NewGlobalResourceGroupsClient creates an instance of the -// GlobalResourceGroupsClient client. -func NewGlobalResourceGroupsClient(subscriptionID string) GlobalResourceGroupsClient { - return NewGlobalResourceGroupsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewGlobalResourceGroupsClientWithBaseURI creates an instance of the -// GlobalResourceGroupsClient client. -func NewGlobalResourceGroupsClientWithBaseURI(baseURI string, subscriptionID string) GlobalResourceGroupsClient { - return GlobalResourceGroupsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// MoveResources sends the move resources request. -// -func (client GlobalResourceGroupsClient) MoveResources(resourceGroupName string, moveResourceEnvelope CsmMoveResourceEnvelope) (result autorest.Response, err error) { - req, err := client.MoveResourcesPreparer(resourceGroupName, moveResourceEnvelope) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.GlobalResourceGroupsClient", "MoveResources", nil, "Failure preparing request") - } - - resp, err := client.MoveResourcesSender(req) - if err != nil { - result.Response = resp - return result, autorest.NewErrorWithError(err, "web.GlobalResourceGroupsClient", "MoveResources", resp, "Failure sending request") - } - - result, err = client.MoveResourcesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.GlobalResourceGroupsClient", "MoveResources", resp, "Failure responding to request") - } - - return -} - -// MoveResourcesPreparer prepares the MoveResources request. -func (client GlobalResourceGroupsClient) MoveResourcesPreparer(resourceGroupName string, moveResourceEnvelope CsmMoveResourceEnvelope) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/moveResources", pathParameters), - autorest.WithJSON(moveResourceEnvelope), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// MoveResourcesSender sends the MoveResources request. The method will close the -// http.Response Body if it receives an error. -func (client GlobalResourceGroupsClient) MoveResourcesSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// MoveResourcesResponder handles the response to the MoveResources request. The method always -// closes the http.Response Body. -func (client GlobalResourceGroupsClient) MoveResourcesResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} diff --git a/arm/web/hostingenvironments.go b/arm/web/hostingenvironments.go deleted file mode 100644 index e3c24040dbff..000000000000 --- a/arm/web/hostingenvironments.go +++ /dev/null @@ -1,2981 +0,0 @@ -package web - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// -// See the License for the specific language governing permissions and -// limitations under the License. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// 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/azure" - "net/http" -) - -// HostingEnvironmentsClient is the use these APIs to manage Azure Websites -// resources through the Azure Resource Manager. All task operations conform to -// the HTTP/1.1 protocol specification and each operation returns an -// x-ms-request-id header that can be used to obtain information about the -// request. You must make sure that requests made to these resources are -// secure. For more information, see -// https://msdn.microsoft.com/en-us/library/azure/dn790557.aspx. -type HostingEnvironmentsClient struct { - ManagementClient -} - -// NewHostingEnvironmentsClient creates an instance of the -// HostingEnvironmentsClient client. -func NewHostingEnvironmentsClient(subscriptionID string) HostingEnvironmentsClient { - return NewHostingEnvironmentsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewHostingEnvironmentsClientWithBaseURI creates an instance of the -// HostingEnvironmentsClient client. -func NewHostingEnvironmentsClientWithBaseURI(baseURI string, subscriptionID string) HostingEnvironmentsClient { - return HostingEnvironmentsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdateHostingEnvironment sends the create or update hosting -// environment request. This method may poll for completion. Polling can be -// canceled by passing the cancel channel argument. The channel will be used to -// cancel polling and any outstanding HTTP requests. -// -// resourceGroupName is name of resource group name is name of -// hostingEnvironment (App Service Environment) hostingEnvironmentEnvelope is -// properties of hostingEnvironment (App Service Environment) -func (client HostingEnvironmentsClient) CreateOrUpdateHostingEnvironment(resourceGroupName string, name string, hostingEnvironmentEnvelope HostingEnvironment, cancel <-chan struct{}) (result autorest.Response, err error) { - req, err := client.CreateOrUpdateHostingEnvironmentPreparer(resourceGroupName, name, hostingEnvironmentEnvelope, cancel) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.HostingEnvironmentsClient", "CreateOrUpdateHostingEnvironment", nil, "Failure preparing request") - } - - resp, err := client.CreateOrUpdateHostingEnvironmentSender(req) - if err != nil { - result.Response = resp - return result, autorest.NewErrorWithError(err, "web.HostingEnvironmentsClient", "CreateOrUpdateHostingEnvironment", resp, "Failure sending request") - } - - result, err = client.CreateOrUpdateHostingEnvironmentResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.HostingEnvironmentsClient", "CreateOrUpdateHostingEnvironment", resp, "Failure responding to request") - } - - return -} - -// CreateOrUpdateHostingEnvironmentPreparer prepares the CreateOrUpdateHostingEnvironment request. -func (client HostingEnvironmentsClient) CreateOrUpdateHostingEnvironmentPreparer(resourceGroupName string, name string, hostingEnvironmentEnvelope HostingEnvironment, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}", pathParameters), - autorest.WithJSON(hostingEnvironmentEnvelope), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// CreateOrUpdateHostingEnvironmentSender sends the CreateOrUpdateHostingEnvironment request. The method will close the -// http.Response Body if it receives an error. -func (client HostingEnvironmentsClient) CreateOrUpdateHostingEnvironmentSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// CreateOrUpdateHostingEnvironmentResponder handles the response to the CreateOrUpdateHostingEnvironment request. The method always -// closes the http.Response Body. -func (client HostingEnvironmentsClient) CreateOrUpdateHostingEnvironmentResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusBadRequest, http.StatusNotFound, http.StatusConflict), - autorest.ByClosing()) - result.Response = resp - return -} - -// CreateOrUpdateMultiRolePool sends the create or update multi role pool -// request. This method may poll for completion. Polling can be canceled by -// passing the cancel channel argument. The channel will be used to cancel -// polling and any outstanding HTTP requests. -// -// resourceGroupName is name of resource group name is name of -// hostingEnvironment (App Service Environment) multiRolePoolEnvelope is -// properties of multiRole pool -func (client HostingEnvironmentsClient) CreateOrUpdateMultiRolePool(resourceGroupName string, name string, multiRolePoolEnvelope WorkerPool, cancel <-chan struct{}) (result autorest.Response, err error) { - req, err := client.CreateOrUpdateMultiRolePoolPreparer(resourceGroupName, name, multiRolePoolEnvelope, cancel) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.HostingEnvironmentsClient", "CreateOrUpdateMultiRolePool", nil, "Failure preparing request") - } - - resp, err := client.CreateOrUpdateMultiRolePoolSender(req) - if err != nil { - result.Response = resp - return result, autorest.NewErrorWithError(err, "web.HostingEnvironmentsClient", "CreateOrUpdateMultiRolePool", resp, "Failure sending request") - } - - result, err = client.CreateOrUpdateMultiRolePoolResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.HostingEnvironmentsClient", "CreateOrUpdateMultiRolePool", resp, "Failure responding to request") - } - - return -} - -// CreateOrUpdateMultiRolePoolPreparer prepares the CreateOrUpdateMultiRolePool request. -func (client HostingEnvironmentsClient) CreateOrUpdateMultiRolePoolPreparer(resourceGroupName string, name string, multiRolePoolEnvelope WorkerPool, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/multiRolePools/default", pathParameters), - autorest.WithJSON(multiRolePoolEnvelope), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// CreateOrUpdateMultiRolePoolSender sends the CreateOrUpdateMultiRolePool request. The method will close the -// http.Response Body if it receives an error. -func (client HostingEnvironmentsClient) CreateOrUpdateMultiRolePoolSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// CreateOrUpdateMultiRolePoolResponder handles the response to the CreateOrUpdateMultiRolePool request. The method always -// closes the http.Response Body. -func (client HostingEnvironmentsClient) CreateOrUpdateMultiRolePoolResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusBadRequest, http.StatusNotFound, http.StatusConflict), - autorest.ByClosing()) - result.Response = resp - return -} - -// CreateOrUpdateWorkerPool sends the create or update worker pool request. -// This method may poll for completion. Polling can be canceled by passing the -// cancel channel argument. The channel will be used to cancel polling and any -// outstanding HTTP requests. -// -// resourceGroupName is name of resource group name is name of -// hostingEnvironment (App Service Environment) workerPoolName is name of -// worker pool workerPoolEnvelope is properties of worker pool -func (client HostingEnvironmentsClient) CreateOrUpdateWorkerPool(resourceGroupName string, name string, workerPoolName string, workerPoolEnvelope WorkerPool, cancel <-chan struct{}) (result autorest.Response, err error) { - req, err := client.CreateOrUpdateWorkerPoolPreparer(resourceGroupName, name, workerPoolName, workerPoolEnvelope, cancel) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.HostingEnvironmentsClient", "CreateOrUpdateWorkerPool", nil, "Failure preparing request") - } - - resp, err := client.CreateOrUpdateWorkerPoolSender(req) - if err != nil { - result.Response = resp - return result, autorest.NewErrorWithError(err, "web.HostingEnvironmentsClient", "CreateOrUpdateWorkerPool", resp, "Failure sending request") - } - - result, err = client.CreateOrUpdateWorkerPoolResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.HostingEnvironmentsClient", "CreateOrUpdateWorkerPool", resp, "Failure responding to request") - } - - return -} - -// CreateOrUpdateWorkerPoolPreparer prepares the CreateOrUpdateWorkerPool request. -func (client HostingEnvironmentsClient) CreateOrUpdateWorkerPoolPreparer(resourceGroupName string, name string, workerPoolName string, workerPoolEnvelope WorkerPool, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workerPoolName": autorest.Encode("path", workerPoolName), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/workerPools/{workerPoolName}", pathParameters), - autorest.WithJSON(workerPoolEnvelope), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// CreateOrUpdateWorkerPoolSender sends the CreateOrUpdateWorkerPool request. The method will close the -// http.Response Body if it receives an error. -func (client HostingEnvironmentsClient) CreateOrUpdateWorkerPoolSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// CreateOrUpdateWorkerPoolResponder handles the response to the CreateOrUpdateWorkerPool request. The method always -// closes the http.Response Body. -func (client HostingEnvironmentsClient) CreateOrUpdateWorkerPoolResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusBadRequest, http.StatusNotFound, http.StatusConflict), - autorest.ByClosing()) - result.Response = resp - return -} - -// DeleteHostingEnvironment sends the delete hosting environment request. This -// method may poll for completion. Polling can be canceled by passing the -// cancel channel argument. The channel will be used to cancel polling and any -// outstanding HTTP requests. -// -// resourceGroupName is name of resource group name is name of -// hostingEnvironment (App Service Environment) forceDelete is delete even if -// the hostingEnvironment (App Service Environment) contains resources -func (client HostingEnvironmentsClient) DeleteHostingEnvironment(resourceGroupName string, name string, forceDelete *bool, cancel <-chan struct{}) (result autorest.Response, err error) { - req, err := client.DeleteHostingEnvironmentPreparer(resourceGroupName, name, forceDelete, cancel) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.HostingEnvironmentsClient", "DeleteHostingEnvironment", nil, "Failure preparing request") - } - - resp, err := client.DeleteHostingEnvironmentSender(req) - if err != nil { - result.Response = resp - return result, autorest.NewErrorWithError(err, "web.HostingEnvironmentsClient", "DeleteHostingEnvironment", resp, "Failure sending request") - } - - result, err = client.DeleteHostingEnvironmentResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.HostingEnvironmentsClient", "DeleteHostingEnvironment", resp, "Failure responding to request") - } - - return -} - -// DeleteHostingEnvironmentPreparer prepares the DeleteHostingEnvironment request. -func (client HostingEnvironmentsClient) DeleteHostingEnvironmentPreparer(resourceGroupName string, name string, forceDelete *bool, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - if forceDelete != nil { - queryParameters["forceDelete"] = autorest.Encode("query", *forceDelete) - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// DeleteHostingEnvironmentSender sends the DeleteHostingEnvironment request. The method will close the -// http.Response Body if it receives an error. -func (client HostingEnvironmentsClient) DeleteHostingEnvironmentSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// DeleteHostingEnvironmentResponder handles the response to the DeleteHostingEnvironment request. The method always -// closes the http.Response Body. -func (client HostingEnvironmentsClient) DeleteHostingEnvironmentResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusBadRequest, http.StatusNotFound, http.StatusConflict), - autorest.ByClosing()) - result.Response = resp - return -} - -// GetHostingEnvironment sends the get hosting environment request. -// -// resourceGroupName is name of resource group name is name of -// hostingEnvironment (App Service Environment) -func (client HostingEnvironmentsClient) GetHostingEnvironment(resourceGroupName string, name string) (result HostingEnvironment, err error) { - req, err := client.GetHostingEnvironmentPreparer(resourceGroupName, name) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.HostingEnvironmentsClient", "GetHostingEnvironment", nil, "Failure preparing request") - } - - resp, err := client.GetHostingEnvironmentSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.HostingEnvironmentsClient", "GetHostingEnvironment", resp, "Failure sending request") - } - - result, err = client.GetHostingEnvironmentResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.HostingEnvironmentsClient", "GetHostingEnvironment", resp, "Failure responding to request") - } - - return -} - -// GetHostingEnvironmentPreparer prepares the GetHostingEnvironment request. -func (client HostingEnvironmentsClient) GetHostingEnvironmentPreparer(resourceGroupName string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetHostingEnvironmentSender sends the GetHostingEnvironment request. The method will close the -// http.Response Body if it receives an error. -func (client HostingEnvironmentsClient) GetHostingEnvironmentSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetHostingEnvironmentResponder handles the response to the GetHostingEnvironment request. The method always -// closes the http.Response Body. -func (client HostingEnvironmentsClient) GetHostingEnvironmentResponder(resp *http.Response) (result HostingEnvironment, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetHostingEnvironmentCapacities sends the get hosting environment capacities -// request. -// -// resourceGroupName is name of resource group name is name of -// hostingEnvironment (App Service Environment) -func (client HostingEnvironmentsClient) GetHostingEnvironmentCapacities(resourceGroupName string, name string) (result StampCapacityCollection, err error) { - req, err := client.GetHostingEnvironmentCapacitiesPreparer(resourceGroupName, name) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.HostingEnvironmentsClient", "GetHostingEnvironmentCapacities", nil, "Failure preparing request") - } - - resp, err := client.GetHostingEnvironmentCapacitiesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.HostingEnvironmentsClient", "GetHostingEnvironmentCapacities", resp, "Failure sending request") - } - - result, err = client.GetHostingEnvironmentCapacitiesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.HostingEnvironmentsClient", "GetHostingEnvironmentCapacities", resp, "Failure responding to request") - } - - return -} - -// GetHostingEnvironmentCapacitiesPreparer prepares the GetHostingEnvironmentCapacities request. -func (client HostingEnvironmentsClient) GetHostingEnvironmentCapacitiesPreparer(resourceGroupName string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/capacities/compute", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetHostingEnvironmentCapacitiesSender sends the GetHostingEnvironmentCapacities request. The method will close the -// http.Response Body if it receives an error. -func (client HostingEnvironmentsClient) GetHostingEnvironmentCapacitiesSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetHostingEnvironmentCapacitiesResponder handles the response to the GetHostingEnvironmentCapacities request. The method always -// closes the http.Response Body. -func (client HostingEnvironmentsClient) GetHostingEnvironmentCapacitiesResponder(resp *http.Response) (result StampCapacityCollection, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetHostingEnvironmentCapacitiesNextResults retrieves the next set of results, if any. -func (client HostingEnvironmentsClient) GetHostingEnvironmentCapacitiesNextResults(lastResults StampCapacityCollection) (result StampCapacityCollection, err error) { - req, err := lastResults.StampCapacityCollectionPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "web.HostingEnvironmentsClient", "GetHostingEnvironmentCapacities", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.GetHostingEnvironmentCapacitiesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.HostingEnvironmentsClient", "GetHostingEnvironmentCapacities", resp, "Failure sending next results request") - } - - result, err = client.GetHostingEnvironmentCapacitiesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.HostingEnvironmentsClient", "GetHostingEnvironmentCapacities", resp, "Failure responding to next results request") - } - - return -} - -// GetHostingEnvironmentDiagnostics sends the get hosting environment -// diagnostics request. -// -// resourceGroupName is name of resource group name is name of -// hostingEnvironment (App Service Environment) -func (client HostingEnvironmentsClient) GetHostingEnvironmentDiagnostics(resourceGroupName string, name string) (result ListHostingEnvironmentDiagnostics, err error) { - req, err := client.GetHostingEnvironmentDiagnosticsPreparer(resourceGroupName, name) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.HostingEnvironmentsClient", "GetHostingEnvironmentDiagnostics", nil, "Failure preparing request") - } - - resp, err := client.GetHostingEnvironmentDiagnosticsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.HostingEnvironmentsClient", "GetHostingEnvironmentDiagnostics", resp, "Failure sending request") - } - - result, err = client.GetHostingEnvironmentDiagnosticsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.HostingEnvironmentsClient", "GetHostingEnvironmentDiagnostics", resp, "Failure responding to request") - } - - return -} - -// GetHostingEnvironmentDiagnosticsPreparer prepares the GetHostingEnvironmentDiagnostics request. -func (client HostingEnvironmentsClient) GetHostingEnvironmentDiagnosticsPreparer(resourceGroupName string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/diagnostics", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetHostingEnvironmentDiagnosticsSender sends the GetHostingEnvironmentDiagnostics request. The method will close the -// http.Response Body if it receives an error. -func (client HostingEnvironmentsClient) GetHostingEnvironmentDiagnosticsSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetHostingEnvironmentDiagnosticsResponder handles the response to the GetHostingEnvironmentDiagnostics request. The method always -// closes the http.Response Body. -func (client HostingEnvironmentsClient) GetHostingEnvironmentDiagnosticsResponder(resp *http.Response) (result ListHostingEnvironmentDiagnostics, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Value), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetHostingEnvironmentDiagnosticsItem sends the get hosting environment -// diagnostics item request. -// -// resourceGroupName is name of resource group name is name of -// hostingEnvironment (App Service Environment) diagnosticsName is name of the -// diagnostics -func (client HostingEnvironmentsClient) GetHostingEnvironmentDiagnosticsItem(resourceGroupName string, name string, diagnosticsName string) (result HostingEnvironmentDiagnostics, err error) { - req, err := client.GetHostingEnvironmentDiagnosticsItemPreparer(resourceGroupName, name, diagnosticsName) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.HostingEnvironmentsClient", "GetHostingEnvironmentDiagnosticsItem", nil, "Failure preparing request") - } - - resp, err := client.GetHostingEnvironmentDiagnosticsItemSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.HostingEnvironmentsClient", "GetHostingEnvironmentDiagnosticsItem", resp, "Failure sending request") - } - - result, err = client.GetHostingEnvironmentDiagnosticsItemResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.HostingEnvironmentsClient", "GetHostingEnvironmentDiagnosticsItem", resp, "Failure responding to request") - } - - return -} - -// GetHostingEnvironmentDiagnosticsItemPreparer prepares the GetHostingEnvironmentDiagnosticsItem request. -func (client HostingEnvironmentsClient) GetHostingEnvironmentDiagnosticsItemPreparer(resourceGroupName string, name string, diagnosticsName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "diagnosticsName": autorest.Encode("path", diagnosticsName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/diagnostics/{diagnosticsName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetHostingEnvironmentDiagnosticsItemSender sends the GetHostingEnvironmentDiagnosticsItem request. The method will close the -// http.Response Body if it receives an error. -func (client HostingEnvironmentsClient) GetHostingEnvironmentDiagnosticsItemSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetHostingEnvironmentDiagnosticsItemResponder handles the response to the GetHostingEnvironmentDiagnosticsItem request. The method always -// closes the http.Response Body. -func (client HostingEnvironmentsClient) GetHostingEnvironmentDiagnosticsItemResponder(resp *http.Response) (result HostingEnvironmentDiagnostics, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetHostingEnvironmentMetricDefinitions sends the get hosting environment -// metric definitions request. -// -// resourceGroupName is name of resource group name is name of -// hostingEnvironment (App Service Environment) -func (client HostingEnvironmentsClient) GetHostingEnvironmentMetricDefinitions(resourceGroupName string, name string) (result MetricDefinition, err error) { - req, err := client.GetHostingEnvironmentMetricDefinitionsPreparer(resourceGroupName, name) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.HostingEnvironmentsClient", "GetHostingEnvironmentMetricDefinitions", nil, "Failure preparing request") - } - - resp, err := client.GetHostingEnvironmentMetricDefinitionsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.HostingEnvironmentsClient", "GetHostingEnvironmentMetricDefinitions", resp, "Failure sending request") - } - - result, err = client.GetHostingEnvironmentMetricDefinitionsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.HostingEnvironmentsClient", "GetHostingEnvironmentMetricDefinitions", resp, "Failure responding to request") - } - - return -} - -// GetHostingEnvironmentMetricDefinitionsPreparer prepares the GetHostingEnvironmentMetricDefinitions request. -func (client HostingEnvironmentsClient) GetHostingEnvironmentMetricDefinitionsPreparer(resourceGroupName string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/metricdefinitions", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetHostingEnvironmentMetricDefinitionsSender sends the GetHostingEnvironmentMetricDefinitions request. The method will close the -// http.Response Body if it receives an error. -func (client HostingEnvironmentsClient) GetHostingEnvironmentMetricDefinitionsSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetHostingEnvironmentMetricDefinitionsResponder handles the response to the GetHostingEnvironmentMetricDefinitions request. The method always -// closes the http.Response Body. -func (client HostingEnvironmentsClient) GetHostingEnvironmentMetricDefinitionsResponder(resp *http.Response) (result MetricDefinition, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetHostingEnvironmentMetrics sends the get hosting environment metrics -// request. -// -// resourceGroupName is name of resource group name is name of -// hostingEnvironment (App Service Environment) details is include instance -// details filter is return only usages/metrics specified in the filter. Filter -// conforms to odata syntax. Example: $filter=(name.value eq 'Metric1' or -// name.value eq 'Metric2') and startTime eq '2014-01-01T00:00:00Z' and endTime -// eq '2014-12-31T23:59:59Z' and timeGrain eq duration'[Hour|Minute|Day]'. -func (client HostingEnvironmentsClient) GetHostingEnvironmentMetrics(resourceGroupName string, name string, details *bool, filter string) (result ResourceMetricCollection, err error) { - req, err := client.GetHostingEnvironmentMetricsPreparer(resourceGroupName, name, details, filter) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.HostingEnvironmentsClient", "GetHostingEnvironmentMetrics", nil, "Failure preparing request") - } - - resp, err := client.GetHostingEnvironmentMetricsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.HostingEnvironmentsClient", "GetHostingEnvironmentMetrics", resp, "Failure sending request") - } - - result, err = client.GetHostingEnvironmentMetricsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.HostingEnvironmentsClient", "GetHostingEnvironmentMetrics", resp, "Failure responding to request") - } - - return -} - -// GetHostingEnvironmentMetricsPreparer prepares the GetHostingEnvironmentMetrics request. -func (client HostingEnvironmentsClient) GetHostingEnvironmentMetricsPreparer(resourceGroupName string, name string, details *bool, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - if details != nil { - queryParameters["details"] = autorest.Encode("query", *details) - } - if len(filter) > 0 { - queryParameters["$filter"] = filter - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/metrics", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetHostingEnvironmentMetricsSender sends the GetHostingEnvironmentMetrics request. The method will close the -// http.Response Body if it receives an error. -func (client HostingEnvironmentsClient) GetHostingEnvironmentMetricsSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetHostingEnvironmentMetricsResponder handles the response to the GetHostingEnvironmentMetrics request. The method always -// closes the http.Response Body. -func (client HostingEnvironmentsClient) GetHostingEnvironmentMetricsResponder(resp *http.Response) (result ResourceMetricCollection, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetHostingEnvironmentMetricsNextResults retrieves the next set of results, if any. -func (client HostingEnvironmentsClient) GetHostingEnvironmentMetricsNextResults(lastResults ResourceMetricCollection) (result ResourceMetricCollection, err error) { - req, err := lastResults.ResourceMetricCollectionPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "web.HostingEnvironmentsClient", "GetHostingEnvironmentMetrics", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.GetHostingEnvironmentMetricsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.HostingEnvironmentsClient", "GetHostingEnvironmentMetrics", resp, "Failure sending next results request") - } - - result, err = client.GetHostingEnvironmentMetricsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.HostingEnvironmentsClient", "GetHostingEnvironmentMetrics", resp, "Failure responding to next results request") - } - - return -} - -// GetHostingEnvironmentMultiRoleMetricDefinitions sends the get hosting -// environment multi role metric definitions request. -// -// resourceGroupName is name of resource group name is name of -// hostingEnvironment (App Service Environment) -func (client HostingEnvironmentsClient) GetHostingEnvironmentMultiRoleMetricDefinitions(resourceGroupName string, name string) (result MetricDefinitionCollection, err error) { - req, err := client.GetHostingEnvironmentMultiRoleMetricDefinitionsPreparer(resourceGroupName, name) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.HostingEnvironmentsClient", "GetHostingEnvironmentMultiRoleMetricDefinitions", nil, "Failure preparing request") - } - - resp, err := client.GetHostingEnvironmentMultiRoleMetricDefinitionsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.HostingEnvironmentsClient", "GetHostingEnvironmentMultiRoleMetricDefinitions", resp, "Failure sending request") - } - - result, err = client.GetHostingEnvironmentMultiRoleMetricDefinitionsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.HostingEnvironmentsClient", "GetHostingEnvironmentMultiRoleMetricDefinitions", resp, "Failure responding to request") - } - - return -} - -// GetHostingEnvironmentMultiRoleMetricDefinitionsPreparer prepares the GetHostingEnvironmentMultiRoleMetricDefinitions request. -func (client HostingEnvironmentsClient) GetHostingEnvironmentMultiRoleMetricDefinitionsPreparer(resourceGroupName string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/multiRolePools/default/metricdefinitions", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetHostingEnvironmentMultiRoleMetricDefinitionsSender sends the GetHostingEnvironmentMultiRoleMetricDefinitions request. The method will close the -// http.Response Body if it receives an error. -func (client HostingEnvironmentsClient) GetHostingEnvironmentMultiRoleMetricDefinitionsSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetHostingEnvironmentMultiRoleMetricDefinitionsResponder handles the response to the GetHostingEnvironmentMultiRoleMetricDefinitions request. The method always -// closes the http.Response Body. -func (client HostingEnvironmentsClient) GetHostingEnvironmentMultiRoleMetricDefinitionsResponder(resp *http.Response) (result MetricDefinitionCollection, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetHostingEnvironmentMultiRoleMetricDefinitionsNextResults retrieves the next set of results, if any. -func (client HostingEnvironmentsClient) GetHostingEnvironmentMultiRoleMetricDefinitionsNextResults(lastResults MetricDefinitionCollection) (result MetricDefinitionCollection, err error) { - req, err := lastResults.MetricDefinitionCollectionPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "web.HostingEnvironmentsClient", "GetHostingEnvironmentMultiRoleMetricDefinitions", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.GetHostingEnvironmentMultiRoleMetricDefinitionsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.HostingEnvironmentsClient", "GetHostingEnvironmentMultiRoleMetricDefinitions", resp, "Failure sending next results request") - } - - result, err = client.GetHostingEnvironmentMultiRoleMetricDefinitionsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.HostingEnvironmentsClient", "GetHostingEnvironmentMultiRoleMetricDefinitions", resp, "Failure responding to next results request") - } - - return -} - -// GetHostingEnvironmentMultiRoleMetrics sends the get hosting environment -// multi role metrics request. -// -// resourceGroupName is name of resource group name is name of -// hostingEnvironment (App Service Environment) startTime is beginning time of -// metrics query endTime is end time of metrics query timeGrain is time -// granularity of metrics query details is include instance details filter is -// return only usages/metrics specified in the filter. Filter conforms to odata -// syntax. Example: $filter=(name.value eq 'Metric1' or name.value eq -// 'Metric2') and startTime eq '2014-01-01T00:00:00Z' and endTime eq -// '2014-12-31T23:59:59Z' and timeGrain eq duration'[Hour|Minute|Day]'. -func (client HostingEnvironmentsClient) GetHostingEnvironmentMultiRoleMetrics(resourceGroupName string, name string, startTime string, endTime string, timeGrain string, details *bool, filter string) (result ResourceMetricCollection, err error) { - req, err := client.GetHostingEnvironmentMultiRoleMetricsPreparer(resourceGroupName, name, startTime, endTime, timeGrain, details, filter) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.HostingEnvironmentsClient", "GetHostingEnvironmentMultiRoleMetrics", nil, "Failure preparing request") - } - - resp, err := client.GetHostingEnvironmentMultiRoleMetricsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.HostingEnvironmentsClient", "GetHostingEnvironmentMultiRoleMetrics", resp, "Failure sending request") - } - - result, err = client.GetHostingEnvironmentMultiRoleMetricsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.HostingEnvironmentsClient", "GetHostingEnvironmentMultiRoleMetrics", resp, "Failure responding to request") - } - - return -} - -// GetHostingEnvironmentMultiRoleMetricsPreparer prepares the GetHostingEnvironmentMultiRoleMetrics request. -func (client HostingEnvironmentsClient) GetHostingEnvironmentMultiRoleMetricsPreparer(resourceGroupName string, name string, startTime string, endTime string, timeGrain string, details *bool, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - if len(startTime) > 0 { - queryParameters["startTime"] = autorest.Encode("query", startTime) - } - if len(endTime) > 0 { - queryParameters["endTime"] = autorest.Encode("query", endTime) - } - if len(timeGrain) > 0 { - queryParameters["timeGrain"] = autorest.Encode("query", timeGrain) - } - if details != nil { - queryParameters["details"] = autorest.Encode("query", *details) - } - if len(filter) > 0 { - queryParameters["$filter"] = filter - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/multiRolePools/default/metrics", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetHostingEnvironmentMultiRoleMetricsSender sends the GetHostingEnvironmentMultiRoleMetrics request. The method will close the -// http.Response Body if it receives an error. -func (client HostingEnvironmentsClient) GetHostingEnvironmentMultiRoleMetricsSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetHostingEnvironmentMultiRoleMetricsResponder handles the response to the GetHostingEnvironmentMultiRoleMetrics request. The method always -// closes the http.Response Body. -func (client HostingEnvironmentsClient) GetHostingEnvironmentMultiRoleMetricsResponder(resp *http.Response) (result ResourceMetricCollection, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetHostingEnvironmentMultiRoleMetricsNextResults retrieves the next set of results, if any. -func (client HostingEnvironmentsClient) GetHostingEnvironmentMultiRoleMetricsNextResults(lastResults ResourceMetricCollection) (result ResourceMetricCollection, err error) { - req, err := lastResults.ResourceMetricCollectionPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "web.HostingEnvironmentsClient", "GetHostingEnvironmentMultiRoleMetrics", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.GetHostingEnvironmentMultiRoleMetricsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.HostingEnvironmentsClient", "GetHostingEnvironmentMultiRoleMetrics", resp, "Failure sending next results request") - } - - result, err = client.GetHostingEnvironmentMultiRoleMetricsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.HostingEnvironmentsClient", "GetHostingEnvironmentMultiRoleMetrics", resp, "Failure responding to next results request") - } - - return -} - -// GetHostingEnvironmentMultiRoleUsages sends the get hosting environment multi -// role usages request. -// -// resourceGroupName is name of resource group name is name of -// hostingEnvironment (App Service Environment) -func (client HostingEnvironmentsClient) GetHostingEnvironmentMultiRoleUsages(resourceGroupName string, name string) (result UsageCollection, err error) { - req, err := client.GetHostingEnvironmentMultiRoleUsagesPreparer(resourceGroupName, name) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.HostingEnvironmentsClient", "GetHostingEnvironmentMultiRoleUsages", nil, "Failure preparing request") - } - - resp, err := client.GetHostingEnvironmentMultiRoleUsagesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.HostingEnvironmentsClient", "GetHostingEnvironmentMultiRoleUsages", resp, "Failure sending request") - } - - result, err = client.GetHostingEnvironmentMultiRoleUsagesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.HostingEnvironmentsClient", "GetHostingEnvironmentMultiRoleUsages", resp, "Failure responding to request") - } - - return -} - -// GetHostingEnvironmentMultiRoleUsagesPreparer prepares the GetHostingEnvironmentMultiRoleUsages request. -func (client HostingEnvironmentsClient) GetHostingEnvironmentMultiRoleUsagesPreparer(resourceGroupName string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/multiRolePools/default/usages", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetHostingEnvironmentMultiRoleUsagesSender sends the GetHostingEnvironmentMultiRoleUsages request. The method will close the -// http.Response Body if it receives an error. -func (client HostingEnvironmentsClient) GetHostingEnvironmentMultiRoleUsagesSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetHostingEnvironmentMultiRoleUsagesResponder handles the response to the GetHostingEnvironmentMultiRoleUsages request. The method always -// closes the http.Response Body. -func (client HostingEnvironmentsClient) GetHostingEnvironmentMultiRoleUsagesResponder(resp *http.Response) (result UsageCollection, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetHostingEnvironmentMultiRoleUsagesNextResults retrieves the next set of results, if any. -func (client HostingEnvironmentsClient) GetHostingEnvironmentMultiRoleUsagesNextResults(lastResults UsageCollection) (result UsageCollection, err error) { - req, err := lastResults.UsageCollectionPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "web.HostingEnvironmentsClient", "GetHostingEnvironmentMultiRoleUsages", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.GetHostingEnvironmentMultiRoleUsagesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.HostingEnvironmentsClient", "GetHostingEnvironmentMultiRoleUsages", resp, "Failure sending next results request") - } - - result, err = client.GetHostingEnvironmentMultiRoleUsagesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.HostingEnvironmentsClient", "GetHostingEnvironmentMultiRoleUsages", resp, "Failure responding to next results request") - } - - return -} - -// GetHostingEnvironmentOperation sends the get hosting environment operation -// request. -// -// resourceGroupName is name of resource group name is name of -// hostingEnvironment (App Service Environment) operationID is operation -// identifier GUID -func (client HostingEnvironmentsClient) GetHostingEnvironmentOperation(resourceGroupName string, name string, operationID string) (result SetObject, err error) { - req, err := client.GetHostingEnvironmentOperationPreparer(resourceGroupName, name, operationID) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.HostingEnvironmentsClient", "GetHostingEnvironmentOperation", nil, "Failure preparing request") - } - - resp, err := client.GetHostingEnvironmentOperationSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.HostingEnvironmentsClient", "GetHostingEnvironmentOperation", resp, "Failure sending request") - } - - result, err = client.GetHostingEnvironmentOperationResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.HostingEnvironmentsClient", "GetHostingEnvironmentOperation", resp, "Failure responding to request") - } - - return -} - -// GetHostingEnvironmentOperationPreparer prepares the GetHostingEnvironmentOperation request. -func (client HostingEnvironmentsClient) GetHostingEnvironmentOperationPreparer(resourceGroupName string, name string, operationID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "operationId": autorest.Encode("path", operationID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/operations/{operationId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetHostingEnvironmentOperationSender sends the GetHostingEnvironmentOperation request. The method will close the -// http.Response Body if it receives an error. -func (client HostingEnvironmentsClient) GetHostingEnvironmentOperationSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetHostingEnvironmentOperationResponder handles the response to the GetHostingEnvironmentOperation request. The method always -// closes the http.Response Body. -func (client HostingEnvironmentsClient) GetHostingEnvironmentOperationResponder(resp *http.Response) (result SetObject, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNotFound, http.StatusInternalServerError), - autorest.ByUnmarshallingJSON(&result.Value), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetHostingEnvironmentOperations sends the get hosting environment operations -// request. -// -// resourceGroupName is name of resource group name is name of -// hostingEnvironment (App Service Environment) -func (client HostingEnvironmentsClient) GetHostingEnvironmentOperations(resourceGroupName string, name string) (result SetObject, err error) { - req, err := client.GetHostingEnvironmentOperationsPreparer(resourceGroupName, name) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.HostingEnvironmentsClient", "GetHostingEnvironmentOperations", nil, "Failure preparing request") - } - - resp, err := client.GetHostingEnvironmentOperationsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.HostingEnvironmentsClient", "GetHostingEnvironmentOperations", resp, "Failure sending request") - } - - result, err = client.GetHostingEnvironmentOperationsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.HostingEnvironmentsClient", "GetHostingEnvironmentOperations", resp, "Failure responding to request") - } - - return -} - -// GetHostingEnvironmentOperationsPreparer prepares the GetHostingEnvironmentOperations request. -func (client HostingEnvironmentsClient) GetHostingEnvironmentOperationsPreparer(resourceGroupName string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/operations", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetHostingEnvironmentOperationsSender sends the GetHostingEnvironmentOperations request. The method will close the -// http.Response Body if it receives an error. -func (client HostingEnvironmentsClient) GetHostingEnvironmentOperationsSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetHostingEnvironmentOperationsResponder handles the response to the GetHostingEnvironmentOperations request. The method always -// closes the http.Response Body. -func (client HostingEnvironmentsClient) GetHostingEnvironmentOperationsResponder(resp *http.Response) (result SetObject, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Value), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetHostingEnvironments sends the get hosting environments request. -// -// resourceGroupName is name of resource group -func (client HostingEnvironmentsClient) GetHostingEnvironments(resourceGroupName string) (result HostingEnvironmentCollection, err error) { - req, err := client.GetHostingEnvironmentsPreparer(resourceGroupName) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.HostingEnvironmentsClient", "GetHostingEnvironments", nil, "Failure preparing request") - } - - resp, err := client.GetHostingEnvironmentsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.HostingEnvironmentsClient", "GetHostingEnvironments", resp, "Failure sending request") - } - - result, err = client.GetHostingEnvironmentsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.HostingEnvironmentsClient", "GetHostingEnvironments", resp, "Failure responding to request") - } - - return -} - -// GetHostingEnvironmentsPreparer prepares the GetHostingEnvironments request. -func (client HostingEnvironmentsClient) GetHostingEnvironmentsPreparer(resourceGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetHostingEnvironmentsSender sends the GetHostingEnvironments request. The method will close the -// http.Response Body if it receives an error. -func (client HostingEnvironmentsClient) GetHostingEnvironmentsSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetHostingEnvironmentsResponder handles the response to the GetHostingEnvironments request. The method always -// closes the http.Response Body. -func (client HostingEnvironmentsClient) GetHostingEnvironmentsResponder(resp *http.Response) (result HostingEnvironmentCollection, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetHostingEnvironmentsNextResults retrieves the next set of results, if any. -func (client HostingEnvironmentsClient) GetHostingEnvironmentsNextResults(lastResults HostingEnvironmentCollection) (result HostingEnvironmentCollection, err error) { - req, err := lastResults.HostingEnvironmentCollectionPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "web.HostingEnvironmentsClient", "GetHostingEnvironments", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.GetHostingEnvironmentsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.HostingEnvironmentsClient", "GetHostingEnvironments", resp, "Failure sending next results request") - } - - result, err = client.GetHostingEnvironmentsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.HostingEnvironmentsClient", "GetHostingEnvironments", resp, "Failure responding to next results request") - } - - return -} - -// GetHostingEnvironmentServerFarms sends the get hosting environment server -// farms request. -// -// resourceGroupName is name of resource group name is name of -// hostingEnvironment (App Service Environment) -func (client HostingEnvironmentsClient) GetHostingEnvironmentServerFarms(resourceGroupName string, name string) (result ServerFarmCollection, err error) { - req, err := client.GetHostingEnvironmentServerFarmsPreparer(resourceGroupName, name) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.HostingEnvironmentsClient", "GetHostingEnvironmentServerFarms", nil, "Failure preparing request") - } - - resp, err := client.GetHostingEnvironmentServerFarmsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.HostingEnvironmentsClient", "GetHostingEnvironmentServerFarms", resp, "Failure sending request") - } - - result, err = client.GetHostingEnvironmentServerFarmsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.HostingEnvironmentsClient", "GetHostingEnvironmentServerFarms", resp, "Failure responding to request") - } - - return -} - -// GetHostingEnvironmentServerFarmsPreparer prepares the GetHostingEnvironmentServerFarms request. -func (client HostingEnvironmentsClient) GetHostingEnvironmentServerFarmsPreparer(resourceGroupName string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/serverfarms", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetHostingEnvironmentServerFarmsSender sends the GetHostingEnvironmentServerFarms request. The method will close the -// http.Response Body if it receives an error. -func (client HostingEnvironmentsClient) GetHostingEnvironmentServerFarmsSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetHostingEnvironmentServerFarmsResponder handles the response to the GetHostingEnvironmentServerFarms request. The method always -// closes the http.Response Body. -func (client HostingEnvironmentsClient) GetHostingEnvironmentServerFarmsResponder(resp *http.Response) (result ServerFarmCollection, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetHostingEnvironmentServerFarmsNextResults retrieves the next set of results, if any. -func (client HostingEnvironmentsClient) GetHostingEnvironmentServerFarmsNextResults(lastResults ServerFarmCollection) (result ServerFarmCollection, err error) { - req, err := lastResults.ServerFarmCollectionPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "web.HostingEnvironmentsClient", "GetHostingEnvironmentServerFarms", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.GetHostingEnvironmentServerFarmsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.HostingEnvironmentsClient", "GetHostingEnvironmentServerFarms", resp, "Failure sending next results request") - } - - result, err = client.GetHostingEnvironmentServerFarmsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.HostingEnvironmentsClient", "GetHostingEnvironmentServerFarms", resp, "Failure responding to next results request") - } - - return -} - -// GetHostingEnvironmentSites sends the get hosting environment sites request. -// -// resourceGroupName is name of resource group name is name of -// hostingEnvironment (App Service Environment) propertiesToInclude is comma -// separated list of site properties to include -func (client HostingEnvironmentsClient) GetHostingEnvironmentSites(resourceGroupName string, name string, propertiesToInclude string) (result SiteCollection, err error) { - req, err := client.GetHostingEnvironmentSitesPreparer(resourceGroupName, name, propertiesToInclude) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.HostingEnvironmentsClient", "GetHostingEnvironmentSites", nil, "Failure preparing request") - } - - resp, err := client.GetHostingEnvironmentSitesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.HostingEnvironmentsClient", "GetHostingEnvironmentSites", resp, "Failure sending request") - } - - result, err = client.GetHostingEnvironmentSitesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.HostingEnvironmentsClient", "GetHostingEnvironmentSites", resp, "Failure responding to request") - } - - return -} - -// GetHostingEnvironmentSitesPreparer prepares the GetHostingEnvironmentSites request. -func (client HostingEnvironmentsClient) GetHostingEnvironmentSitesPreparer(resourceGroupName string, name string, propertiesToInclude string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - if len(propertiesToInclude) > 0 { - queryParameters["propertiesToInclude"] = autorest.Encode("query", propertiesToInclude) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/sites", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetHostingEnvironmentSitesSender sends the GetHostingEnvironmentSites request. The method will close the -// http.Response Body if it receives an error. -func (client HostingEnvironmentsClient) GetHostingEnvironmentSitesSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetHostingEnvironmentSitesResponder handles the response to the GetHostingEnvironmentSites request. The method always -// closes the http.Response Body. -func (client HostingEnvironmentsClient) GetHostingEnvironmentSitesResponder(resp *http.Response) (result SiteCollection, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetHostingEnvironmentSitesNextResults retrieves the next set of results, if any. -func (client HostingEnvironmentsClient) GetHostingEnvironmentSitesNextResults(lastResults SiteCollection) (result SiteCollection, err error) { - req, err := lastResults.SiteCollectionPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "web.HostingEnvironmentsClient", "GetHostingEnvironmentSites", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.GetHostingEnvironmentSitesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.HostingEnvironmentsClient", "GetHostingEnvironmentSites", resp, "Failure sending next results request") - } - - result, err = client.GetHostingEnvironmentSitesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.HostingEnvironmentsClient", "GetHostingEnvironmentSites", resp, "Failure responding to next results request") - } - - return -} - -// GetHostingEnvironmentUsages sends the get hosting environment usages -// request. -// -// resourceGroupName is name of resource group name is name of -// hostingEnvironment (App Service Environment) filter is return only -// usages/metrics specified in the filter. Filter conforms to odata syntax. -// Example: $filter=(name.value eq 'Metric1' or name.value eq 'Metric2') and -// startTime eq '2014-01-01T00:00:00Z' and endTime eq '2014-12-31T23:59:59Z' -// and timeGrain eq duration'[Hour|Minute|Day]'. -func (client HostingEnvironmentsClient) GetHostingEnvironmentUsages(resourceGroupName string, name string, filter string) (result CsmUsageQuotaCollection, err error) { - req, err := client.GetHostingEnvironmentUsagesPreparer(resourceGroupName, name, filter) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.HostingEnvironmentsClient", "GetHostingEnvironmentUsages", nil, "Failure preparing request") - } - - resp, err := client.GetHostingEnvironmentUsagesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.HostingEnvironmentsClient", "GetHostingEnvironmentUsages", resp, "Failure sending request") - } - - result, err = client.GetHostingEnvironmentUsagesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.HostingEnvironmentsClient", "GetHostingEnvironmentUsages", resp, "Failure responding to request") - } - - return -} - -// GetHostingEnvironmentUsagesPreparer prepares the GetHostingEnvironmentUsages request. -func (client HostingEnvironmentsClient) GetHostingEnvironmentUsagesPreparer(resourceGroupName string, name string, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = filter - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/usages", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetHostingEnvironmentUsagesSender sends the GetHostingEnvironmentUsages request. The method will close the -// http.Response Body if it receives an error. -func (client HostingEnvironmentsClient) GetHostingEnvironmentUsagesSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetHostingEnvironmentUsagesResponder handles the response to the GetHostingEnvironmentUsages request. The method always -// closes the http.Response Body. -func (client HostingEnvironmentsClient) GetHostingEnvironmentUsagesResponder(resp *http.Response) (result CsmUsageQuotaCollection, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetHostingEnvironmentUsagesNextResults retrieves the next set of results, if any. -func (client HostingEnvironmentsClient) GetHostingEnvironmentUsagesNextResults(lastResults CsmUsageQuotaCollection) (result CsmUsageQuotaCollection, err error) { - req, err := lastResults.CsmUsageQuotaCollectionPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "web.HostingEnvironmentsClient", "GetHostingEnvironmentUsages", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.GetHostingEnvironmentUsagesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.HostingEnvironmentsClient", "GetHostingEnvironmentUsages", resp, "Failure sending next results request") - } - - result, err = client.GetHostingEnvironmentUsagesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.HostingEnvironmentsClient", "GetHostingEnvironmentUsages", resp, "Failure responding to next results request") - } - - return -} - -// GetHostingEnvironmentVips sends the get hosting environment vips request. -// -// resourceGroupName is name of resource group name is name of -// hostingEnvironment (App Service Environment) -func (client HostingEnvironmentsClient) GetHostingEnvironmentVips(resourceGroupName string, name string) (result AddressResponse, err error) { - req, err := client.GetHostingEnvironmentVipsPreparer(resourceGroupName, name) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.HostingEnvironmentsClient", "GetHostingEnvironmentVips", nil, "Failure preparing request") - } - - resp, err := client.GetHostingEnvironmentVipsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.HostingEnvironmentsClient", "GetHostingEnvironmentVips", resp, "Failure sending request") - } - - result, err = client.GetHostingEnvironmentVipsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.HostingEnvironmentsClient", "GetHostingEnvironmentVips", resp, "Failure responding to request") - } - - return -} - -// GetHostingEnvironmentVipsPreparer prepares the GetHostingEnvironmentVips request. -func (client HostingEnvironmentsClient) GetHostingEnvironmentVipsPreparer(resourceGroupName string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/capacities/virtualip", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetHostingEnvironmentVipsSender sends the GetHostingEnvironmentVips request. The method will close the -// http.Response Body if it receives an error. -func (client HostingEnvironmentsClient) GetHostingEnvironmentVipsSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetHostingEnvironmentVipsResponder handles the response to the GetHostingEnvironmentVips request. The method always -// closes the http.Response Body. -func (client HostingEnvironmentsClient) GetHostingEnvironmentVipsResponder(resp *http.Response) (result AddressResponse, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetHostingEnvironmentWebHostingPlans sends the get hosting environment web -// hosting plans request. -// -// resourceGroupName is name of resource group name is name of -// hostingEnvironment (App Service Environment) -func (client HostingEnvironmentsClient) GetHostingEnvironmentWebHostingPlans(resourceGroupName string, name string) (result ServerFarmCollection, err error) { - req, err := client.GetHostingEnvironmentWebHostingPlansPreparer(resourceGroupName, name) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.HostingEnvironmentsClient", "GetHostingEnvironmentWebHostingPlans", nil, "Failure preparing request") - } - - resp, err := client.GetHostingEnvironmentWebHostingPlansSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.HostingEnvironmentsClient", "GetHostingEnvironmentWebHostingPlans", resp, "Failure sending request") - } - - result, err = client.GetHostingEnvironmentWebHostingPlansResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.HostingEnvironmentsClient", "GetHostingEnvironmentWebHostingPlans", resp, "Failure responding to request") - } - - return -} - -// GetHostingEnvironmentWebHostingPlansPreparer prepares the GetHostingEnvironmentWebHostingPlans request. -func (client HostingEnvironmentsClient) GetHostingEnvironmentWebHostingPlansPreparer(resourceGroupName string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/webhostingplans", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetHostingEnvironmentWebHostingPlansSender sends the GetHostingEnvironmentWebHostingPlans request. The method will close the -// http.Response Body if it receives an error. -func (client HostingEnvironmentsClient) GetHostingEnvironmentWebHostingPlansSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetHostingEnvironmentWebHostingPlansResponder handles the response to the GetHostingEnvironmentWebHostingPlans request. The method always -// closes the http.Response Body. -func (client HostingEnvironmentsClient) GetHostingEnvironmentWebHostingPlansResponder(resp *http.Response) (result ServerFarmCollection, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetHostingEnvironmentWebHostingPlansNextResults retrieves the next set of results, if any. -func (client HostingEnvironmentsClient) GetHostingEnvironmentWebHostingPlansNextResults(lastResults ServerFarmCollection) (result ServerFarmCollection, err error) { - req, err := lastResults.ServerFarmCollectionPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "web.HostingEnvironmentsClient", "GetHostingEnvironmentWebHostingPlans", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.GetHostingEnvironmentWebHostingPlansSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.HostingEnvironmentsClient", "GetHostingEnvironmentWebHostingPlans", resp, "Failure sending next results request") - } - - result, err = client.GetHostingEnvironmentWebHostingPlansResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.HostingEnvironmentsClient", "GetHostingEnvironmentWebHostingPlans", resp, "Failure responding to next results request") - } - - return -} - -// GetHostingEnvironmentWebWorkerMetricDefinitions sends the get hosting -// environment web worker metric definitions request. -// -// resourceGroupName is name of resource group name is name of -// hostingEnvironment (App Service Environment) workerPoolName is name of -// worker pool -func (client HostingEnvironmentsClient) GetHostingEnvironmentWebWorkerMetricDefinitions(resourceGroupName string, name string, workerPoolName string) (result MetricDefinitionCollection, err error) { - req, err := client.GetHostingEnvironmentWebWorkerMetricDefinitionsPreparer(resourceGroupName, name, workerPoolName) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.HostingEnvironmentsClient", "GetHostingEnvironmentWebWorkerMetricDefinitions", nil, "Failure preparing request") - } - - resp, err := client.GetHostingEnvironmentWebWorkerMetricDefinitionsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.HostingEnvironmentsClient", "GetHostingEnvironmentWebWorkerMetricDefinitions", resp, "Failure sending request") - } - - result, err = client.GetHostingEnvironmentWebWorkerMetricDefinitionsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.HostingEnvironmentsClient", "GetHostingEnvironmentWebWorkerMetricDefinitions", resp, "Failure responding to request") - } - - return -} - -// GetHostingEnvironmentWebWorkerMetricDefinitionsPreparer prepares the GetHostingEnvironmentWebWorkerMetricDefinitions request. -func (client HostingEnvironmentsClient) GetHostingEnvironmentWebWorkerMetricDefinitionsPreparer(resourceGroupName string, name string, workerPoolName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workerPoolName": autorest.Encode("path", workerPoolName), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/workerPools/{workerPoolName}/metricdefinitions", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetHostingEnvironmentWebWorkerMetricDefinitionsSender sends the GetHostingEnvironmentWebWorkerMetricDefinitions request. The method will close the -// http.Response Body if it receives an error. -func (client HostingEnvironmentsClient) GetHostingEnvironmentWebWorkerMetricDefinitionsSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetHostingEnvironmentWebWorkerMetricDefinitionsResponder handles the response to the GetHostingEnvironmentWebWorkerMetricDefinitions request. The method always -// closes the http.Response Body. -func (client HostingEnvironmentsClient) GetHostingEnvironmentWebWorkerMetricDefinitionsResponder(resp *http.Response) (result MetricDefinitionCollection, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetHostingEnvironmentWebWorkerMetricDefinitionsNextResults retrieves the next set of results, if any. -func (client HostingEnvironmentsClient) GetHostingEnvironmentWebWorkerMetricDefinitionsNextResults(lastResults MetricDefinitionCollection) (result MetricDefinitionCollection, err error) { - req, err := lastResults.MetricDefinitionCollectionPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "web.HostingEnvironmentsClient", "GetHostingEnvironmentWebWorkerMetricDefinitions", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.GetHostingEnvironmentWebWorkerMetricDefinitionsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.HostingEnvironmentsClient", "GetHostingEnvironmentWebWorkerMetricDefinitions", resp, "Failure sending next results request") - } - - result, err = client.GetHostingEnvironmentWebWorkerMetricDefinitionsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.HostingEnvironmentsClient", "GetHostingEnvironmentWebWorkerMetricDefinitions", resp, "Failure responding to next results request") - } - - return -} - -// GetHostingEnvironmentWebWorkerMetrics sends the get hosting environment web -// worker metrics request. -// -// resourceGroupName is name of resource group name is name of -// hostingEnvironment (App Service Environment) workerPoolName is name of -// worker pool details is include instance details filter is return only -// usages/metrics specified in the filter. Filter conforms to odata syntax. -// Example: $filter=(name.value eq 'Metric1' or name.value eq 'Metric2') and -// startTime eq '2014-01-01T00:00:00Z' and endTime eq '2014-12-31T23:59:59Z' -// and timeGrain eq duration'[Hour|Minute|Day]'. -func (client HostingEnvironmentsClient) GetHostingEnvironmentWebWorkerMetrics(resourceGroupName string, name string, workerPoolName string, details *bool, filter string) (result ResourceMetricCollection, err error) { - req, err := client.GetHostingEnvironmentWebWorkerMetricsPreparer(resourceGroupName, name, workerPoolName, details, filter) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.HostingEnvironmentsClient", "GetHostingEnvironmentWebWorkerMetrics", nil, "Failure preparing request") - } - - resp, err := client.GetHostingEnvironmentWebWorkerMetricsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.HostingEnvironmentsClient", "GetHostingEnvironmentWebWorkerMetrics", resp, "Failure sending request") - } - - result, err = client.GetHostingEnvironmentWebWorkerMetricsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.HostingEnvironmentsClient", "GetHostingEnvironmentWebWorkerMetrics", resp, "Failure responding to request") - } - - return -} - -// GetHostingEnvironmentWebWorkerMetricsPreparer prepares the GetHostingEnvironmentWebWorkerMetrics request. -func (client HostingEnvironmentsClient) GetHostingEnvironmentWebWorkerMetricsPreparer(resourceGroupName string, name string, workerPoolName string, details *bool, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workerPoolName": autorest.Encode("path", workerPoolName), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - if details != nil { - queryParameters["details"] = autorest.Encode("query", *details) - } - if len(filter) > 0 { - queryParameters["$filter"] = filter - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/workerPools/{workerPoolName}/metrics", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetHostingEnvironmentWebWorkerMetricsSender sends the GetHostingEnvironmentWebWorkerMetrics request. The method will close the -// http.Response Body if it receives an error. -func (client HostingEnvironmentsClient) GetHostingEnvironmentWebWorkerMetricsSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetHostingEnvironmentWebWorkerMetricsResponder handles the response to the GetHostingEnvironmentWebWorkerMetrics request. The method always -// closes the http.Response Body. -func (client HostingEnvironmentsClient) GetHostingEnvironmentWebWorkerMetricsResponder(resp *http.Response) (result ResourceMetricCollection, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetHostingEnvironmentWebWorkerMetricsNextResults retrieves the next set of results, if any. -func (client HostingEnvironmentsClient) GetHostingEnvironmentWebWorkerMetricsNextResults(lastResults ResourceMetricCollection) (result ResourceMetricCollection, err error) { - req, err := lastResults.ResourceMetricCollectionPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "web.HostingEnvironmentsClient", "GetHostingEnvironmentWebWorkerMetrics", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.GetHostingEnvironmentWebWorkerMetricsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.HostingEnvironmentsClient", "GetHostingEnvironmentWebWorkerMetrics", resp, "Failure sending next results request") - } - - result, err = client.GetHostingEnvironmentWebWorkerMetricsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.HostingEnvironmentsClient", "GetHostingEnvironmentWebWorkerMetrics", resp, "Failure responding to next results request") - } - - return -} - -// GetHostingEnvironmentWebWorkerUsages sends the get hosting environment web -// worker usages request. -// -// resourceGroupName is name of resource group name is name of -// hostingEnvironment (App Service Environment) workerPoolName is name of -// worker pool -func (client HostingEnvironmentsClient) GetHostingEnvironmentWebWorkerUsages(resourceGroupName string, name string, workerPoolName string) (result UsageCollection, err error) { - req, err := client.GetHostingEnvironmentWebWorkerUsagesPreparer(resourceGroupName, name, workerPoolName) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.HostingEnvironmentsClient", "GetHostingEnvironmentWebWorkerUsages", nil, "Failure preparing request") - } - - resp, err := client.GetHostingEnvironmentWebWorkerUsagesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.HostingEnvironmentsClient", "GetHostingEnvironmentWebWorkerUsages", resp, "Failure sending request") - } - - result, err = client.GetHostingEnvironmentWebWorkerUsagesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.HostingEnvironmentsClient", "GetHostingEnvironmentWebWorkerUsages", resp, "Failure responding to request") - } - - return -} - -// GetHostingEnvironmentWebWorkerUsagesPreparer prepares the GetHostingEnvironmentWebWorkerUsages request. -func (client HostingEnvironmentsClient) GetHostingEnvironmentWebWorkerUsagesPreparer(resourceGroupName string, name string, workerPoolName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workerPoolName": autorest.Encode("path", workerPoolName), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/workerPools/{workerPoolName}/usages", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetHostingEnvironmentWebWorkerUsagesSender sends the GetHostingEnvironmentWebWorkerUsages request. The method will close the -// http.Response Body if it receives an error. -func (client HostingEnvironmentsClient) GetHostingEnvironmentWebWorkerUsagesSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetHostingEnvironmentWebWorkerUsagesResponder handles the response to the GetHostingEnvironmentWebWorkerUsages request. The method always -// closes the http.Response Body. -func (client HostingEnvironmentsClient) GetHostingEnvironmentWebWorkerUsagesResponder(resp *http.Response) (result UsageCollection, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetHostingEnvironmentWebWorkerUsagesNextResults retrieves the next set of results, if any. -func (client HostingEnvironmentsClient) GetHostingEnvironmentWebWorkerUsagesNextResults(lastResults UsageCollection) (result UsageCollection, err error) { - req, err := lastResults.UsageCollectionPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "web.HostingEnvironmentsClient", "GetHostingEnvironmentWebWorkerUsages", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.GetHostingEnvironmentWebWorkerUsagesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.HostingEnvironmentsClient", "GetHostingEnvironmentWebWorkerUsages", resp, "Failure sending next results request") - } - - result, err = client.GetHostingEnvironmentWebWorkerUsagesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.HostingEnvironmentsClient", "GetHostingEnvironmentWebWorkerUsages", resp, "Failure responding to next results request") - } - - return -} - -// GetMultiRolePool sends the get multi role pool request. -// -// resourceGroupName is name of resource group name is name of -// hostingEnvironment (App Service Environment) -func (client HostingEnvironmentsClient) GetMultiRolePool(resourceGroupName string, name string) (result WorkerPool, err error) { - req, err := client.GetMultiRolePoolPreparer(resourceGroupName, name) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.HostingEnvironmentsClient", "GetMultiRolePool", nil, "Failure preparing request") - } - - resp, err := client.GetMultiRolePoolSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.HostingEnvironmentsClient", "GetMultiRolePool", resp, "Failure sending request") - } - - result, err = client.GetMultiRolePoolResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.HostingEnvironmentsClient", "GetMultiRolePool", resp, "Failure responding to request") - } - - return -} - -// GetMultiRolePoolPreparer prepares the GetMultiRolePool request. -func (client HostingEnvironmentsClient) GetMultiRolePoolPreparer(resourceGroupName string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/multiRolePools/default", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetMultiRolePoolSender sends the GetMultiRolePool request. The method will close the -// http.Response Body if it receives an error. -func (client HostingEnvironmentsClient) GetMultiRolePoolSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetMultiRolePoolResponder handles the response to the GetMultiRolePool request. The method always -// closes the http.Response Body. -func (client HostingEnvironmentsClient) GetMultiRolePoolResponder(resp *http.Response) (result WorkerPool, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetMultiRolePoolInstanceMetricDefinitions sends the get multi role pool -// instance metric definitions request. -// -// resourceGroupName is name of resource group name is name of -// hostingEnvironment (App Service Environment) instance is name of instance in -// the multiRole pool> -func (client HostingEnvironmentsClient) GetMultiRolePoolInstanceMetricDefinitions(resourceGroupName string, name string, instance string) (result SetObject, err error) { - req, err := client.GetMultiRolePoolInstanceMetricDefinitionsPreparer(resourceGroupName, name, instance) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.HostingEnvironmentsClient", "GetMultiRolePoolInstanceMetricDefinitions", nil, "Failure preparing request") - } - - resp, err := client.GetMultiRolePoolInstanceMetricDefinitionsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.HostingEnvironmentsClient", "GetMultiRolePoolInstanceMetricDefinitions", resp, "Failure sending request") - } - - result, err = client.GetMultiRolePoolInstanceMetricDefinitionsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.HostingEnvironmentsClient", "GetMultiRolePoolInstanceMetricDefinitions", resp, "Failure responding to request") - } - - return -} - -// GetMultiRolePoolInstanceMetricDefinitionsPreparer prepares the GetMultiRolePoolInstanceMetricDefinitions request. -func (client HostingEnvironmentsClient) GetMultiRolePoolInstanceMetricDefinitionsPreparer(resourceGroupName string, name string, instance string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "instance": autorest.Encode("path", instance), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/multiRolePools/default/instances/{instance}/metricdefinitions", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetMultiRolePoolInstanceMetricDefinitionsSender sends the GetMultiRolePoolInstanceMetricDefinitions request. The method will close the -// http.Response Body if it receives an error. -func (client HostingEnvironmentsClient) GetMultiRolePoolInstanceMetricDefinitionsSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetMultiRolePoolInstanceMetricDefinitionsResponder handles the response to the GetMultiRolePoolInstanceMetricDefinitions request. The method always -// closes the http.Response Body. -func (client HostingEnvironmentsClient) GetMultiRolePoolInstanceMetricDefinitionsResponder(resp *http.Response) (result SetObject, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Value), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetMultiRolePoolInstanceMetrics sends the get multi role pool instance -// metrics request. -// -// resourceGroupName is name of resource group name is name of -// hostingEnvironment (App Service Environment) instance is name of instance in -// the multiRole pool details is include instance details -func (client HostingEnvironmentsClient) GetMultiRolePoolInstanceMetrics(resourceGroupName string, name string, instance string, details *bool) (result SetObject, err error) { - req, err := client.GetMultiRolePoolInstanceMetricsPreparer(resourceGroupName, name, instance, details) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.HostingEnvironmentsClient", "GetMultiRolePoolInstanceMetrics", nil, "Failure preparing request") - } - - resp, err := client.GetMultiRolePoolInstanceMetricsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.HostingEnvironmentsClient", "GetMultiRolePoolInstanceMetrics", resp, "Failure sending request") - } - - result, err = client.GetMultiRolePoolInstanceMetricsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.HostingEnvironmentsClient", "GetMultiRolePoolInstanceMetrics", resp, "Failure responding to request") - } - - return -} - -// GetMultiRolePoolInstanceMetricsPreparer prepares the GetMultiRolePoolInstanceMetrics request. -func (client HostingEnvironmentsClient) GetMultiRolePoolInstanceMetricsPreparer(resourceGroupName string, name string, instance string, details *bool) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "instance": autorest.Encode("path", instance), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - if details != nil { - queryParameters["details"] = autorest.Encode("query", *details) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/multiRolePools/default/instances/{instance}/metrics", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetMultiRolePoolInstanceMetricsSender sends the GetMultiRolePoolInstanceMetrics request. The method will close the -// http.Response Body if it receives an error. -func (client HostingEnvironmentsClient) GetMultiRolePoolInstanceMetricsSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetMultiRolePoolInstanceMetricsResponder handles the response to the GetMultiRolePoolInstanceMetrics request. The method always -// closes the http.Response Body. -func (client HostingEnvironmentsClient) GetMultiRolePoolInstanceMetricsResponder(resp *http.Response) (result SetObject, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Value), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetMultiRolePools sends the get multi role pools request. -// -// resourceGroupName is name of resource group name is name of -// hostingEnvironment (App Service Environment) -func (client HostingEnvironmentsClient) GetMultiRolePools(resourceGroupName string, name string) (result WorkerPoolCollection, err error) { - req, err := client.GetMultiRolePoolsPreparer(resourceGroupName, name) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.HostingEnvironmentsClient", "GetMultiRolePools", nil, "Failure preparing request") - } - - resp, err := client.GetMultiRolePoolsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.HostingEnvironmentsClient", "GetMultiRolePools", resp, "Failure sending request") - } - - result, err = client.GetMultiRolePoolsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.HostingEnvironmentsClient", "GetMultiRolePools", resp, "Failure responding to request") - } - - return -} - -// GetMultiRolePoolsPreparer prepares the GetMultiRolePools request. -func (client HostingEnvironmentsClient) GetMultiRolePoolsPreparer(resourceGroupName string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/multiRolePools", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetMultiRolePoolsSender sends the GetMultiRolePools request. The method will close the -// http.Response Body if it receives an error. -func (client HostingEnvironmentsClient) GetMultiRolePoolsSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetMultiRolePoolsResponder handles the response to the GetMultiRolePools request. The method always -// closes the http.Response Body. -func (client HostingEnvironmentsClient) GetMultiRolePoolsResponder(resp *http.Response) (result WorkerPoolCollection, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetMultiRolePoolsNextResults retrieves the next set of results, if any. -func (client HostingEnvironmentsClient) GetMultiRolePoolsNextResults(lastResults WorkerPoolCollection) (result WorkerPoolCollection, err error) { - req, err := lastResults.WorkerPoolCollectionPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "web.HostingEnvironmentsClient", "GetMultiRolePools", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.GetMultiRolePoolsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.HostingEnvironmentsClient", "GetMultiRolePools", resp, "Failure sending next results request") - } - - result, err = client.GetMultiRolePoolsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.HostingEnvironmentsClient", "GetMultiRolePools", resp, "Failure responding to next results request") - } - - return -} - -// GetMultiRolePoolSkus sends the get multi role pool skus request. -// -// resourceGroupName is name of resource group name is name of -// hostingEnvironment (App Service Environment) -func (client HostingEnvironmentsClient) GetMultiRolePoolSkus(resourceGroupName string, name string) (result SkuInfoCollection, err error) { - req, err := client.GetMultiRolePoolSkusPreparer(resourceGroupName, name) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.HostingEnvironmentsClient", "GetMultiRolePoolSkus", nil, "Failure preparing request") - } - - resp, err := client.GetMultiRolePoolSkusSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.HostingEnvironmentsClient", "GetMultiRolePoolSkus", resp, "Failure sending request") - } - - result, err = client.GetMultiRolePoolSkusResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.HostingEnvironmentsClient", "GetMultiRolePoolSkus", resp, "Failure responding to request") - } - - return -} - -// GetMultiRolePoolSkusPreparer prepares the GetMultiRolePoolSkus request. -func (client HostingEnvironmentsClient) GetMultiRolePoolSkusPreparer(resourceGroupName string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/multiRolePools/default/skus", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetMultiRolePoolSkusSender sends the GetMultiRolePoolSkus request. The method will close the -// http.Response Body if it receives an error. -func (client HostingEnvironmentsClient) GetMultiRolePoolSkusSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetMultiRolePoolSkusResponder handles the response to the GetMultiRolePoolSkus request. The method always -// closes the http.Response Body. -func (client HostingEnvironmentsClient) GetMultiRolePoolSkusResponder(resp *http.Response) (result SkuInfoCollection, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetMultiRolePoolSkusNextResults retrieves the next set of results, if any. -func (client HostingEnvironmentsClient) GetMultiRolePoolSkusNextResults(lastResults SkuInfoCollection) (result SkuInfoCollection, err error) { - req, err := lastResults.SkuInfoCollectionPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "web.HostingEnvironmentsClient", "GetMultiRolePoolSkus", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.GetMultiRolePoolSkusSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.HostingEnvironmentsClient", "GetMultiRolePoolSkus", resp, "Failure sending next results request") - } - - result, err = client.GetMultiRolePoolSkusResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.HostingEnvironmentsClient", "GetMultiRolePoolSkus", resp, "Failure responding to next results request") - } - - return -} - -// GetWorkerPool sends the get worker pool request. -// -// resourceGroupName is name of resource group name is name of -// hostingEnvironment (App Service Environment) workerPoolName is name of -// worker pool -func (client HostingEnvironmentsClient) GetWorkerPool(resourceGroupName string, name string, workerPoolName string) (result WorkerPool, err error) { - req, err := client.GetWorkerPoolPreparer(resourceGroupName, name, workerPoolName) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.HostingEnvironmentsClient", "GetWorkerPool", nil, "Failure preparing request") - } - - resp, err := client.GetWorkerPoolSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.HostingEnvironmentsClient", "GetWorkerPool", resp, "Failure sending request") - } - - result, err = client.GetWorkerPoolResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.HostingEnvironmentsClient", "GetWorkerPool", resp, "Failure responding to request") - } - - return -} - -// GetWorkerPoolPreparer prepares the GetWorkerPool request. -func (client HostingEnvironmentsClient) GetWorkerPoolPreparer(resourceGroupName string, name string, workerPoolName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workerPoolName": autorest.Encode("path", workerPoolName), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/workerPools/{workerPoolName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetWorkerPoolSender sends the GetWorkerPool request. The method will close the -// http.Response Body if it receives an error. -func (client HostingEnvironmentsClient) GetWorkerPoolSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetWorkerPoolResponder handles the response to the GetWorkerPool request. The method always -// closes the http.Response Body. -func (client HostingEnvironmentsClient) GetWorkerPoolResponder(resp *http.Response) (result WorkerPool, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetWorkerPoolInstanceMetricDefinitions sends the get worker pool instance -// metric definitions request. -// -// resourceGroupName is name of resource group name is name of -// hostingEnvironment (App Service Environment) workerPoolName is name of -// worker pool instance is name of instance in the worker pool -func (client HostingEnvironmentsClient) GetWorkerPoolInstanceMetricDefinitions(resourceGroupName string, name string, workerPoolName string, instance string) (result SetObject, err error) { - req, err := client.GetWorkerPoolInstanceMetricDefinitionsPreparer(resourceGroupName, name, workerPoolName, instance) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.HostingEnvironmentsClient", "GetWorkerPoolInstanceMetricDefinitions", nil, "Failure preparing request") - } - - resp, err := client.GetWorkerPoolInstanceMetricDefinitionsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.HostingEnvironmentsClient", "GetWorkerPoolInstanceMetricDefinitions", resp, "Failure sending request") - } - - result, err = client.GetWorkerPoolInstanceMetricDefinitionsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.HostingEnvironmentsClient", "GetWorkerPoolInstanceMetricDefinitions", resp, "Failure responding to request") - } - - return -} - -// GetWorkerPoolInstanceMetricDefinitionsPreparer prepares the GetWorkerPoolInstanceMetricDefinitions request. -func (client HostingEnvironmentsClient) GetWorkerPoolInstanceMetricDefinitionsPreparer(resourceGroupName string, name string, workerPoolName string, instance string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "instance": autorest.Encode("path", instance), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workerPoolName": autorest.Encode("path", workerPoolName), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/workerPools/{workerPoolName}/instances/{instance}/metricdefinitions", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetWorkerPoolInstanceMetricDefinitionsSender sends the GetWorkerPoolInstanceMetricDefinitions request. The method will close the -// http.Response Body if it receives an error. -func (client HostingEnvironmentsClient) GetWorkerPoolInstanceMetricDefinitionsSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetWorkerPoolInstanceMetricDefinitionsResponder handles the response to the GetWorkerPoolInstanceMetricDefinitions request. The method always -// closes the http.Response Body. -func (client HostingEnvironmentsClient) GetWorkerPoolInstanceMetricDefinitionsResponder(resp *http.Response) (result SetObject, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Value), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetWorkerPoolInstanceMetrics sends the get worker pool instance metrics -// request. -// -// resourceGroupName is name of resource group name is name of -// hostingEnvironment (App Service Environment) workerPoolName is name of -// worker pool instance is name of instance in the worker pool details is -// include instance details filter is return only usages/metrics specified in -// the filter. Filter conforms to odata syntax. Example: $filter=(name.value eq -// 'Metric1' or name.value eq 'Metric2') and startTime eq -// '2014-01-01T00:00:00Z' and endTime eq '2014-12-31T23:59:59Z' and timeGrain -// eq duration'[Hour|Minute|Day]'. -func (client HostingEnvironmentsClient) GetWorkerPoolInstanceMetrics(resourceGroupName string, name string, workerPoolName string, instance string, details *bool, filter string) (result SetObject, err error) { - req, err := client.GetWorkerPoolInstanceMetricsPreparer(resourceGroupName, name, workerPoolName, instance, details, filter) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.HostingEnvironmentsClient", "GetWorkerPoolInstanceMetrics", nil, "Failure preparing request") - } - - resp, err := client.GetWorkerPoolInstanceMetricsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.HostingEnvironmentsClient", "GetWorkerPoolInstanceMetrics", resp, "Failure sending request") - } - - result, err = client.GetWorkerPoolInstanceMetricsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.HostingEnvironmentsClient", "GetWorkerPoolInstanceMetrics", resp, "Failure responding to request") - } - - return -} - -// GetWorkerPoolInstanceMetricsPreparer prepares the GetWorkerPoolInstanceMetrics request. -func (client HostingEnvironmentsClient) GetWorkerPoolInstanceMetricsPreparer(resourceGroupName string, name string, workerPoolName string, instance string, details *bool, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "instance": autorest.Encode("path", instance), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workerPoolName": autorest.Encode("path", workerPoolName), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - if details != nil { - queryParameters["details"] = autorest.Encode("query", *details) - } - if len(filter) > 0 { - queryParameters["$filter"] = filter - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/workerPools/{workerPoolName}/instances/{instance}/metrics", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetWorkerPoolInstanceMetricsSender sends the GetWorkerPoolInstanceMetrics request. The method will close the -// http.Response Body if it receives an error. -func (client HostingEnvironmentsClient) GetWorkerPoolInstanceMetricsSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetWorkerPoolInstanceMetricsResponder handles the response to the GetWorkerPoolInstanceMetrics request. The method always -// closes the http.Response Body. -func (client HostingEnvironmentsClient) GetWorkerPoolInstanceMetricsResponder(resp *http.Response) (result SetObject, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Value), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetWorkerPools sends the get worker pools request. -// -// resourceGroupName is name of resource group name is name of -// hostingEnvironment (App Service Environment) -func (client HostingEnvironmentsClient) GetWorkerPools(resourceGroupName string, name string) (result WorkerPoolCollection, err error) { - req, err := client.GetWorkerPoolsPreparer(resourceGroupName, name) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.HostingEnvironmentsClient", "GetWorkerPools", nil, "Failure preparing request") - } - - resp, err := client.GetWorkerPoolsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.HostingEnvironmentsClient", "GetWorkerPools", resp, "Failure sending request") - } - - result, err = client.GetWorkerPoolsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.HostingEnvironmentsClient", "GetWorkerPools", resp, "Failure responding to request") - } - - return -} - -// GetWorkerPoolsPreparer prepares the GetWorkerPools request. -func (client HostingEnvironmentsClient) GetWorkerPoolsPreparer(resourceGroupName string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/workerPools", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetWorkerPoolsSender sends the GetWorkerPools request. The method will close the -// http.Response Body if it receives an error. -func (client HostingEnvironmentsClient) GetWorkerPoolsSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetWorkerPoolsResponder handles the response to the GetWorkerPools request. The method always -// closes the http.Response Body. -func (client HostingEnvironmentsClient) GetWorkerPoolsResponder(resp *http.Response) (result WorkerPoolCollection, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetWorkerPoolsNextResults retrieves the next set of results, if any. -func (client HostingEnvironmentsClient) GetWorkerPoolsNextResults(lastResults WorkerPoolCollection) (result WorkerPoolCollection, err error) { - req, err := lastResults.WorkerPoolCollectionPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "web.HostingEnvironmentsClient", "GetWorkerPools", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.GetWorkerPoolsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.HostingEnvironmentsClient", "GetWorkerPools", resp, "Failure sending next results request") - } - - result, err = client.GetWorkerPoolsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.HostingEnvironmentsClient", "GetWorkerPools", resp, "Failure responding to next results request") - } - - return -} - -// GetWorkerPoolSkus sends the get worker pool skus request. -// -// resourceGroupName is name of resource group name is name of -// hostingEnvironment (App Service Environment) workerPoolName is name of -// worker pool -func (client HostingEnvironmentsClient) GetWorkerPoolSkus(resourceGroupName string, name string, workerPoolName string) (result SkuInfoCollection, err error) { - req, err := client.GetWorkerPoolSkusPreparer(resourceGroupName, name, workerPoolName) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.HostingEnvironmentsClient", "GetWorkerPoolSkus", nil, "Failure preparing request") - } - - resp, err := client.GetWorkerPoolSkusSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.HostingEnvironmentsClient", "GetWorkerPoolSkus", resp, "Failure sending request") - } - - result, err = client.GetWorkerPoolSkusResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.HostingEnvironmentsClient", "GetWorkerPoolSkus", resp, "Failure responding to request") - } - - return -} - -// GetWorkerPoolSkusPreparer prepares the GetWorkerPoolSkus request. -func (client HostingEnvironmentsClient) GetWorkerPoolSkusPreparer(resourceGroupName string, name string, workerPoolName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workerPoolName": autorest.Encode("path", workerPoolName), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/workerPools/{workerPoolName}/skus", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetWorkerPoolSkusSender sends the GetWorkerPoolSkus request. The method will close the -// http.Response Body if it receives an error. -func (client HostingEnvironmentsClient) GetWorkerPoolSkusSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetWorkerPoolSkusResponder handles the response to the GetWorkerPoolSkus request. The method always -// closes the http.Response Body. -func (client HostingEnvironmentsClient) GetWorkerPoolSkusResponder(resp *http.Response) (result SkuInfoCollection, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetWorkerPoolSkusNextResults retrieves the next set of results, if any. -func (client HostingEnvironmentsClient) GetWorkerPoolSkusNextResults(lastResults SkuInfoCollection) (result SkuInfoCollection, err error) { - req, err := lastResults.SkuInfoCollectionPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "web.HostingEnvironmentsClient", "GetWorkerPoolSkus", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.GetWorkerPoolSkusSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.HostingEnvironmentsClient", "GetWorkerPoolSkus", resp, "Failure sending next results request") - } - - result, err = client.GetWorkerPoolSkusResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.HostingEnvironmentsClient", "GetWorkerPoolSkus", resp, "Failure responding to next results request") - } - - return -} - -// RebootHostingEnvironment sends the reboot hosting environment request. -// -// resourceGroupName is name of resource group name is name of -// hostingEnvironment (App Service Environment) -func (client HostingEnvironmentsClient) RebootHostingEnvironment(resourceGroupName string, name string) (result SetObject, err error) { - req, err := client.RebootHostingEnvironmentPreparer(resourceGroupName, name) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.HostingEnvironmentsClient", "RebootHostingEnvironment", nil, "Failure preparing request") - } - - resp, err := client.RebootHostingEnvironmentSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.HostingEnvironmentsClient", "RebootHostingEnvironment", resp, "Failure sending request") - } - - result, err = client.RebootHostingEnvironmentResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.HostingEnvironmentsClient", "RebootHostingEnvironment", resp, "Failure responding to request") - } - - return -} - -// RebootHostingEnvironmentPreparer prepares the RebootHostingEnvironment request. -func (client HostingEnvironmentsClient) RebootHostingEnvironmentPreparer(resourceGroupName string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/reboot", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// RebootHostingEnvironmentSender sends the RebootHostingEnvironment request. The method will close the -// http.Response Body if it receives an error. -func (client HostingEnvironmentsClient) RebootHostingEnvironmentSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// RebootHostingEnvironmentResponder handles the response to the RebootHostingEnvironment request. The method always -// closes the http.Response Body. -func (client HostingEnvironmentsClient) RebootHostingEnvironmentResponder(resp *http.Response) (result SetObject, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusBadRequest, http.StatusNotFound, http.StatusConflict), - autorest.ByUnmarshallingJSON(&result.Value), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ResumeHostingEnvironment sends the resume hosting environment request. This -// method may poll for completion. Polling can be canceled by passing the -// cancel channel argument. The channel will be used to cancel polling and any -// outstanding HTTP requests. -// -// resourceGroupName is name of resource group name is name of -// hostingEnvironment (App Service Environment) -func (client HostingEnvironmentsClient) ResumeHostingEnvironment(resourceGroupName string, name string, cancel <-chan struct{}) (result autorest.Response, err error) { - req, err := client.ResumeHostingEnvironmentPreparer(resourceGroupName, name, cancel) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.HostingEnvironmentsClient", "ResumeHostingEnvironment", nil, "Failure preparing request") - } - - resp, err := client.ResumeHostingEnvironmentSender(req) - if err != nil { - result.Response = resp - return result, autorest.NewErrorWithError(err, "web.HostingEnvironmentsClient", "ResumeHostingEnvironment", resp, "Failure sending request") - } - - result, err = client.ResumeHostingEnvironmentResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.HostingEnvironmentsClient", "ResumeHostingEnvironment", resp, "Failure responding to request") - } - - return -} - -// ResumeHostingEnvironmentPreparer prepares the ResumeHostingEnvironment request. -func (client HostingEnvironmentsClient) ResumeHostingEnvironmentPreparer(resourceGroupName string, name string, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/resume", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// ResumeHostingEnvironmentSender sends the ResumeHostingEnvironment request. The method will close the -// http.Response Body if it receives an error. -func (client HostingEnvironmentsClient) ResumeHostingEnvironmentSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// ResumeHostingEnvironmentResponder handles the response to the ResumeHostingEnvironment request. The method always -// closes the http.Response Body. -func (client HostingEnvironmentsClient) ResumeHostingEnvironmentResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} - -// ResumeHostingEnvironmentNextResults retrieves the next set of results, if any. -func (client HostingEnvironmentsClient) ResumeHostingEnvironmentNextResults(lastResults SiteCollection) (result autorest.Response, err error) { - req, err := lastResults.SiteCollectionPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "web.HostingEnvironmentsClient", "ResumeHostingEnvironment", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ResumeHostingEnvironmentSender(req) - if err != nil { - result.Response = resp - return result, autorest.NewErrorWithError(err, "web.HostingEnvironmentsClient", "ResumeHostingEnvironment", resp, "Failure sending next results request") - } - - result, err = client.ResumeHostingEnvironmentResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.HostingEnvironmentsClient", "ResumeHostingEnvironment", resp, "Failure responding to next results request") - } - - return -} - -// SuspendHostingEnvironment sends the suspend hosting environment request. -// This method may poll for completion. Polling can be canceled by passing the -// cancel channel argument. The channel will be used to cancel polling and any -// outstanding HTTP requests. -// -// resourceGroupName is name of resource group name is name of -// hostingEnvironment (App Service Environment) -func (client HostingEnvironmentsClient) SuspendHostingEnvironment(resourceGroupName string, name string, cancel <-chan struct{}) (result autorest.Response, err error) { - req, err := client.SuspendHostingEnvironmentPreparer(resourceGroupName, name, cancel) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.HostingEnvironmentsClient", "SuspendHostingEnvironment", nil, "Failure preparing request") - } - - resp, err := client.SuspendHostingEnvironmentSender(req) - if err != nil { - result.Response = resp - return result, autorest.NewErrorWithError(err, "web.HostingEnvironmentsClient", "SuspendHostingEnvironment", resp, "Failure sending request") - } - - result, err = client.SuspendHostingEnvironmentResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.HostingEnvironmentsClient", "SuspendHostingEnvironment", resp, "Failure responding to request") - } - - return -} - -// SuspendHostingEnvironmentPreparer prepares the SuspendHostingEnvironment request. -func (client HostingEnvironmentsClient) SuspendHostingEnvironmentPreparer(resourceGroupName string, name string, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/suspend", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// SuspendHostingEnvironmentSender sends the SuspendHostingEnvironment request. The method will close the -// http.Response Body if it receives an error. -func (client HostingEnvironmentsClient) SuspendHostingEnvironmentSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// SuspendHostingEnvironmentResponder handles the response to the SuspendHostingEnvironment request. The method always -// closes the http.Response Body. -func (client HostingEnvironmentsClient) SuspendHostingEnvironmentResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} - -// SuspendHostingEnvironmentNextResults retrieves the next set of results, if any. -func (client HostingEnvironmentsClient) SuspendHostingEnvironmentNextResults(lastResults SiteCollection) (result autorest.Response, err error) { - req, err := lastResults.SiteCollectionPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "web.HostingEnvironmentsClient", "SuspendHostingEnvironment", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.SuspendHostingEnvironmentSender(req) - if err != nil { - result.Response = resp - return result, autorest.NewErrorWithError(err, "web.HostingEnvironmentsClient", "SuspendHostingEnvironment", resp, "Failure sending next results request") - } - - result, err = client.SuspendHostingEnvironmentResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.HostingEnvironmentsClient", "SuspendHostingEnvironment", resp, "Failure responding to next results request") - } - - return -} diff --git a/arm/web/managedhostingenvironments.go b/arm/web/managedhostingenvironments.go deleted file mode 100644 index a9684f8fa53e..000000000000 --- a/arm/web/managedhostingenvironments.go +++ /dev/null @@ -1,736 +0,0 @@ -package web - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// -// See the License for the specific language governing permissions and -// limitations under the License. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// 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/azure" - "net/http" -) - -// ManagedHostingEnvironmentsClient is the use these APIs to manage Azure -// Websites resources through the Azure Resource Manager. All task operations -// conform to the HTTP/1.1 protocol specification and each operation returns an -// x-ms-request-id header that can be used to obtain information about the -// request. You must make sure that requests made to these resources are -// secure. For more information, see -// https://msdn.microsoft.com/en-us/library/azure/dn790557.aspx. -type ManagedHostingEnvironmentsClient struct { - ManagementClient -} - -// NewManagedHostingEnvironmentsClient creates an instance of the -// ManagedHostingEnvironmentsClient client. -func NewManagedHostingEnvironmentsClient(subscriptionID string) ManagedHostingEnvironmentsClient { - return NewManagedHostingEnvironmentsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewManagedHostingEnvironmentsClientWithBaseURI creates an instance of the -// ManagedHostingEnvironmentsClient client. -func NewManagedHostingEnvironmentsClientWithBaseURI(baseURI string, subscriptionID string) ManagedHostingEnvironmentsClient { - return ManagedHostingEnvironmentsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdateManagedHostingEnvironment sends the create or update managed -// hosting environment request. This method may poll for completion. Polling -// can be canceled by passing the cancel channel argument. The channel will be -// used to cancel polling and any outstanding HTTP requests. -// -// resourceGroupName is name of resource group name is name of managed hosting -// environment managedHostingEnvironmentEnvelope is properties of managed -// hosting environment -func (client ManagedHostingEnvironmentsClient) CreateOrUpdateManagedHostingEnvironment(resourceGroupName string, name string, managedHostingEnvironmentEnvelope HostingEnvironment, cancel <-chan struct{}) (result autorest.Response, err error) { - req, err := client.CreateOrUpdateManagedHostingEnvironmentPreparer(resourceGroupName, name, managedHostingEnvironmentEnvelope, cancel) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.ManagedHostingEnvironmentsClient", "CreateOrUpdateManagedHostingEnvironment", nil, "Failure preparing request") - } - - resp, err := client.CreateOrUpdateManagedHostingEnvironmentSender(req) - if err != nil { - result.Response = resp - return result, autorest.NewErrorWithError(err, "web.ManagedHostingEnvironmentsClient", "CreateOrUpdateManagedHostingEnvironment", resp, "Failure sending request") - } - - result, err = client.CreateOrUpdateManagedHostingEnvironmentResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.ManagedHostingEnvironmentsClient", "CreateOrUpdateManagedHostingEnvironment", resp, "Failure responding to request") - } - - return -} - -// CreateOrUpdateManagedHostingEnvironmentPreparer prepares the CreateOrUpdateManagedHostingEnvironment request. -func (client ManagedHostingEnvironmentsClient) CreateOrUpdateManagedHostingEnvironmentPreparer(resourceGroupName string, name string, managedHostingEnvironmentEnvelope HostingEnvironment, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/managedHostingEnvironments/{name}", pathParameters), - autorest.WithJSON(managedHostingEnvironmentEnvelope), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// CreateOrUpdateManagedHostingEnvironmentSender sends the CreateOrUpdateManagedHostingEnvironment request. The method will close the -// http.Response Body if it receives an error. -func (client ManagedHostingEnvironmentsClient) CreateOrUpdateManagedHostingEnvironmentSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// CreateOrUpdateManagedHostingEnvironmentResponder handles the response to the CreateOrUpdateManagedHostingEnvironment request. The method always -// closes the http.Response Body. -func (client ManagedHostingEnvironmentsClient) CreateOrUpdateManagedHostingEnvironmentResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusBadRequest, http.StatusNotFound, http.StatusConflict), - autorest.ByClosing()) - result.Response = resp - return -} - -// DeleteManagedHostingEnvironment sends the delete managed hosting environment -// request. This method may poll for completion. Polling can be canceled by -// passing the cancel channel argument. The channel will be used to cancel -// polling and any outstanding HTTP requests. -// -// resourceGroupName is name of resource group name is name of managed hosting -// environment forceDelete is delete even if the managed hosting environment -// contains resources -func (client ManagedHostingEnvironmentsClient) DeleteManagedHostingEnvironment(resourceGroupName string, name string, forceDelete *bool, cancel <-chan struct{}) (result autorest.Response, err error) { - req, err := client.DeleteManagedHostingEnvironmentPreparer(resourceGroupName, name, forceDelete, cancel) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.ManagedHostingEnvironmentsClient", "DeleteManagedHostingEnvironment", nil, "Failure preparing request") - } - - resp, err := client.DeleteManagedHostingEnvironmentSender(req) - if err != nil { - result.Response = resp - return result, autorest.NewErrorWithError(err, "web.ManagedHostingEnvironmentsClient", "DeleteManagedHostingEnvironment", resp, "Failure sending request") - } - - result, err = client.DeleteManagedHostingEnvironmentResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.ManagedHostingEnvironmentsClient", "DeleteManagedHostingEnvironment", resp, "Failure responding to request") - } - - return -} - -// DeleteManagedHostingEnvironmentPreparer prepares the DeleteManagedHostingEnvironment request. -func (client ManagedHostingEnvironmentsClient) DeleteManagedHostingEnvironmentPreparer(resourceGroupName string, name string, forceDelete *bool, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - if forceDelete != nil { - queryParameters["forceDelete"] = autorest.Encode("query", *forceDelete) - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/managedHostingEnvironments/{name}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// DeleteManagedHostingEnvironmentSender sends the DeleteManagedHostingEnvironment request. The method will close the -// http.Response Body if it receives an error. -func (client ManagedHostingEnvironmentsClient) DeleteManagedHostingEnvironmentSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// DeleteManagedHostingEnvironmentResponder handles the response to the DeleteManagedHostingEnvironment request. The method always -// closes the http.Response Body. -func (client ManagedHostingEnvironmentsClient) DeleteManagedHostingEnvironmentResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusBadRequest, http.StatusNotFound, http.StatusConflict), - autorest.ByClosing()) - result.Response = resp - return -} - -// GetManagedHostingEnvironment sends the get managed hosting environment -// request. -// -// resourceGroupName is name of resource group name is name of managed hosting -// environment -func (client ManagedHostingEnvironmentsClient) GetManagedHostingEnvironment(resourceGroupName string, name string) (result ManagedHostingEnvironment, err error) { - req, err := client.GetManagedHostingEnvironmentPreparer(resourceGroupName, name) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.ManagedHostingEnvironmentsClient", "GetManagedHostingEnvironment", nil, "Failure preparing request") - } - - resp, err := client.GetManagedHostingEnvironmentSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.ManagedHostingEnvironmentsClient", "GetManagedHostingEnvironment", resp, "Failure sending request") - } - - result, err = client.GetManagedHostingEnvironmentResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.ManagedHostingEnvironmentsClient", "GetManagedHostingEnvironment", resp, "Failure responding to request") - } - - return -} - -// GetManagedHostingEnvironmentPreparer prepares the GetManagedHostingEnvironment request. -func (client ManagedHostingEnvironmentsClient) GetManagedHostingEnvironmentPreparer(resourceGroupName string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/managedHostingEnvironments/{name}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetManagedHostingEnvironmentSender sends the GetManagedHostingEnvironment request. The method will close the -// http.Response Body if it receives an error. -func (client ManagedHostingEnvironmentsClient) GetManagedHostingEnvironmentSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetManagedHostingEnvironmentResponder handles the response to the GetManagedHostingEnvironment request. The method always -// closes the http.Response Body. -func (client ManagedHostingEnvironmentsClient) GetManagedHostingEnvironmentResponder(resp *http.Response) (result ManagedHostingEnvironment, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetManagedHostingEnvironmentOperation sends the get managed hosting -// environment operation request. -// -// resourceGroupName is name of resource group name is name of managed hosting -// environment operationID is operation identifier GUID -func (client ManagedHostingEnvironmentsClient) GetManagedHostingEnvironmentOperation(resourceGroupName string, name string, operationID string) (result SetObject, err error) { - req, err := client.GetManagedHostingEnvironmentOperationPreparer(resourceGroupName, name, operationID) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.ManagedHostingEnvironmentsClient", "GetManagedHostingEnvironmentOperation", nil, "Failure preparing request") - } - - resp, err := client.GetManagedHostingEnvironmentOperationSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.ManagedHostingEnvironmentsClient", "GetManagedHostingEnvironmentOperation", resp, "Failure sending request") - } - - result, err = client.GetManagedHostingEnvironmentOperationResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.ManagedHostingEnvironmentsClient", "GetManagedHostingEnvironmentOperation", resp, "Failure responding to request") - } - - return -} - -// GetManagedHostingEnvironmentOperationPreparer prepares the GetManagedHostingEnvironmentOperation request. -func (client ManagedHostingEnvironmentsClient) GetManagedHostingEnvironmentOperationPreparer(resourceGroupName string, name string, operationID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "operationId": autorest.Encode("path", operationID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/managedHostingEnvironments/{name}/operations/{operationId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetManagedHostingEnvironmentOperationSender sends the GetManagedHostingEnvironmentOperation request. The method will close the -// http.Response Body if it receives an error. -func (client ManagedHostingEnvironmentsClient) GetManagedHostingEnvironmentOperationSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetManagedHostingEnvironmentOperationResponder handles the response to the GetManagedHostingEnvironmentOperation request. The method always -// closes the http.Response Body. -func (client ManagedHostingEnvironmentsClient) GetManagedHostingEnvironmentOperationResponder(resp *http.Response) (result SetObject, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNotFound, http.StatusInternalServerError), - autorest.ByUnmarshallingJSON(&result.Value), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetManagedHostingEnvironments sends the get managed hosting environments -// request. -// -// resourceGroupName is name of resource group -func (client ManagedHostingEnvironmentsClient) GetManagedHostingEnvironments(resourceGroupName string) (result HostingEnvironmentCollection, err error) { - req, err := client.GetManagedHostingEnvironmentsPreparer(resourceGroupName) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.ManagedHostingEnvironmentsClient", "GetManagedHostingEnvironments", nil, "Failure preparing request") - } - - resp, err := client.GetManagedHostingEnvironmentsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.ManagedHostingEnvironmentsClient", "GetManagedHostingEnvironments", resp, "Failure sending request") - } - - result, err = client.GetManagedHostingEnvironmentsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.ManagedHostingEnvironmentsClient", "GetManagedHostingEnvironments", resp, "Failure responding to request") - } - - return -} - -// GetManagedHostingEnvironmentsPreparer prepares the GetManagedHostingEnvironments request. -func (client ManagedHostingEnvironmentsClient) GetManagedHostingEnvironmentsPreparer(resourceGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/managedHostingEnvironments", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetManagedHostingEnvironmentsSender sends the GetManagedHostingEnvironments request. The method will close the -// http.Response Body if it receives an error. -func (client ManagedHostingEnvironmentsClient) GetManagedHostingEnvironmentsSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetManagedHostingEnvironmentsResponder handles the response to the GetManagedHostingEnvironments request. The method always -// closes the http.Response Body. -func (client ManagedHostingEnvironmentsClient) GetManagedHostingEnvironmentsResponder(resp *http.Response) (result HostingEnvironmentCollection, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetManagedHostingEnvironmentsNextResults retrieves the next set of results, if any. -func (client ManagedHostingEnvironmentsClient) GetManagedHostingEnvironmentsNextResults(lastResults HostingEnvironmentCollection) (result HostingEnvironmentCollection, err error) { - req, err := lastResults.HostingEnvironmentCollectionPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "web.ManagedHostingEnvironmentsClient", "GetManagedHostingEnvironments", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.GetManagedHostingEnvironmentsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.ManagedHostingEnvironmentsClient", "GetManagedHostingEnvironments", resp, "Failure sending next results request") - } - - result, err = client.GetManagedHostingEnvironmentsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.ManagedHostingEnvironmentsClient", "GetManagedHostingEnvironments", resp, "Failure responding to next results request") - } - - return -} - -// GetManagedHostingEnvironmentServerFarms sends the get managed hosting -// environment server farms request. -// -// resourceGroupName is name of resource group name is name of managed hosting -// environment -func (client ManagedHostingEnvironmentsClient) GetManagedHostingEnvironmentServerFarms(resourceGroupName string, name string) (result ServerFarmCollection, err error) { - req, err := client.GetManagedHostingEnvironmentServerFarmsPreparer(resourceGroupName, name) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.ManagedHostingEnvironmentsClient", "GetManagedHostingEnvironmentServerFarms", nil, "Failure preparing request") - } - - resp, err := client.GetManagedHostingEnvironmentServerFarmsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.ManagedHostingEnvironmentsClient", "GetManagedHostingEnvironmentServerFarms", resp, "Failure sending request") - } - - result, err = client.GetManagedHostingEnvironmentServerFarmsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.ManagedHostingEnvironmentsClient", "GetManagedHostingEnvironmentServerFarms", resp, "Failure responding to request") - } - - return -} - -// GetManagedHostingEnvironmentServerFarmsPreparer prepares the GetManagedHostingEnvironmentServerFarms request. -func (client ManagedHostingEnvironmentsClient) GetManagedHostingEnvironmentServerFarmsPreparer(resourceGroupName string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/managedHostingEnvironments/{name}/serverfarms", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetManagedHostingEnvironmentServerFarmsSender sends the GetManagedHostingEnvironmentServerFarms request. The method will close the -// http.Response Body if it receives an error. -func (client ManagedHostingEnvironmentsClient) GetManagedHostingEnvironmentServerFarmsSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetManagedHostingEnvironmentServerFarmsResponder handles the response to the GetManagedHostingEnvironmentServerFarms request. The method always -// closes the http.Response Body. -func (client ManagedHostingEnvironmentsClient) GetManagedHostingEnvironmentServerFarmsResponder(resp *http.Response) (result ServerFarmCollection, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetManagedHostingEnvironmentServerFarmsNextResults retrieves the next set of results, if any. -func (client ManagedHostingEnvironmentsClient) GetManagedHostingEnvironmentServerFarmsNextResults(lastResults ServerFarmCollection) (result ServerFarmCollection, err error) { - req, err := lastResults.ServerFarmCollectionPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "web.ManagedHostingEnvironmentsClient", "GetManagedHostingEnvironmentServerFarms", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.GetManagedHostingEnvironmentServerFarmsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.ManagedHostingEnvironmentsClient", "GetManagedHostingEnvironmentServerFarms", resp, "Failure sending next results request") - } - - result, err = client.GetManagedHostingEnvironmentServerFarmsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.ManagedHostingEnvironmentsClient", "GetManagedHostingEnvironmentServerFarms", resp, "Failure responding to next results request") - } - - return -} - -// GetManagedHostingEnvironmentSites sends the get managed hosting environment -// sites request. -// -// resourceGroupName is name of resource group name is name of managed hosting -// environment propertiesToInclude is comma separated list of site properties -// to include -func (client ManagedHostingEnvironmentsClient) GetManagedHostingEnvironmentSites(resourceGroupName string, name string, propertiesToInclude string) (result SiteCollection, err error) { - req, err := client.GetManagedHostingEnvironmentSitesPreparer(resourceGroupName, name, propertiesToInclude) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.ManagedHostingEnvironmentsClient", "GetManagedHostingEnvironmentSites", nil, "Failure preparing request") - } - - resp, err := client.GetManagedHostingEnvironmentSitesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.ManagedHostingEnvironmentsClient", "GetManagedHostingEnvironmentSites", resp, "Failure sending request") - } - - result, err = client.GetManagedHostingEnvironmentSitesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.ManagedHostingEnvironmentsClient", "GetManagedHostingEnvironmentSites", resp, "Failure responding to request") - } - - return -} - -// GetManagedHostingEnvironmentSitesPreparer prepares the GetManagedHostingEnvironmentSites request. -func (client ManagedHostingEnvironmentsClient) GetManagedHostingEnvironmentSitesPreparer(resourceGroupName string, name string, propertiesToInclude string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - if len(propertiesToInclude) > 0 { - queryParameters["propertiesToInclude"] = autorest.Encode("query", propertiesToInclude) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/managedHostingEnvironments/{name}/sites", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetManagedHostingEnvironmentSitesSender sends the GetManagedHostingEnvironmentSites request. The method will close the -// http.Response Body if it receives an error. -func (client ManagedHostingEnvironmentsClient) GetManagedHostingEnvironmentSitesSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetManagedHostingEnvironmentSitesResponder handles the response to the GetManagedHostingEnvironmentSites request. The method always -// closes the http.Response Body. -func (client ManagedHostingEnvironmentsClient) GetManagedHostingEnvironmentSitesResponder(resp *http.Response) (result SiteCollection, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetManagedHostingEnvironmentSitesNextResults retrieves the next set of results, if any. -func (client ManagedHostingEnvironmentsClient) GetManagedHostingEnvironmentSitesNextResults(lastResults SiteCollection) (result SiteCollection, err error) { - req, err := lastResults.SiteCollectionPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "web.ManagedHostingEnvironmentsClient", "GetManagedHostingEnvironmentSites", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.GetManagedHostingEnvironmentSitesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.ManagedHostingEnvironmentsClient", "GetManagedHostingEnvironmentSites", resp, "Failure sending next results request") - } - - result, err = client.GetManagedHostingEnvironmentSitesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.ManagedHostingEnvironmentsClient", "GetManagedHostingEnvironmentSites", resp, "Failure responding to next results request") - } - - return -} - -// GetManagedHostingEnvironmentVips sends the get managed hosting environment -// vips request. -// -// resourceGroupName is name of resource group name is name of managed hosting -// environment -func (client ManagedHostingEnvironmentsClient) GetManagedHostingEnvironmentVips(resourceGroupName string, name string) (result AddressResponse, err error) { - req, err := client.GetManagedHostingEnvironmentVipsPreparer(resourceGroupName, name) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.ManagedHostingEnvironmentsClient", "GetManagedHostingEnvironmentVips", nil, "Failure preparing request") - } - - resp, err := client.GetManagedHostingEnvironmentVipsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.ManagedHostingEnvironmentsClient", "GetManagedHostingEnvironmentVips", resp, "Failure sending request") - } - - result, err = client.GetManagedHostingEnvironmentVipsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.ManagedHostingEnvironmentsClient", "GetManagedHostingEnvironmentVips", resp, "Failure responding to request") - } - - return -} - -// GetManagedHostingEnvironmentVipsPreparer prepares the GetManagedHostingEnvironmentVips request. -func (client ManagedHostingEnvironmentsClient) GetManagedHostingEnvironmentVipsPreparer(resourceGroupName string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/managedHostingEnvironments/{name}/capacities/virtualip", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetManagedHostingEnvironmentVipsSender sends the GetManagedHostingEnvironmentVips request. The method will close the -// http.Response Body if it receives an error. -func (client ManagedHostingEnvironmentsClient) GetManagedHostingEnvironmentVipsSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetManagedHostingEnvironmentVipsResponder handles the response to the GetManagedHostingEnvironmentVips request. The method always -// closes the http.Response Body. -func (client ManagedHostingEnvironmentsClient) GetManagedHostingEnvironmentVipsResponder(resp *http.Response) (result AddressResponse, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetManagedHostingEnvironmentWebHostingPlans sends the get managed hosting -// environment web hosting plans request. -// -// resourceGroupName is name of resource group name is name of managed hosting -// environment -func (client ManagedHostingEnvironmentsClient) GetManagedHostingEnvironmentWebHostingPlans(resourceGroupName string, name string) (result ServerFarmCollection, err error) { - req, err := client.GetManagedHostingEnvironmentWebHostingPlansPreparer(resourceGroupName, name) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.ManagedHostingEnvironmentsClient", "GetManagedHostingEnvironmentWebHostingPlans", nil, "Failure preparing request") - } - - resp, err := client.GetManagedHostingEnvironmentWebHostingPlansSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.ManagedHostingEnvironmentsClient", "GetManagedHostingEnvironmentWebHostingPlans", resp, "Failure sending request") - } - - result, err = client.GetManagedHostingEnvironmentWebHostingPlansResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.ManagedHostingEnvironmentsClient", "GetManagedHostingEnvironmentWebHostingPlans", resp, "Failure responding to request") - } - - return -} - -// GetManagedHostingEnvironmentWebHostingPlansPreparer prepares the GetManagedHostingEnvironmentWebHostingPlans request. -func (client ManagedHostingEnvironmentsClient) GetManagedHostingEnvironmentWebHostingPlansPreparer(resourceGroupName string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/managedHostingEnvironments/{name}/webhostingplans", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetManagedHostingEnvironmentWebHostingPlansSender sends the GetManagedHostingEnvironmentWebHostingPlans request. The method will close the -// http.Response Body if it receives an error. -func (client ManagedHostingEnvironmentsClient) GetManagedHostingEnvironmentWebHostingPlansSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetManagedHostingEnvironmentWebHostingPlansResponder handles the response to the GetManagedHostingEnvironmentWebHostingPlans request. The method always -// closes the http.Response Body. -func (client ManagedHostingEnvironmentsClient) GetManagedHostingEnvironmentWebHostingPlansResponder(resp *http.Response) (result ServerFarmCollection, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetManagedHostingEnvironmentWebHostingPlansNextResults retrieves the next set of results, if any. -func (client ManagedHostingEnvironmentsClient) GetManagedHostingEnvironmentWebHostingPlansNextResults(lastResults ServerFarmCollection) (result ServerFarmCollection, err error) { - req, err := lastResults.ServerFarmCollectionPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "web.ManagedHostingEnvironmentsClient", "GetManagedHostingEnvironmentWebHostingPlans", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.GetManagedHostingEnvironmentWebHostingPlansSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.ManagedHostingEnvironmentsClient", "GetManagedHostingEnvironmentWebHostingPlans", resp, "Failure sending next results request") - } - - result, err = client.GetManagedHostingEnvironmentWebHostingPlansResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.ManagedHostingEnvironmentsClient", "GetManagedHostingEnvironmentWebHostingPlans", resp, "Failure responding to next results request") - } - - return -} diff --git a/arm/web/models.go b/arm/web/models.go old mode 100644 new mode 100755 index fc7e390f1dfa..7c709011c8e2 --- a/arm/web/models.go +++ b/arm/web/models.go @@ -22,6 +22,7 @@ import ( "github.com/Azure/go-autorest/autorest" "github.com/Azure/go-autorest/autorest/date" "github.com/Azure/go-autorest/autorest/to" + "github.com/satori/uuid" "io" "net/http" ) @@ -37,6 +38,25 @@ const ( Permit AccessControlEntryAction = "Permit" ) +// AppServicePlanRestrictions enumerates the values for app service plan +// restrictions. +type AppServicePlanRestrictions string + +const ( + // Basic specifies the basic state for app service plan restrictions. + Basic AppServicePlanRestrictions = "Basic" + // Free specifies the free state for app service plan restrictions. + Free AppServicePlanRestrictions = "Free" + // None specifies the none state for app service plan restrictions. + None AppServicePlanRestrictions = "None" + // Premium specifies the premium state for app service plan restrictions. + Premium AppServicePlanRestrictions = "Premium" + // Shared specifies the shared state for app service plan restrictions. + Shared AppServicePlanRestrictions = "Shared" + // Standard specifies the standard state for app service plan restrictions. + Standard AppServicePlanRestrictions = "Standard" +) + // AutoHealActionType enumerates the values for auto heal action type. type AutoHealActionType string @@ -129,6 +149,12 @@ const ( type CertificateOrderActionType string const ( + // CertificateExpirationWarning specifies the certificate expiration + // warning state for certificate order action type. + CertificateExpirationWarning CertificateOrderActionType = "CertificateExpirationWarning" + // CertificateExpired specifies the certificate expired state for + // certificate order action type. + CertificateExpired CertificateOrderActionType = "CertificateExpired" // CertificateIssued specifies the certificate issued state for certificate // order action type. CertificateIssued CertificateOrderActionType = "CertificateIssued" @@ -144,9 +170,15 @@ const ( // DomainValidationComplete specifies the domain validation complete state // for certificate order action type. DomainValidationComplete CertificateOrderActionType = "DomainValidationComplete" + // FraudCleared specifies the fraud cleared state for certificate order + // action type. + FraudCleared CertificateOrderActionType = "FraudCleared" // FraudDetected specifies the fraud detected state for certificate order // action type. FraudDetected CertificateOrderActionType = "FraudDetected" + // FraudDocumentationRequired specifies the fraud documentation required + // state for certificate order action type. + FraudDocumentationRequired CertificateOrderActionType = "FraudDocumentationRequired" // OrgNameChange specifies the org name change state for certificate order // action type. OrgNameChange CertificateOrderActionType = "OrgNameChange" @@ -155,6 +187,8 @@ const ( OrgValidationComplete CertificateOrderActionType = "OrgValidationComplete" // SanDrop specifies the san drop state for certificate order action type. SanDrop CertificateOrderActionType = "SanDrop" + // Unknown specifies the unknown state for certificate order action type. + Unknown CertificateOrderActionType = "Unknown" ) // CertificateOrderStatus enumerates the values for certificate order status. @@ -211,6 +245,23 @@ const ( Email Channels = "Email" // Notification specifies the notification state for channels. Notification Channels = "Notification" + // Webhook specifies the webhook state for channels. + Webhook Channels = "Webhook" +) + +// CheckNameResourceTypes enumerates the values for check name resource types. +type CheckNameResourceTypes string + +const ( + // CheckNameResourceTypesHostingEnvironment specifies the check name + // resource types hosting environment state for check name resource types. + CheckNameResourceTypesHostingEnvironment CheckNameResourceTypes = "HostingEnvironment" + // CheckNameResourceTypesSite specifies the check name resource types site + // state for check name resource types. + CheckNameResourceTypesSite CheckNameResourceTypes = "Site" + // CheckNameResourceTypesSlot specifies the check name resource types slot + // state for check name resource types. + CheckNameResourceTypesSlot CheckNameResourceTypes = "Slot" ) // CloneAbilityResult enumerates the values for clone ability result. @@ -230,12 +281,42 @@ const ( type ComputeModeOptions string const ( - // Dedicated specifies the dedicated state for compute mode options. - Dedicated ComputeModeOptions = "Dedicated" - // Dynamic specifies the dynamic state for compute mode options. - Dynamic ComputeModeOptions = "Dynamic" - // Shared specifies the shared state for compute mode options. - Shared ComputeModeOptions = "Shared" + // ComputeModeOptionsDedicated specifies the compute mode options dedicated + // state for compute mode options. + ComputeModeOptionsDedicated ComputeModeOptions = "Dedicated" + // ComputeModeOptionsDynamic specifies the compute mode options dynamic + // state for compute mode options. + ComputeModeOptionsDynamic ComputeModeOptions = "Dynamic" + // ComputeModeOptionsShared specifies the compute mode options shared state + // for compute mode options. + ComputeModeOptionsShared ComputeModeOptions = "Shared" +) + +// ConnectionStringType enumerates the values for connection string type. +type ConnectionStringType string + +const ( + // APIHub specifies the api hub state for connection string type. + APIHub ConnectionStringType = "ApiHub" + // Custom specifies the custom state for connection string type. + Custom ConnectionStringType = "Custom" + // DocDb specifies the doc db state for connection string type. + DocDb ConnectionStringType = "DocDb" + // EventHub specifies the event hub state for connection string type. + EventHub ConnectionStringType = "EventHub" + // MySQL specifies the my sql state for connection string type. + MySQL ConnectionStringType = "MySql" + // NotificationHub specifies the notification hub state for connection + // string type. + NotificationHub ConnectionStringType = "NotificationHub" + // RedisCache specifies the redis cache state for connection string type. + RedisCache ConnectionStringType = "RedisCache" + // ServiceBus specifies the service bus state for connection string type. + ServiceBus ConnectionStringType = "ServiceBus" + // SQLAzure specifies the sql azure state for connection string type. + SQLAzure ConnectionStringType = "SQLAzure" + // SQLServer specifies the sql server state for connection string type. + SQLServer ConnectionStringType = "SQLServer" ) // CustomHostNameDNSRecordType enumerates the values for custom host name dns @@ -249,18 +330,35 @@ const ( CName CustomHostNameDNSRecordType = "CName" ) -// DatabaseServerType enumerates the values for database server type. -type DatabaseServerType string +// DatabaseType enumerates the values for database type. +type DatabaseType string + +const ( + // DatabaseTypeLocalMySQL specifies the database type local my sql state + // for database type. + DatabaseTypeLocalMySQL DatabaseType = "LocalMySql" + // DatabaseTypeMySQL specifies the database type my sql state for database + // type. + DatabaseTypeMySQL DatabaseType = "MySql" + // DatabaseTypeSQLAzure specifies the database type sql azure state for + // database type. + DatabaseTypeSQLAzure DatabaseType = "SqlAzure" +) + +// DNSVerificationTestResult enumerates the values for dns verification test +// result. +type DNSVerificationTestResult string const ( - // Custom specifies the custom state for database server type. - Custom DatabaseServerType = "Custom" - // MySQL specifies the my sql state for database server type. - MySQL DatabaseServerType = "MySql" - // SQLAzure specifies the sql azure state for database server type. - SQLAzure DatabaseServerType = "SQLAzure" - // SQLServer specifies the sql server state for database server type. - SQLServer DatabaseServerType = "SQLServer" + // DNSVerificationTestResultFailed specifies the dns verification test + // result failed state for dns verification test result. + DNSVerificationTestResultFailed DNSVerificationTestResult = "Failed" + // DNSVerificationTestResultPassed specifies the dns verification test + // result passed state for dns verification test result. + DNSVerificationTestResultPassed DNSVerificationTestResult = "Passed" + // DNSVerificationTestResultSkipped specifies the dns verification test + // result skipped state for dns verification test result. + DNSVerificationTestResultSkipped DNSVerificationTestResult = "Skipped" ) // DomainStatus enumerates the values for domain status. @@ -377,18 +475,43 @@ const ( Verified HostNameType = "Verified" ) +// HostType enumerates the values for host type. +type HostType string + +const ( + // HostTypeRepository specifies the host type repository state for host + // type. + HostTypeRepository HostType = "Repository" + // HostTypeStandard specifies the host type standard state for host type. + HostTypeStandard HostType = "Standard" +) + +// InAvailabilityReasonType enumerates the values for in availability reason +// type. +type InAvailabilityReasonType string + +const ( + // AlreadyExists specifies the already exists state for in availability + // reason type. + AlreadyExists InAvailabilityReasonType = "AlreadyExists" + // Invalid specifies the invalid state for in availability reason type. + Invalid InAvailabilityReasonType = "Invalid" +) + // InternalLoadBalancingMode enumerates the values for internal load balancing // mode. type InternalLoadBalancingMode string const ( - // None specifies the none state for internal load balancing mode. - None InternalLoadBalancingMode = "None" - // Publishing specifies the publishing state for internal load balancing - // mode. - Publishing InternalLoadBalancingMode = "Publishing" - // Web specifies the web state for internal load balancing mode. - Web InternalLoadBalancingMode = "Web" + // InternalLoadBalancingModeNone specifies the internal load balancing mode + // none state for internal load balancing mode. + InternalLoadBalancingModeNone InternalLoadBalancingMode = "None" + // InternalLoadBalancingModePublishing specifies the internal load + // balancing mode publishing state for internal load balancing mode. + InternalLoadBalancingModePublishing InternalLoadBalancingMode = "Publishing" + // InternalLoadBalancingModeWeb specifies the internal load balancing mode + // web state for internal load balancing mode. + InternalLoadBalancingModeWeb InternalLoadBalancingMode = "Web" ) // KeyVaultSecretStatus enumerates the values for key vault secret status. @@ -403,6 +526,9 @@ const ( // secret status certificate order failed state for key vault secret // status. KeyVaultSecretStatusCertificateOrderFailed KeyVaultSecretStatus = "CertificateOrderFailed" + // KeyVaultSecretStatusExternalPrivateKey specifies the key vault secret + // status external private key state for key vault secret status. + KeyVaultSecretStatusExternalPrivateKey KeyVaultSecretStatus = "ExternalPrivateKey" // KeyVaultSecretStatusInitialized specifies the key vault secret status // initialized state for key vault secret status. KeyVaultSecretStatusInitialized KeyVaultSecretStatus = "Initialized" @@ -448,24 +574,6 @@ const ( Warning LogLevel = "Warning" ) -// ManagedHostingEnvironmentStatus enumerates the values for managed hosting -// environment status. -type ManagedHostingEnvironmentStatus string - -const ( - // ManagedHostingEnvironmentStatusDeleting specifies the managed hosting - // environment status deleting state for managed hosting environment - // status. - ManagedHostingEnvironmentStatusDeleting ManagedHostingEnvironmentStatus = "Deleting" - // ManagedHostingEnvironmentStatusPreparing specifies the managed hosting - // environment status preparing state for managed hosting environment - // status. - ManagedHostingEnvironmentStatusPreparing ManagedHostingEnvironmentStatus = "Preparing" - // ManagedHostingEnvironmentStatusReady specifies the managed hosting - // environment status ready state for managed hosting environment status. - ManagedHostingEnvironmentStatusReady ManagedHostingEnvironmentStatus = "Ready" -) - // ManagedPipelineMode enumerates the values for managed pipeline mode. type ManagedPipelineMode string @@ -494,6 +602,27 @@ const ( NotificationLevelWarning NotificationLevel = "Warning" ) +// OperationStatus enumerates the values for operation status. +type OperationStatus string + +const ( + // OperationStatusCreated specifies the operation status created state for + // operation status. + OperationStatusCreated OperationStatus = "Created" + // OperationStatusFailed specifies the operation status failed state for + // operation status. + OperationStatusFailed OperationStatus = "Failed" + // OperationStatusInProgress specifies the operation status in progress + // state for operation status. + OperationStatusInProgress OperationStatus = "InProgress" + // OperationStatusSucceeded specifies the operation status succeeded state + // for operation status. + OperationStatusSucceeded OperationStatus = "Succeeded" + // OperationStatusTimedOut specifies the operation status timed out state + // for operation status. + OperationStatusTimedOut OperationStatus = "TimedOut" +) + // ProvisioningState enumerates the values for provisioning state. type ProvisioningState string @@ -515,6 +644,80 @@ const ( ProvisioningStateSucceeded ProvisioningState = "Succeeded" ) +// PublishingProfileFormat enumerates the values for publishing profile format. +type PublishingProfileFormat string + +const ( + // FileZilla3 specifies the file zilla 3 state for publishing profile + // format. + FileZilla3 PublishingProfileFormat = "FileZilla3" + // Ftp specifies the ftp state for publishing profile format. + Ftp PublishingProfileFormat = "Ftp" + // WebDeploy specifies the web deploy state for publishing profile format. + WebDeploy PublishingProfileFormat = "WebDeploy" +) + +// ResourceScopeType enumerates the values for resource scope type. +type ResourceScopeType string + +const ( + // ServerFarm specifies the server farm state for resource scope type. + ServerFarm ResourceScopeType = "ServerFarm" + // Subscription specifies the subscription state for resource scope type. + Subscription ResourceScopeType = "Subscription" + // WebSite specifies the web site state for resource scope type. + WebSite ResourceScopeType = "WebSite" +) + +// RouteType enumerates the values for route type. +type RouteType string + +const ( + // DEFAULT specifies the default state for route type. + DEFAULT RouteType = "DEFAULT" + // INHERITED specifies the inherited state for route type. + INHERITED RouteType = "INHERITED" + // STATIC specifies the static state for route type. + STATIC RouteType = "STATIC" +) + +// ScmType enumerates the values for scm type. +type ScmType string + +const ( + // ScmTypeBitbucketGit specifies the scm type bitbucket git state for scm + // type. + ScmTypeBitbucketGit ScmType = "BitbucketGit" + // ScmTypeBitbucketHg specifies the scm type bitbucket hg state for scm + // type. + ScmTypeBitbucketHg ScmType = "BitbucketHg" + // ScmTypeCodePlexGit specifies the scm type code plex git state for scm + // type. + ScmTypeCodePlexGit ScmType = "CodePlexGit" + // ScmTypeCodePlexHg specifies the scm type code plex hg state for scm + // type. + ScmTypeCodePlexHg ScmType = "CodePlexHg" + // ScmTypeDropbox specifies the scm type dropbox state for scm type. + ScmTypeDropbox ScmType = "Dropbox" + // ScmTypeExternalGit specifies the scm type external git state for scm + // type. + ScmTypeExternalGit ScmType = "ExternalGit" + // ScmTypeExternalHg specifies the scm type external hg state for scm type. + ScmTypeExternalHg ScmType = "ExternalHg" + // ScmTypeGitHub specifies the scm type git hub state for scm type. + ScmTypeGitHub ScmType = "GitHub" + // ScmTypeLocalGit specifies the scm type local git state for scm type. + ScmTypeLocalGit ScmType = "LocalGit" + // ScmTypeNone specifies the scm type none state for scm type. + ScmTypeNone ScmType = "None" + // ScmTypeOneDrive specifies the scm type one drive state for scm type. + ScmTypeOneDrive ScmType = "OneDrive" + // ScmTypeTfs specifies the scm type tfs state for scm type. + ScmTypeTfs ScmType = "Tfs" + // ScmTypeVSO specifies the scm type vso state for scm type. + ScmTypeVSO ScmType = "VSO" +) + // SiteAvailabilityState enumerates the values for site availability state. type SiteAvailabilityState string @@ -548,6 +751,24 @@ const ( WeightedTotalTraffic SiteLoadBalancing = "WeightedTotalTraffic" ) +// SkuName enumerates the values for sku name. +type SkuName string + +const ( + // SkuNameBasic specifies the sku name basic state for sku name. + SkuNameBasic SkuName = "Basic" + // SkuNameDynamic specifies the sku name dynamic state for sku name. + SkuNameDynamic SkuName = "Dynamic" + // SkuNameFree specifies the sku name free state for sku name. + SkuNameFree SkuName = "Free" + // SkuNamePremium specifies the sku name premium state for sku name. + SkuNamePremium SkuName = "Premium" + // SkuNameShared specifies the sku name shared state for sku name. + SkuNameShared SkuName = "Shared" + // SkuNameStandard specifies the sku name standard state for sku name. + SkuNameStandard SkuName = "Standard" +) + // SslState enumerates the values for ssl state. type SslState string @@ -596,6 +817,18 @@ const ( UsageStateNormal UsageState = "Normal" ) +// ValidateResourceTypes enumerates the values for validate resource types. +type ValidateResourceTypes string + +const ( + // ValidateResourceTypesServerFarm specifies the validate resource types + // server farm state for validate resource types. + ValidateResourceTypesServerFarm ValidateResourceTypes = "ServerFarm" + // ValidateResourceTypesSite specifies the validate resource types site + // state for validate resource types. + ValidateResourceTypesSite ValidateResourceTypes = "Site" +) + // WorkerSizeOptions enumerates the values for worker size options. type WorkerSizeOptions string @@ -614,7 +847,7 @@ const ( WorkerSizeOptionsSmall WorkerSizeOptions = "Small" ) -// Address is address information for domain registration +// Address is address information for domain registration. type Address struct { Address1 *string `json:"address1,omitempty"` Address2 *string `json:"address2,omitempty"` @@ -624,7 +857,8 @@ type Address struct { State *string `json:"state,omitempty"` } -// AddressResponse is describes main public ip address and any extra vips +// AddressResponse is describes main public IP address and any extra virtual +// IPs. type AddressResponse struct { autorest.Response `json:"-"` ServiceIPAddress *string `json:"serviceIpAddress,omitempty"` @@ -633,52 +867,296 @@ type AddressResponse struct { VipMappings *[]VirtualIPMapping `json:"vipMappings,omitempty"` } -// APIDefinitionInfo is information about the formal API definition for the web +// APIDefinitionInfo is information about the formal API definition for the // app. type APIDefinitionInfo struct { URL *string `json:"url,omitempty"` } -// ApplicationLogsConfig is application logs configuration +// AppCollection is collection of App Service apps. +type AppCollection struct { + autorest.Response `json:"-"` + Value *[]Site `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// AppCollectionPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client AppCollection) AppCollectionPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// AppInstanceCollection is collection of app instances. +type AppInstanceCollection struct { + autorest.Response `json:"-"` + Value *[]SiteInstance `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// AppInstanceCollectionPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client AppInstanceCollection) AppInstanceCollectionPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// ApplicationLogsConfig is application logs configuration. type ApplicationLogsConfig struct { FileSystem *FileSystemApplicationLogsConfig `json:"fileSystem,omitempty"` AzureTableStorage *AzureTableStorageApplicationLogsConfig `json:"azureTableStorage,omitempty"` AzureBlobStorage *AzureBlobStorageApplicationLogsConfig `json:"azureBlobStorage,omitempty"` } -// ArmPlan is the plan object in an ARM, represents a marketplace plan -type ArmPlan struct { - Name *string `json:"name,omitempty"` - Publisher *string `json:"publisher,omitempty"` - Product *string `json:"product,omitempty"` - PromotionCode *string `json:"promotionCode,omitempty"` - Version *string `json:"version,omitempty"` +// AppServiceCertificate is key Vault container for a certificate that is +// purchased through Azure. +type AppServiceCertificate struct { + KeyVaultID *string `json:"keyVaultId,omitempty"` + KeyVaultSecretName *string `json:"keyVaultSecretName,omitempty"` + ProvisioningState KeyVaultSecretStatus `json:"provisioningState,omitempty"` +} + +// AppServiceCertificateCollection is collection of certitificateorder +// certificates. +type AppServiceCertificateCollection struct { + autorest.Response `json:"-"` + Value *[]AppServiceCertificateResource `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// AppServiceCertificateCollectionPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client AppServiceCertificateCollection) AppServiceCertificateCollectionPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// AppServiceCertificateOrder is sSL certificate purchase order. +type AppServiceCertificateOrder struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Kind *string `json:"kind,omitempty"` + Location *string `json:"location,omitempty"` + Type *string `json:"type,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + *AppServiceCertificateOrderProperties `json:"properties,omitempty"` +} + +// AppServiceCertificateOrderProperties is appServiceCertificateOrder resource +// specific properties +type AppServiceCertificateOrderProperties struct { + Certificates *map[string]*AppServiceCertificate `json:"certificates,omitempty"` + DistinguishedName *string `json:"distinguishedName,omitempty"` + DomainVerificationToken *string `json:"domainVerificationToken,omitempty"` + ValidityInYears *int32 `json:"validityInYears,omitempty"` + KeySize *int32 `json:"keySize,omitempty"` + ProductType CertificateProductType `json:"productType,omitempty"` + AutoRenew *bool `json:"autoRenew,omitempty"` + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + Status CertificateOrderStatus `json:"status,omitempty"` + SignedCertificate *CertificateDetails `json:"signedCertificate,omitempty"` + Csr *string `json:"csr,omitempty"` + Intermediate *CertificateDetails `json:"intermediate,omitempty"` + Root *CertificateDetails `json:"root,omitempty"` + SerialNumber *string `json:"serialNumber,omitempty"` + LastCertificateIssuanceTime *date.Time `json:"lastCertificateIssuanceTime,omitempty"` + ExpirationTime *date.Time `json:"expirationTime,omitempty"` + IsPrivateKeyExternal *bool `json:"isPrivateKeyExternal,omitempty"` + AppServiceCertificateNotRenewableReasons *[]string `json:"appServiceCertificateNotRenewableReasons,omitempty"` +} + +// AppServiceCertificateOrderCollection is collection of certitificate orders. +type AppServiceCertificateOrderCollection struct { + autorest.Response `json:"-"` + Value *[]AppServiceCertificateOrder `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// AppServiceCertificateOrderCollectionPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client AppServiceCertificateOrderCollection) AppServiceCertificateOrderCollectionPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// AppServiceCertificateResource is key Vault container ARM resource for a +// certificate that is purchased through Azure. +type AppServiceCertificateResource struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Kind *string `json:"kind,omitempty"` + Location *string `json:"location,omitempty"` + Type *string `json:"type,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + *AppServiceCertificate `json:"properties,omitempty"` +} + +// AppServiceEnvironment is description of an App Service Environment. +type AppServiceEnvironment struct { + Name *string `json:"name,omitempty"` + Location *string `json:"location,omitempty"` + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + Status HostingEnvironmentStatus `json:"status,omitempty"` + VnetName *string `json:"vnetName,omitempty"` + VnetResourceGroupName *string `json:"vnetResourceGroupName,omitempty"` + VnetSubnetName *string `json:"vnetSubnetName,omitempty"` + VirtualNetwork *VirtualNetworkProfile `json:"virtualNetwork,omitempty"` + InternalLoadBalancingMode InternalLoadBalancingMode `json:"internalLoadBalancingMode,omitempty"` + MultiSize *string `json:"multiSize,omitempty"` + MultiRoleCount *int32 `json:"multiRoleCount,omitempty"` + WorkerPools *[]WorkerPool `json:"workerPools,omitempty"` + IpsslAddressCount *int32 `json:"ipsslAddressCount,omitempty"` + DatabaseEdition *string `json:"databaseEdition,omitempty"` + DatabaseServiceObjective *string `json:"databaseServiceObjective,omitempty"` + UpgradeDomains *int32 `json:"upgradeDomains,omitempty"` + SubscriptionID *string `json:"subscriptionId,omitempty"` + DNSSuffix *string `json:"dnsSuffix,omitempty"` + LastAction *string `json:"lastAction,omitempty"` + LastActionResult *string `json:"lastActionResult,omitempty"` + AllowedMultiSizes *string `json:"allowedMultiSizes,omitempty"` + AllowedWorkerSizes *string `json:"allowedWorkerSizes,omitempty"` + MaximumNumberOfMachines *int32 `json:"maximumNumberOfMachines,omitempty"` + VipMappings *[]VirtualIPMapping `json:"vipMappings,omitempty"` + EnvironmentCapacities *[]StampCapacity `json:"environmentCapacities,omitempty"` + NetworkAccessControlList *[]NetworkAccessControlEntry `json:"networkAccessControlList,omitempty"` + EnvironmentIsHealthy *bool `json:"environmentIsHealthy,omitempty"` + EnvironmentStatus *string `json:"environmentStatus,omitempty"` + Kind *string `json:"kind,omitempty"` + ResourceGroup *string `json:"resourceGroup,omitempty"` + FrontEndScaleFactor *int32 `json:"frontEndScaleFactor,omitempty"` + DefaultFrontEndScaleFactor *int32 `json:"defaultFrontEndScaleFactor,omitempty"` + APIManagementAccountID *string `json:"apiManagementAccountId,omitempty"` + Suspended *bool `json:"suspended,omitempty"` + DynamicCacheEnabled *bool `json:"dynamicCacheEnabled,omitempty"` + ClusterSettings *[]NameValuePair `json:"clusterSettings,omitempty"` +} + +// AppServiceEnvironmentCollection is collection of App Service Environments. +type AppServiceEnvironmentCollection struct { + autorest.Response `json:"-"` + Value *[]AppServiceEnvironment `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// AppServiceEnvironmentCollectionPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client AppServiceEnvironmentCollection) AppServiceEnvironmentCollectionPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// AppServiceEnvironmentResource is app Service Environment ARM resource. +type AppServiceEnvironmentResource struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Kind *string `json:"kind,omitempty"` + Location *string `json:"location,omitempty"` + Type *string `json:"type,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + *AppServiceEnvironment `json:"properties,omitempty"` +} + +// AppServicePlan is app Service plan. +type AppServicePlan struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Kind *string `json:"kind,omitempty"` + Location *string `json:"location,omitempty"` + Type *string `json:"type,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + *AppServicePlanProperties `json:"properties,omitempty"` + Sku *SkuDescription `json:"sku,omitempty"` +} + +// AppServicePlanProperties is appServicePlan resource specific properties +type AppServicePlanProperties struct { + Name *string `json:"name,omitempty"` + WorkerTierName *string `json:"workerTierName,omitempty"` + Status StatusOptions `json:"status,omitempty"` + Subscription *string `json:"subscription,omitempty"` + AdminSiteName *string `json:"adminSiteName,omitempty"` + HostingEnvironmentProfile *HostingEnvironmentProfile `json:"hostingEnvironmentProfile,omitempty"` + MaximumNumberOfWorkers *int32 `json:"maximumNumberOfWorkers,omitempty"` + GeoRegion *string `json:"geoRegion,omitempty"` + PerSiteScaling *bool `json:"perSiteScaling,omitempty"` + NumberOfSites *int32 `json:"numberOfSites,omitempty"` + ResourceGroup *string `json:"resourceGroup,omitempty"` + Reserved *bool `json:"reserved,omitempty"` + TargetWorkerCount *int32 `json:"targetWorkerCount,omitempty"` + TargetWorkerSizeID *int32 `json:"targetWorkerSizeId,omitempty"` + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` +} + +// AppServicePlanCollection is collection of App Service plans. +type AppServicePlanCollection struct { + autorest.Response `json:"-"` + Value *[]AppServicePlan `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// AppServicePlanCollectionPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client AppServicePlanCollection) AppServicePlanCollectionPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) } -// AutoHealActions is autoHealActions - Describes the actions which can be -// taken by the auto-heal module when a rule is triggered. +// AutoHealActions is actions which to take by the auto-heal module when a rule +// is triggered. type AutoHealActions struct { ActionType AutoHealActionType `json:"actionType,omitempty"` CustomAction *AutoHealCustomAction `json:"customAction,omitempty"` MinProcessExecutionTime *string `json:"minProcessExecutionTime,omitempty"` } -// AutoHealCustomAction is autoHealCustomAction - Describes the custom action -// to be executed +// AutoHealCustomAction is custom action to be executed // when an auto heal rule is triggered. type AutoHealCustomAction struct { Exe *string `json:"exe,omitempty"` Parameters *string `json:"parameters,omitempty"` } -// AutoHealRules is autoHealRules - describes the rules which can be defined -// for auto-heal +// AutoHealRules is rules that can be defined for auto-heal. type AutoHealRules struct { Triggers *AutoHealTriggers `json:"triggers,omitempty"` Actions *AutoHealActions `json:"actions,omitempty"` } -// AutoHealTriggers is autoHealTriggers - describes the triggers for auto-heal. +// AutoHealTriggers is triggers for auto-heal. type AutoHealTriggers struct { Requests *RequestsBasedTrigger `json:"requests,omitempty"` PrivateBytesInKB *int32 `json:"privateBytesInKB,omitempty"` @@ -687,7 +1165,7 @@ type AutoHealTriggers struct { } // AzureBlobStorageApplicationLogsConfig is application logs azure blob storage -// configuration +// configuration. type AzureBlobStorageApplicationLogsConfig struct { Level LogLevel `json:"level,omitempty"` SasURL *string `json:"sasUrl,omitempty"` @@ -695,21 +1173,21 @@ type AzureBlobStorageApplicationLogsConfig struct { } // AzureBlobStorageHTTPLogsConfig is http logs to azure blob storage -// configuration +// configuration. type AzureBlobStorageHTTPLogsConfig struct { SasURL *string `json:"sasUrl,omitempty"` RetentionInDays *int32 `json:"retentionInDays,omitempty"` Enabled *bool `json:"enabled,omitempty"` } -// AzureTableStorageApplicationLogsConfig is application logs to azure table -// storage configuration +// AzureTableStorageApplicationLogsConfig is application logs to Azure table +// storage configuration. type AzureTableStorageApplicationLogsConfig struct { Level LogLevel `json:"level,omitempty"` SasURL *string `json:"sasUrl,omitempty"` } -// BackupItem is backup description +// BackupItem is backup description. type BackupItem struct { autorest.Response `json:"-"` ID *string `json:"id,omitempty"` @@ -721,9 +1199,9 @@ type BackupItem struct { *BackupItemProperties `json:"properties,omitempty"` } -// BackupItemProperties is +// BackupItemProperties is backupItem resource specific properties type BackupItemProperties struct { - ID *int32 `json:"id,omitempty"` + BackupID *int32 `json:"id,omitempty"` StorageAccountURL *string `json:"storageAccountUrl,omitempty"` BlobName *string `json:"blobName,omitempty"` Name *string `json:"name,omitempty"` @@ -739,7 +1217,7 @@ type BackupItemProperties struct { WebsiteSizeInBytes *int64 `json:"websiteSizeInBytes,omitempty"` } -// BackupItemCollection is collection of Backup Items +// BackupItemCollection is collection of backup items. type BackupItemCollection struct { autorest.Response `json:"-"` Value *[]BackupItem `json:"value,omitempty"` @@ -758,7 +1236,7 @@ func (client BackupItemCollection) BackupItemCollectionPreparer() (*http.Request autorest.WithBaseURL(to.String(client.NextLink))) } -// BackupRequest is description of a backup which will be performed +// BackupRequest is description of a backup which will be performed. type BackupRequest struct { autorest.Response `json:"-"` ID *string `json:"id,omitempty"` @@ -770,9 +1248,9 @@ type BackupRequest struct { *BackupRequestProperties `json:"properties,omitempty"` } -// BackupRequestProperties is +// BackupRequestProperties is backupRequest resource specific properties type BackupRequestProperties struct { - Name *string `json:"name,omitempty"` + BackupRequestName *string `json:"name,omitempty"` Enabled *bool `json:"enabled,omitempty"` StorageAccountURL *string `json:"storageAccountUrl,omitempty"` BackupSchedule *BackupSchedule `json:"backupSchedule,omitempty"` @@ -791,7 +1269,15 @@ type BackupSchedule struct { LastExecutionTime *date.Time `json:"lastExecutionTime,omitempty"` } -// Certificate is app certificate +// Capability is describes the capabilities/features allowed for a specific +// SKU. +type Capability struct { + Name *string `json:"name,omitempty"` + Value *string `json:"value,omitempty"` + Reason *string `json:"reason,omitempty"` +} + +// Certificate is sSL certificate for an app. type Certificate struct { autorest.Response `json:"-"` ID *string `json:"id,omitempty"` @@ -803,12 +1289,12 @@ type Certificate struct { *CertificateProperties `json:"properties,omitempty"` } -// CertificateProperties is +// CertificateProperties is certificate resource specific properties type CertificateProperties struct { FriendlyName *string `json:"friendlyName,omitempty"` SubjectName *string `json:"subjectName,omitempty"` HostNames *[]string `json:"hostNames,omitempty"` - PfxBlob *string `json:"pfxBlob,omitempty"` + PfxBlob *[]byte `json:"pfxBlob,omitempty"` SiteName *string `json:"siteName,omitempty"` SelfLink *string `json:"selfLink,omitempty"` Issuer *string `json:"issuer,omitempty"` @@ -820,9 +1306,13 @@ type CertificateProperties struct { CerBlob *string `json:"cerBlob,omitempty"` PublicKeyHash *string `json:"publicKeyHash,omitempty"` HostingEnvironmentProfile *HostingEnvironmentProfile `json:"hostingEnvironmentProfile,omitempty"` + KeyVaultID *string `json:"keyVaultId,omitempty"` + KeyVaultSecretName *string `json:"keyVaultSecretName,omitempty"` + KeyVaultSecretStatus KeyVaultSecretStatus `json:"keyVaultSecretStatus,omitempty"` + ServerFarmID *string `json:"serverFarmId,omitempty"` } -// CertificateCollection is collection of certificates +// CertificateCollection is collection of certificates. type CertificateCollection struct { autorest.Response `json:"-"` Value *[]Certificate `json:"value,omitempty"` @@ -841,19 +1331,8 @@ func (client CertificateCollection) CertificateCollectionPreparer() (*http.Reque autorest.WithBaseURL(to.String(client.NextLink))) } -// CertificateDetails is certificate Details +// CertificateDetails is sSL certificate details. type CertificateDetails struct { - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Kind *string `json:"kind,omitempty"` - Location *string `json:"location,omitempty"` - Type *string `json:"type,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - *CertificateDetailsProperties `json:"properties,omitempty"` -} - -// CertificateDetailsProperties is -type CertificateDetailsProperties struct { Version *int32 `json:"version,omitempty"` SerialNumber *string `json:"serialNumber,omitempty"` Thumbprint *string `json:"thumbprint,omitempty"` @@ -865,7 +1344,7 @@ type CertificateDetailsProperties struct { RawData *string `json:"rawData,omitempty"` } -// CertificateEmail is certificate Email +// CertificateEmail is sSL certificate email. type CertificateEmail struct { ID *string `json:"id,omitempty"` Name *string `json:"name,omitempty"` @@ -876,45 +1355,13 @@ type CertificateEmail struct { *CertificateEmailProperties `json:"properties,omitempty"` } -// CertificateEmailProperties is +// CertificateEmailProperties is certificateEmail resource specific properties type CertificateEmailProperties struct { EmailID *string `json:"emailId,omitempty"` TimeStamp *date.Time `json:"timeStamp,omitempty"` } -// CertificateOrder is certificate purchase order -type CertificateOrder struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Kind *string `json:"kind,omitempty"` - Location *string `json:"location,omitempty"` - Type *string `json:"type,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - *CertificateOrderProperties `json:"properties,omitempty"` -} - -// CertificateOrderProperties is -type CertificateOrderProperties struct { - Certificates *map[string]*CertificateOrderCertificate `json:"certificates,omitempty"` - DistinguishedName *string `json:"distinguishedName,omitempty"` - DomainVerificationToken *string `json:"domainVerificationToken,omitempty"` - ValidityInYears *int32 `json:"validityInYears,omitempty"` - KeySize *int32 `json:"keySize,omitempty"` - ProductType CertificateProductType `json:"productType,omitempty"` - AutoRenew *bool `json:"autoRenew,omitempty"` - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` - Status CertificateOrderStatus `json:"status,omitempty"` - SignedCertificate *CertificateDetails `json:"signedCertificate,omitempty"` - Csr *string `json:"csr,omitempty"` - Intermediate *CertificateDetails `json:"intermediate,omitempty"` - Root *CertificateDetails `json:"root,omitempty"` - SerialNumber *string `json:"serialNumber,omitempty"` - LastCertificateIssuanceTime *date.Time `json:"lastCertificateIssuanceTime,omitempty"` - ExpirationTime *date.Time `json:"expirationTime,omitempty"` -} - -// CertificateOrderAction is represents a certificate action +// CertificateOrderAction is certificate order action. type CertificateOrderAction struct { ID *string `json:"id,omitempty"` Name *string `json:"name,omitempty"` @@ -925,149 +1372,56 @@ type CertificateOrderAction struct { *CertificateOrderActionProperties `json:"properties,omitempty"` } -// CertificateOrderActionProperties is +// CertificateOrderActionProperties is certificateOrderAction resource specific +// properties type CertificateOrderActionProperties struct { Type CertificateOrderActionType `json:"type,omitempty"` CreatedAt *date.Time `json:"createdAt,omitempty"` } -// CertificateOrderCertificate is class representing the Key Vault container -// for certificate purchased through Azure -type CertificateOrderCertificate struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Kind *string `json:"kind,omitempty"` - Location *string `json:"location,omitempty"` - Type *string `json:"type,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - *CertificateOrderCertificateProperties `json:"properties,omitempty"` -} - -// CertificateOrderCertificateProperties is -type CertificateOrderCertificateProperties struct { - KeyVaultID *string `json:"keyVaultId,omitempty"` - KeyVaultSecretName *string `json:"keyVaultSecretName,omitempty"` - ProvisioningState KeyVaultSecretStatus `json:"provisioningState,omitempty"` +// CloningInfo is information needed for cloning operation. +type CloningInfo struct { + CorrelationID *string `json:"correlationId,omitempty"` + Overwrite *bool `json:"overwrite,omitempty"` + CloneCustomHostNames *bool `json:"cloneCustomHostNames,omitempty"` + CloneSourceControl *bool `json:"cloneSourceControl,omitempty"` + SourceWebAppID *string `json:"sourceWebAppId,omitempty"` + HostingEnvironment *string `json:"hostingEnvironment,omitempty"` + AppSettingsOverrides *map[string]*string `json:"appSettingsOverrides,omitempty"` + ConfigureLoadBalancing *bool `json:"configureLoadBalancing,omitempty"` + TrafficManagerProfileID *string `json:"trafficManagerProfileId,omitempty"` + TrafficManagerProfileName *string `json:"trafficManagerProfileName,omitempty"` } -// CertificateOrderCertificateCollection is collection of ceritificateorder -// certificates -type CertificateOrderCertificateCollection struct { +// ConnectionStringDictionary is string dictionary resource. +type ConnectionStringDictionary struct { autorest.Response `json:"-"` - Value *[]CertificateOrderCertificate `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Kind *string `json:"kind,omitempty"` + Location *string `json:"location,omitempty"` + Type *string `json:"type,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + Properties *map[string]*ConnStringValueTypePair `json:"properties,omitempty"` } -// CertificateOrderCertificateCollectionPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client CertificateOrderCertificateCollection) CertificateOrderCertificateCollectionPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) +// ConnStringInfo is database connection string information. +type ConnStringInfo struct { + Name *string `json:"name,omitempty"` + ConnectionString *string `json:"connectionString,omitempty"` + Type ConnectionStringType `json:"type,omitempty"` } -// CertificateOrderCollection is collection of ceritificate orders -type CertificateOrderCollection struct { - autorest.Response `json:"-"` - Value *[]CertificateOrder `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// CertificateOrderCollectionPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client CertificateOrderCollection) CertificateOrderCollectionPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// ClassicMobileService is a mobile service -type ClassicMobileService struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Kind *string `json:"kind,omitempty"` - Location *string `json:"location,omitempty"` - Type *string `json:"type,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - *ClassicMobileServiceProperties `json:"properties,omitempty"` -} - -// ClassicMobileServiceProperties is -type ClassicMobileServiceProperties struct { - Name *string `json:"name,omitempty"` -} - -// ClassicMobileServiceCollection is collection of Classic Mobile Services -type ClassicMobileServiceCollection struct { - autorest.Response `json:"-"` - Value *[]ClassicMobileService `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// ClassicMobileServiceCollectionPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client ClassicMobileServiceCollection) ClassicMobileServiceCollectionPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// CloningInfo is represents information needed for cloning operation -type CloningInfo struct { - CorrelationID *string `json:"correlationId,omitempty"` - Overwrite *bool `json:"overwrite,omitempty"` - CloneCustomHostNames *bool `json:"cloneCustomHostNames,omitempty"` - CloneSourceControl *bool `json:"cloneSourceControl,omitempty"` - SourceWebAppID *string `json:"sourceWebAppId,omitempty"` - HostingEnvironment *string `json:"hostingEnvironment,omitempty"` - AppSettingsOverrides *map[string]*string `json:"appSettingsOverrides,omitempty"` - ConfigureLoadBalancing *bool `json:"configureLoadBalancing,omitempty"` - TrafficManagerProfileID *string `json:"trafficManagerProfileId,omitempty"` - TrafficManagerProfileName *string `json:"trafficManagerProfileName,omitempty"` -} - -// ConnectionStringDictionary is string dictionary resource -type ConnectionStringDictionary struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Kind *string `json:"kind,omitempty"` - Location *string `json:"location,omitempty"` - Type *string `json:"type,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - Properties *map[string]*ConnStringValueTypePair `json:"properties,omitempty"` -} - -// ConnStringInfo is represents database connection string information -type ConnStringInfo struct { - Name *string `json:"name,omitempty"` - ConnectionString *string `json:"connectionString,omitempty"` - Type DatabaseServerType `json:"type,omitempty"` -} - -// ConnStringValueTypePair is database connection string value to type pair -type ConnStringValueTypePair struct { - Value *string `json:"value,omitempty"` - Type DatabaseServerType `json:"type,omitempty"` +// ConnStringValueTypePair is database connection string value to type pair. +type ConnStringValueTypePair struct { + Value *string `json:"value,omitempty"` + Type ConnectionStringType `json:"type,omitempty"` } // Contact is contact information for domain registration. If 'Domain Privacy' -// option is not selected then the contact information will be be made -// publicly available through the Whois directories as per ICANN requirements. +// option is not selected then the contact information is made publicly +// available through the Whois +// directories as per ICANN requirements. type Contact struct { AddressMailing *Address `json:"addressMailing,omitempty"` Email *string `json:"email,omitempty"` @@ -1080,40 +1434,37 @@ type Contact struct { Phone *string `json:"phone,omitempty"` } -// CorsSettings is cross-Origin Resource Sharing (CORS) settings for the web -// app. +// CorsSettings is cross-Origin Resource Sharing (CORS) settings for the app. type CorsSettings struct { AllowedOrigins *[]string `json:"allowedOrigins,omitempty"` } -// CsmMoveResourceEnvelope is class containing a list of the resources that -// need to be moved and the resource group they should be moved to +// CsmMoveResourceEnvelope is object with a list of the resources that need to +// be moved and the resource group they should be moved to. type CsmMoveResourceEnvelope struct { TargetResourceGroup *string `json:"targetResourceGroup,omitempty"` Resources *[]string `json:"resources,omitempty"` } -// CsmPublishingProfileOptions is publishing options for requested profile +// CsmPublishingProfileOptions is publishing options for requested profile. type CsmPublishingProfileOptions struct { - Format *string `json:"format,omitempty"` + Format PublishingProfileFormat `json:"format,omitempty"` } -// CsmSiteRecoveryEntity is class containting details about site recovery -// operation. +// CsmSiteRecoveryEntity is details about app recovery operation. type CsmSiteRecoveryEntity struct { - SnapshotTime *date.Time `json:"snapshotTime,omitempty"` - RecoverConfig *bool `json:"recoverConfig,omitempty"` - SiteName *string `json:"siteName,omitempty"` - SlotName *string `json:"slotName,omitempty"` + SnapshotTime *date.Time `json:"snapshotTime,omitempty"` + SiteName *string `json:"siteName,omitempty"` + SlotName *string `json:"slotName,omitempty"` } -// CsmSlotEntity is class containing deployment slot parameters +// CsmSlotEntity is deployment slot parameters. type CsmSlotEntity struct { TargetSlot *string `json:"targetSlot,omitempty"` PreserveVnet *bool `json:"preserveVnet,omitempty"` } -// CsmUsageQuota is usage of the quota resource +// CsmUsageQuota is usage of the quota resource. type CsmUsageQuota struct { Unit *string `json:"unit,omitempty"` NextResetTime *date.Time `json:"nextResetTime,omitempty"` @@ -1122,7 +1473,7 @@ type CsmUsageQuota struct { Name *LocalizableString `json:"name,omitempty"` } -// CsmUsageQuotaCollection is collection of csm usage quotas +// CsmUsageQuotaCollection is collection of CSM usage quotas. type CsmUsageQuotaCollection struct { autorest.Response `json:"-"` Value *[]CsmUsageQuota `json:"value,omitempty"` @@ -1141,7 +1492,7 @@ func (client CsmUsageQuotaCollection) CsmUsageQuotaCollectionPreparer() (*http.R autorest.WithBaseURL(to.String(client.NextLink))) } -// Csr is certificate signing request object +// Csr is certificate signing request. type Csr struct { autorest.Response `json:"-"` ID *string `json:"id,omitempty"` @@ -1153,7 +1504,7 @@ type Csr struct { *CsrProperties `json:"properties,omitempty"` } -// CsrProperties is +// CsrProperties is csr resource specific properties type CsrProperties struct { Name *string `json:"name,omitempty"` DistinguishedName *string `json:"distinguishedName,omitempty"` @@ -1164,18 +1515,62 @@ type CsrProperties struct { HostingEnvironment *string `json:"hostingEnvironment,omitempty"` } -// DatabaseBackupSetting is note: properties are serialized in JSON format and -// stored in DB. -// if new properties are added they might not be in the previous data rows -// so please handle nulls +// CsrCollection is collection of CSRs. +type CsrCollection struct { + autorest.Response `json:"-"` + Value *[]Csr `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// CsrCollectionPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client CsrCollection) CsrCollectionPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// CustomHostnameAnalysisResult is custom domain analysis. +type CustomHostnameAnalysisResult struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Kind *string `json:"kind,omitempty"` + Location *string `json:"location,omitempty"` + Type *string `json:"type,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + *CustomHostnameAnalysisResultProperties `json:"properties,omitempty"` +} + +// CustomHostnameAnalysisResultProperties is customHostnameAnalysisResult +// resource specific properties +type CustomHostnameAnalysisResultProperties struct { + IsHostnameAlreadyVerified *bool `json:"isHostnameAlreadyVerified,omitempty"` + CustomDomainVerificationTest DNSVerificationTestResult `json:"customDomainVerificationTest,omitempty"` + CustomDomainVerificationFailureInfo *ErrorEntity `json:"customDomainVerificationFailureInfo,omitempty"` + HasConflictOnScaleUnit *bool `json:"hasConflictOnScaleUnit,omitempty"` + HasConflictAcrossSubscription *bool `json:"hasConflictAcrossSubscription,omitempty"` + ConflictingAppResourceID *string `json:"conflictingAppResourceId,omitempty"` + CNameRecords *[]string `json:"cNameRecords,omitempty"` + TxtRecords *[]string `json:"txtRecords,omitempty"` + ARecords *[]string `json:"aRecords,omitempty"` + AlternateCNameRecords *[]string `json:"alternateCNameRecords,omitempty"` + AlternateTxtRecords *[]string `json:"alternateTxtRecords,omitempty"` +} + +// DatabaseBackupSetting is database backup settings. type DatabaseBackupSetting struct { - DatabaseType *string `json:"databaseType,omitempty"` - Name *string `json:"name,omitempty"` - ConnectionStringName *string `json:"connectionStringName,omitempty"` - ConnectionString *string `json:"connectionString,omitempty"` + DatabaseType DatabaseType `json:"databaseType,omitempty"` + Name *string `json:"name,omitempty"` + ConnectionStringName *string `json:"connectionStringName,omitempty"` + ConnectionString *string `json:"connectionString,omitempty"` } -// DeletedSite is reports deleted site including the timestamp of operation +// DeletedSite is a deleted app. type DeletedSite struct { ID *string `json:"id,omitempty"` Name *string `json:"name,omitempty"` @@ -1186,10 +1581,9 @@ type DeletedSite struct { *DeletedSiteProperties `json:"properties,omitempty"` } -// DeletedSiteProperties is +// DeletedSiteProperties is deletedSite resource specific properties type DeletedSiteProperties struct { DeletedTimestamp *date.Time `json:"deletedTimestamp,omitempty"` - Name *string `json:"name,omitempty"` State *string `json:"state,omitempty"` HostNames *[]string `json:"hostNames,omitempty"` RepositorySiteName *string `json:"repositorySiteName,omitempty"` @@ -1199,6 +1593,7 @@ type DeletedSiteProperties struct { AvailabilityState SiteAvailabilityState `json:"availabilityState,omitempty"` HostNameSslStates *[]HostNameSslState `json:"hostNameSslStates,omitempty"` ServerFarmID *string `json:"serverFarmId,omitempty"` + Reserved *bool `json:"reserved,omitempty"` LastModifiedTimeUtc *date.Time `json:"lastModifiedTimeUtc,omitempty"` SiteConfig *SiteConfig `json:"siteConfig,omitempty"` TrafficManagerHostNames *[]string `json:"trafficManagerHostNames,omitempty"` @@ -1213,23 +1608,26 @@ type DeletedSiteProperties struct { HostNamesDisabled *bool `json:"hostNamesDisabled,omitempty"` OutboundIPAddresses *string `json:"outboundIpAddresses,omitempty"` ContainerSize *int32 `json:"containerSize,omitempty"` + DailyMemoryTimeQuota *int32 `json:"dailyMemoryTimeQuota,omitempty"` + SuspendedTill *date.Time `json:"suspendedTill,omitempty"` MaxNumberOfWorkers *int32 `json:"maxNumberOfWorkers,omitempty"` CloningInfo *CloningInfo `json:"cloningInfo,omitempty"` ResourceGroup *string `json:"resourceGroup,omitempty"` IsDefaultContainer *bool `json:"isDefaultContainer,omitempty"` DefaultHostName *string `json:"defaultHostName,omitempty"` + SlotSwapStatus *SlotSwapStatus `json:"slotSwapStatus,omitempty"` } -// DeletedSiteCollection is collection of deleted sites -type DeletedSiteCollection struct { +// DeletedWebAppCollection is collection of deleted apps. +type DeletedWebAppCollection struct { autorest.Response `json:"-"` Value *[]DeletedSite `json:"value,omitempty"` NextLink *string `json:"nextLink,omitempty"` } -// DeletedSiteCollectionPreparer prepares a request to retrieve the next set of results. It returns +// DeletedWebAppCollectionPreparer prepares a request to retrieve the next set of results. It returns // nil if no more results exist. -func (client DeletedSiteCollection) DeletedSiteCollectionPreparer() (*http.Request, error) { +func (client DeletedWebAppCollection) DeletedWebAppCollectionPreparer() (*http.Request, error) { if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { return nil, nil } @@ -1239,7 +1637,7 @@ func (client DeletedSiteCollection) DeletedSiteCollectionPreparer() (*http.Reque autorest.WithBaseURL(to.String(client.NextLink))) } -// Deployment is represents user crendentials used for publishing activity +// Deployment is user crendentials used for publishing activity. type Deployment struct { autorest.Response `json:"-"` ID *string `json:"id,omitempty"` @@ -1251,7 +1649,7 @@ type Deployment struct { *DeploymentProperties `json:"properties,omitempty"` } -// DeploymentProperties is +// DeploymentProperties is deployment resource specific properties type DeploymentProperties struct { ID *string `json:"id,omitempty"` Status *int32 `json:"status,omitempty"` @@ -1265,7 +1663,7 @@ type DeploymentProperties struct { Details *string `json:"details,omitempty"` } -// DeploymentCollection is collection of app deployments +// DeploymentCollection is collection of app deployments. type DeploymentCollection struct { autorest.Response `json:"-"` Value *[]Deployment `json:"value,omitempty"` @@ -1284,7 +1682,7 @@ func (client DeploymentCollection) DeploymentCollectionPreparer() (*http.Request autorest.WithBaseURL(to.String(client.NextLink))) } -// Domain is represents a domain +// Domain is information about a domain. type Domain struct { autorest.Response `json:"-"` ID *string `json:"id,omitempty"` @@ -1296,7 +1694,7 @@ type Domain struct { *DomainProperties `json:"properties,omitempty"` } -// DomainProperties is +// DomainProperties is domain resource specific properties type DomainProperties struct { ContactAdmin *Contact `json:"contactAdmin,omitempty"` ContactBilling *Contact `json:"contactBilling,omitempty"` @@ -1316,7 +1714,7 @@ type DomainProperties struct { DomainNotRenewableReasons *[]string `json:"domainNotRenewableReasons,omitempty"` } -// DomainAvailablilityCheckResult is domain availablility check result +// DomainAvailablilityCheckResult is domain availablility check result. type DomainAvailablilityCheckResult struct { autorest.Response `json:"-"` Name *string `json:"name,omitempty"` @@ -1324,7 +1722,7 @@ type DomainAvailablilityCheckResult struct { DomainType DomainType `json:"domainType,omitempty"` } -// DomainCollection is collection of domains +// DomainCollection is collection of domains. type DomainCollection struct { autorest.Response `json:"-"` Value *[]Domain `json:"value,omitempty"` @@ -1343,8 +1741,8 @@ func (client DomainCollection) DomainCollectionPreparer() (*http.Request, error) autorest.WithBaseURL(to.String(client.NextLink))) } -// DomainControlCenterSsoRequest is single sign on request information for -// domain management +// DomainControlCenterSsoRequest is single sign-on request information for +// domain management. type DomainControlCenterSsoRequest struct { autorest.Response `json:"-"` URL *string `json:"url,omitempty"` @@ -1352,8 +1750,46 @@ type DomainControlCenterSsoRequest struct { PostParameterValue *string `json:"postParameterValue,omitempty"` } -// DomainPurchaseConsent is domain purchase consent object representing -// acceptance of applicable legal agreements +// DomainOwnershipIdentifier is domain ownership Identifier. +type DomainOwnershipIdentifier struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Kind *string `json:"kind,omitempty"` + Location *string `json:"location,omitempty"` + Type *string `json:"type,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + *DomainOwnershipIdentifierProperties `json:"properties,omitempty"` +} + +// DomainOwnershipIdentifierProperties is domainOwnershipIdentifier resource +// specific properties +type DomainOwnershipIdentifierProperties struct { + OwnershipID *string `json:"ownershipId,omitempty"` +} + +// DomainOwnershipIdentifierCollection is collection of domain ownership +// identifiers. +type DomainOwnershipIdentifierCollection struct { + autorest.Response `json:"-"` + Value *[]DomainOwnershipIdentifier `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// DomainOwnershipIdentifierCollectionPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client DomainOwnershipIdentifierCollection) DomainOwnershipIdentifierCollectionPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// DomainPurchaseConsent is domain purchase consent object, representing +// acceptance of applicable legal agreements. type DomainPurchaseConsent struct { AgreementKeys *[]string `json:"agreementKeys,omitempty"` AgreedBy *string `json:"agreedBy,omitempty"` @@ -1361,68 +1797,46 @@ type DomainPurchaseConsent struct { } // DomainRecommendationSearchParameters is domain recommendation search -// parameters +// parameters. type DomainRecommendationSearchParameters struct { Keywords *string `json:"keywords,omitempty"` MaxDomainRecommendations *int32 `json:"maxDomainRecommendations,omitempty"` } -// DomainRegistrationInput is domain registration input for validation Api -type DomainRegistrationInput struct { - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Kind *string `json:"kind,omitempty"` - Location *string `json:"location,omitempty"` - Type *string `json:"type,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - *DomainRegistrationInputProperties `json:"properties,omitempty"` -} - -// DomainRegistrationInputProperties is -type DomainRegistrationInputProperties struct { - Name *string `json:"name,omitempty"` - ContactAdmin *Contact `json:"contactAdmin,omitempty"` - ContactBilling *Contact `json:"contactBilling,omitempty"` - ContactRegistrant *Contact `json:"contactRegistrant,omitempty"` - ContactTech *Contact `json:"contactTech,omitempty"` - RegistrationStatus DomainStatus `json:"registrationStatus,omitempty"` - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` - NameServers *[]string `json:"nameServers,omitempty"` - Privacy *bool `json:"privacy,omitempty"` - CreatedTime *date.Time `json:"createdTime,omitempty"` - ExpirationTime *date.Time `json:"expirationTime,omitempty"` - LastRenewedTime *date.Time `json:"lastRenewedTime,omitempty"` - AutoRenew *bool `json:"autoRenew,omitempty"` - ReadyForDNSRecordManagement *bool `json:"readyForDnsRecordManagement,omitempty"` - ManagedHostNames *[]HostName `json:"managedHostNames,omitempty"` - Consent *DomainPurchaseConsent `json:"consent,omitempty"` - DomainNotRenewableReasons *[]string `json:"domainNotRenewableReasons,omitempty"` -} - -// EnabledConfig is enabled configuration +// EnabledConfig is enabled configuration. type EnabledConfig struct { Enabled *bool `json:"enabled,omitempty"` } -// Experiments is class containing Routing in production experiments +// ErrorEntity is body of the error response returned from the API. +type ErrorEntity struct { + ExtendedCode *string `json:"extendedCode,omitempty"` + MessageTemplate *string `json:"messageTemplate,omitempty"` + Parameters *[]string `json:"parameters,omitempty"` + InnerErrors *[]ErrorEntity `json:"innerErrors,omitempty"` + Code *string `json:"code,omitempty"` + Message *string `json:"message,omitempty"` +} + +// Experiments is routing rules in production experiments. type Experiments struct { RampUpRules *[]RampUpRule `json:"rampUpRules,omitempty"` } // FileSystemApplicationLogsConfig is application logs to file system -// configuration +// configuration. type FileSystemApplicationLogsConfig struct { Level LogLevel `json:"level,omitempty"` } -// FileSystemHTTPLogsConfig is http logs to file system configuration +// FileSystemHTTPLogsConfig is http logs to file system configuration. type FileSystemHTTPLogsConfig struct { RetentionInMb *int32 `json:"retentionInMb,omitempty"` RetentionInDays *int32 `json:"retentionInDays,omitempty"` Enabled *bool `json:"enabled,omitempty"` } -// GeoRegion is geographical region +// GeoRegion is geographical region. type GeoRegion struct { ID *string `json:"id,omitempty"` Name *string `json:"name,omitempty"` @@ -1433,14 +1847,14 @@ type GeoRegion struct { *GeoRegionProperties `json:"properties,omitempty"` } -// GeoRegionProperties is +// GeoRegionProperties is geoRegion resource specific properties type GeoRegionProperties struct { Name *string `json:"name,omitempty"` Description *string `json:"description,omitempty"` DisplayName *string `json:"displayName,omitempty"` } -// GeoRegionCollection is collection of geo regions +// GeoRegionCollection is collection of geographical regions. type GeoRegionCollection struct { autorest.Response `json:"-"` Value *[]GeoRegion `json:"value,omitempty"` @@ -1459,9 +1873,18 @@ func (client GeoRegionCollection) GeoRegionCollectionPreparer() (*http.Request, autorest.WithBaseURL(to.String(client.NextLink))) } +// GlobalCsmSkuDescription is a Global SKU Description. +type GlobalCsmSkuDescription struct { + Name *string `json:"name,omitempty"` + Tier *string `json:"tier,omitempty"` + Capacity *SkuCapacity `json:"capacity,omitempty"` + Locations *[]string `json:"locations,omitempty"` + Capabilities *[]Capability `json:"capabilities,omitempty"` +} + // HandlerMapping is the IIS handler mappings used to define which handler // processes HTTP requests with certain extension. -// For example it is used to configure php-cgi.exe process to handle all HTTP +// For example, it is used to configure php-cgi.exe process to handle all HTTP // requests with *.php extension. type HandlerMapping struct { Extension *string `json:"extension,omitempty"` @@ -1469,92 +1892,22 @@ type HandlerMapping struct { Arguments *string `json:"arguments,omitempty"` } -// HostingEnvironment is description of an hostingEnvironment (App Service -// Environment) -type HostingEnvironment struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Kind *string `json:"kind,omitempty"` - Location *string `json:"location,omitempty"` - Type *string `json:"type,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - *HostingEnvironmentProperties `json:"properties,omitempty"` -} - -// HostingEnvironmentProperties is -type HostingEnvironmentProperties struct { - Name *string `json:"name,omitempty"` - Location *string `json:"location,omitempty"` - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` - Status HostingEnvironmentStatus `json:"status,omitempty"` - VnetName *string `json:"vnetName,omitempty"` - VnetResourceGroupName *string `json:"vnetResourceGroupName,omitempty"` - VnetSubnetName *string `json:"vnetSubnetName,omitempty"` - VirtualNetwork *VirtualNetworkProfile `json:"virtualNetwork,omitempty"` - InternalLoadBalancingMode InternalLoadBalancingMode `json:"internalLoadBalancingMode,omitempty"` - MultiSize *string `json:"multiSize,omitempty"` - MultiRoleCount *int32 `json:"multiRoleCount,omitempty"` - WorkerPools *[]WorkerPool `json:"workerPools,omitempty"` - IpsslAddressCount *int32 `json:"ipsslAddressCount,omitempty"` - DatabaseEdition *string `json:"databaseEdition,omitempty"` - DatabaseServiceObjective *string `json:"databaseServiceObjective,omitempty"` - UpgradeDomains *int32 `json:"upgradeDomains,omitempty"` - SubscriptionID *string `json:"subscriptionId,omitempty"` - DNSSuffix *string `json:"dnsSuffix,omitempty"` - LastAction *string `json:"lastAction,omitempty"` - LastActionResult *string `json:"lastActionResult,omitempty"` - AllowedMultiSizes *string `json:"allowedMultiSizes,omitempty"` - AllowedWorkerSizes *string `json:"allowedWorkerSizes,omitempty"` - MaximumNumberOfMachines *int32 `json:"maximumNumberOfMachines,omitempty"` - VipMappings *[]VirtualIPMapping `json:"vipMappings,omitempty"` - EnvironmentCapacities *[]StampCapacity `json:"environmentCapacities,omitempty"` - NetworkAccessControlList *[]NetworkAccessControlEntry `json:"networkAccessControlList,omitempty"` - EnvironmentIsHealthy *bool `json:"environmentIsHealthy,omitempty"` - EnvironmentStatus *string `json:"environmentStatus,omitempty"` - ResourceGroup *string `json:"resourceGroup,omitempty"` - APIManagementAccountID *string `json:"apiManagementAccountId,omitempty"` - Suspended *bool `json:"suspended,omitempty"` - ClusterSettings *[]NameValuePair `json:"clusterSettings,omitempty"` -} - -// HostingEnvironmentCollection is collection of hosting environments (App -// Service Environments) -type HostingEnvironmentCollection struct { - autorest.Response `json:"-"` - Value *[]HostingEnvironment `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// HostingEnvironmentCollectionPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client HostingEnvironmentCollection) HostingEnvironmentCollectionPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// HostingEnvironmentDiagnostics is diagnostics for a hosting environment (App -// Service Environment) +// HostingEnvironmentDiagnostics is diagnostics for an App Service Environment. type HostingEnvironmentDiagnostics struct { autorest.Response `json:"-"` Name *string `json:"name,omitempty"` DiagnosicsOutput *string `json:"diagnosicsOutput,omitempty"` } -// HostingEnvironmentProfile is specification for a hostingEnvironment (App -// Service Environment) to use for this resource +// HostingEnvironmentProfile is specification for an App Service Environment to +// use for this resource. type HostingEnvironmentProfile struct { ID *string `json:"id,omitempty"` Name *string `json:"name,omitempty"` Type *string `json:"type,omitempty"` } -// HostName is details of a hostname derived from a domain +// HostName is details of a hostname derived from a domain. type HostName struct { Name *string `json:"name,omitempty"` SiteNames *[]string `json:"siteNames,omitempty"` @@ -1564,7 +1917,7 @@ type HostName struct { HostNameType HostNameType `json:"hostNameType,omitempty"` } -// HostNameBinding is a host name binding object +// HostNameBinding is a hostname binding object. type HostNameBinding struct { autorest.Response `json:"-"` ID *string `json:"id,omitempty"` @@ -1576,7 +1929,7 @@ type HostNameBinding struct { *HostNameBindingProperties `json:"properties,omitempty"` } -// HostNameBindingProperties is +// HostNameBindingProperties is hostNameBinding resource specific properties type HostNameBindingProperties struct { Name *string `json:"name,omitempty"` SiteName *string `json:"siteName,omitempty"` @@ -1585,9 +1938,12 @@ type HostNameBindingProperties struct { AzureResourceType AzureResourceType `json:"azureResourceType,omitempty"` CustomHostNameDNSRecordType CustomHostNameDNSRecordType `json:"customHostNameDnsRecordType,omitempty"` HostNameType HostNameType `json:"hostNameType,omitempty"` + SslState SslState `json:"sslState,omitempty"` + Thumbprint *string `json:"thumbprint,omitempty"` + VirtualIP *string `json:"virtualIP,omitempty"` } -// HostNameBindingCollection is collection of host name bindings +// HostNameBindingCollection is collection of hostname bindings. type HostNameBindingCollection struct { autorest.Response `json:"-"` Value *[]HostNameBinding `json:"value,omitempty"` @@ -1606,31 +1962,151 @@ func (client HostNameBindingCollection) HostNameBindingCollectionPreparer() (*ht autorest.WithBaseURL(to.String(client.NextLink))) } -// HostNameSslState is object that represents a SSL-enabled host name. +// HostNameSslState is sSL-enabled hostname. type HostNameSslState struct { Name *string `json:"name,omitempty"` SslState SslState `json:"sslState,omitempty"` VirtualIP *string `json:"virtualIP,omitempty"` Thumbprint *string `json:"thumbprint,omitempty"` ToUpdate *bool `json:"toUpdate,omitempty"` + HostType HostType `json:"hostType,omitempty"` } -// HTTPLogsConfig is http logs configuration +// HTTPLogsConfig is http logs configuration. type HTTPLogsConfig struct { FileSystem *FileSystemHTTPLogsConfig `json:"fileSystem,omitempty"` AzureBlobStorage *AzureBlobStorageHTTPLogsConfig `json:"azureBlobStorage,omitempty"` } -// IPSecurityRestriction is represents an ip security restriction on a web app. +// HybridConnection is hybrid Connection contract. This is used to configure a +// Hybrid Connection. +type HybridConnection struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Kind *string `json:"kind,omitempty"` + Location *string `json:"location,omitempty"` + Type *string `json:"type,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + *HybridConnectionProperties `json:"properties,omitempty"` +} + +// HybridConnectionProperties is hybridConnection resource specific properties +type HybridConnectionProperties struct { + ServiceBusNamespace *string `json:"serviceBusNamespace,omitempty"` + RelayName *string `json:"relayName,omitempty"` + RelayArmURI *string `json:"relayArmUri,omitempty"` + Hostname *string `json:"hostname,omitempty"` + Port *int32 `json:"port,omitempty"` + SendKeyName *string `json:"sendKeyName,omitempty"` + SendKeyValue *string `json:"sendKeyValue,omitempty"` +} + +// HybridConnectionCollection is collection of hostname bindings. +type HybridConnectionCollection struct { + autorest.Response `json:"-"` + Value *[]HybridConnection `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// HybridConnectionCollectionPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client HybridConnectionCollection) HybridConnectionCollectionPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// HybridConnectionKey is hybrid Connection key contract. This has the send key +// name and value for a Hybrid Connection. +type HybridConnectionKey struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Kind *string `json:"kind,omitempty"` + Location *string `json:"location,omitempty"` + Type *string `json:"type,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + *HybridConnectionKeyProperties `json:"properties,omitempty"` +} + +// HybridConnectionKeyProperties is hybridConnectionKey resource specific +// properties +type HybridConnectionKeyProperties struct { + SendKeyName *string `json:"sendKeyName,omitempty"` + SendKeyValue *string `json:"sendKeyValue,omitempty"` +} + +// HybridConnectionLimits is hybrid Connection limits contract. This is used to +// return the plan limits of Hybrid Connections. +type HybridConnectionLimits struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Kind *string `json:"kind,omitempty"` + Location *string `json:"location,omitempty"` + Type *string `json:"type,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + *HybridConnectionLimitsProperties `json:"properties,omitempty"` +} + +// HybridConnectionLimitsProperties is hybridConnectionLimits resource specific +// properties +type HybridConnectionLimitsProperties struct { + Current *int32 `json:"current,omitempty"` + Maximum *int32 `json:"maximum,omitempty"` +} + +// Identifier is identifier. +type Identifier struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Kind *string `json:"kind,omitempty"` + Location *string `json:"location,omitempty"` + Type *string `json:"type,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + *IdentifierProperties `json:"properties,omitempty"` +} + +// IdentifierProperties is identifier resource specific properties +type IdentifierProperties struct { + ID *string `json:"id,omitempty"` +} + +// IdentifierCollection is collection of identifiers. +type IdentifierCollection struct { + autorest.Response `json:"-"` + Value *[]Identifier `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// IdentifierCollectionPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client IdentifierCollection) IdentifierCollectionPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// IPSecurityRestriction is iP security restriction on an app. type IPSecurityRestriction struct { IPAddress *string `json:"ipAddress,omitempty"` SubnetMask *string `json:"subnetMask,omitempty"` } -// KeyValuePairStringString is -type KeyValuePairStringString struct { - Key *string `json:"key,omitempty"` - Value *string `json:"value,omitempty"` +// ListCapability is +type ListCapability struct { + autorest.Response `json:"-"` + Value *[]Capability `json:"value,omitempty"` } // ListCertificateEmail is @@ -1645,24 +2121,30 @@ type ListCertificateOrderAction struct { Value *[]CertificateOrderAction `json:"value,omitempty"` } -// ListCsr is -type ListCsr struct { - autorest.Response `json:"-"` - Value *[]Csr `json:"value,omitempty"` -} - // ListHostingEnvironmentDiagnostics is type ListHostingEnvironmentDiagnostics struct { autorest.Response `json:"-"` Value *[]HostingEnvironmentDiagnostics `json:"value,omitempty"` } +// ListOperation is +type ListOperation struct { + autorest.Response `json:"-"` + Value *[]Operation `json:"value,omitempty"` +} + // ListRecommendation is type ListRecommendation struct { autorest.Response `json:"-"` Value *[]Recommendation `json:"value,omitempty"` } +// ListSiteConfigurationSnapshotInfo is +type ListSiteConfigurationSnapshotInfo struct { + autorest.Response `json:"-"` + Value *[]SiteConfigurationSnapshotInfo `json:"value,omitempty"` +} + // ListVnetInfo is type ListVnetInfo struct { autorest.Response `json:"-"` @@ -1675,68 +2157,20 @@ type ListVnetRoute struct { Value *[]VnetRoute `json:"value,omitempty"` } -// LocalizableString is localizableString object containing the name and a +// LocalizableString is localizable string object containing the name and a // localized value. type LocalizableString struct { Value *string `json:"value,omitempty"` LocalizedValue *string `json:"localizedValue,omitempty"` } -// ManagedHostingEnvironment is description of a managed hosting environment -type ManagedHostingEnvironment struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Kind *string `json:"kind,omitempty"` - Location *string `json:"location,omitempty"` - Type *string `json:"type,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - *ManagedHostingEnvironmentProperties `json:"properties,omitempty"` -} - -// ManagedHostingEnvironmentProperties is -type ManagedHostingEnvironmentProperties struct { - Name *string `json:"name,omitempty"` - Location *string `json:"location,omitempty"` - Status ManagedHostingEnvironmentStatus `json:"status,omitempty"` - VirtualNetwork *VirtualNetworkProfile `json:"virtualNetwork,omitempty"` - IpsslAddressCount *int32 `json:"ipsslAddressCount,omitempty"` - DNSSuffix *string `json:"dnsSuffix,omitempty"` - SubscriptionID *string `json:"subscriptionId,omitempty"` - ResourceGroup *string `json:"resourceGroup,omitempty"` - EnvironmentIsHealthy *bool `json:"environmentIsHealthy,omitempty"` - EnvironmentStatus *string `json:"environmentStatus,omitempty"` - Suspended *bool `json:"suspended,omitempty"` - APIManagementAccount *string `json:"apiManagementAccount,omitempty"` -} - -// ManagedHostingEnvironmentCollection is collection of managed hosting -// environments -type ManagedHostingEnvironmentCollection struct { - autorest.Response `json:"-"` - Value *[]ManagedHostingEnvironment `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// ManagedHostingEnvironmentCollectionPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client ManagedHostingEnvironmentCollection) ManagedHostingEnvironmentCollectionPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// MetricAvailabilily is class repesenting metrics availability and retention +// MetricAvailabilily is metric availability and retention. type MetricAvailabilily struct { TimeGrain *string `json:"timeGrain,omitempty"` Retention *string `json:"retention,omitempty"` } -// MetricDefinition is class repesenting metadata for the metrics +// MetricDefinition is metadata for a metric. type MetricDefinition struct { autorest.Response `json:"-"` ID *string `json:"id,omitempty"` @@ -1748,7 +2182,7 @@ type MetricDefinition struct { *MetricDefinitionProperties `json:"properties,omitempty"` } -// MetricDefinitionProperties is +// MetricDefinitionProperties is metricDefinition resource specific properties type MetricDefinitionProperties struct { Name *string `json:"name,omitempty"` Unit *string `json:"unit,omitempty"` @@ -1757,31 +2191,49 @@ type MetricDefinitionProperties struct { DisplayName *string `json:"displayName,omitempty"` } -// MetricDefinitionCollection is collection of metric defintions -type MetricDefinitionCollection struct { - autorest.Response `json:"-"` - Value *[]MetricDefinition `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` +// MigrateMySQLRequest is mySQL migration request. +type MigrateMySQLRequest struct { + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Kind *string `json:"kind,omitempty"` + Location *string `json:"location,omitempty"` + Type *string `json:"type,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + *MigrateMySQLRequestProperties `json:"properties,omitempty"` } -// MetricDefinitionCollectionPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client MetricDefinitionCollection) MetricDefinitionCollectionPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) +// MigrateMySQLRequestProperties is migrateMySqlRequest resource specific +// properties +type MigrateMySQLRequestProperties struct { + ConnectionString *string `json:"connectionString,omitempty"` } -// NameIdentifier is identifies an object +// MigrateMySQLStatus is mySQL migration status. +type MigrateMySQLStatus struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Kind *string `json:"kind,omitempty"` + Location *string `json:"location,omitempty"` + Type *string `json:"type,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + *MigrateMySQLStatusProperties `json:"properties,omitempty"` +} + +// MigrateMySQLStatusProperties is migrateMySqlStatus resource specific +// properties +type MigrateMySQLStatusProperties struct { + MigrationOperationStatus OperationStatus `json:"migrationOperationStatus,omitempty"` + OperationID *string `json:"operationId,omitempty"` + LocalMySQLEnabled *bool `json:"localMySqlEnabled,omitempty"` +} + +// NameIdentifier is identifies an object. type NameIdentifier struct { Name *string `json:"name,omitempty"` } -// NameIdentifierCollection is collection of domain name identifiers +// NameIdentifierCollection is collection of domain name identifiers. type NameIdentifierCollection struct { autorest.Response `json:"-"` Value *[]NameIdentifier `json:"value,omitempty"` @@ -1800,13 +2252,13 @@ func (client NameIdentifierCollection) NameIdentifierCollectionPreparer() (*http autorest.WithBaseURL(to.String(client.NextLink))) } -// NameValuePair is name value pair +// NameValuePair is name value pair. type NameValuePair struct { Name *string `json:"name,omitempty"` Value *string `json:"value,omitempty"` } -// NetworkAccessControlEntry is +// NetworkAccessControlEntry is network access control entry. type NetworkAccessControlEntry struct { Action AccessControlEntryAction `json:"action,omitempty"` Description *string `json:"description,omitempty"` @@ -1814,9 +2266,8 @@ type NetworkAccessControlEntry struct { RemoteSubnet *string `json:"remoteSubnet,omitempty"` } -// NetworkFeatures is this is an object used to store a full view of network -// features (presently VNET integration and Hybrid Connections) -// for a web app. +// NetworkFeatures is full view of network features for an app (presently VNET +// integration and Hybrid Connections). type NetworkFeatures struct { autorest.Response `json:"-"` ID *string `json:"id,omitempty"` @@ -1828,25 +2279,151 @@ type NetworkFeatures struct { *NetworkFeaturesProperties `json:"properties,omitempty"` } -// NetworkFeaturesProperties is +// NetworkFeaturesProperties is networkFeatures resource specific properties type NetworkFeaturesProperties struct { VirtualNetworkName *string `json:"virtualNetworkName,omitempty"` VirtualNetworkConnection *VnetInfo `json:"virtualNetworkConnection,omitempty"` HybridConnections *[]RelayServiceConnectionEntity `json:"hybridConnections,omitempty"` + HybridConnectionsV2 *[]HybridConnection `json:"hybridConnectionsV2,omitempty"` +} + +// Operation is operation. +type Operation struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Status OperationStatus `json:"status,omitempty"` + Errors *[]ErrorEntity `json:"errors,omitempty"` + CreatedTime *date.Time `json:"createdTime,omitempty"` + ModifiedTime *date.Time `json:"modifiedTime,omitempty"` + ExpirationTime *date.Time `json:"expirationTime,omitempty"` + GeoMasterOperationID *string `json:"geoMasterOperationId,omitempty"` +} + +// PerfMonCounterCollection is collection of performance monitor counters. +type PerfMonCounterCollection struct { + autorest.Response `json:"-"` + Value *[]PerfMonResponse `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` } -// PremierAddOnRequest is -type PremierAddOnRequest struct { - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - Plan *ArmPlan `json:"plan,omitempty"` - Properties *map[string]interface{} `json:"properties,omitempty"` - Sku *SkuDescription `json:"sku,omitempty"` +// PerfMonCounterCollectionPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client PerfMonCounterCollection) PerfMonCounterCollectionPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// PerfMonResponse is performance monitor API response. +type PerfMonResponse struct { + Code *string `json:"code,omitempty"` + Message *string `json:"message,omitempty"` + Data *PerfMonSet `json:"data,omitempty"` +} + +// PerfMonSample is performance monitor sample in a set. +type PerfMonSample struct { + Time *date.Time `json:"time,omitempty"` + InstanceName *string `json:"instanceName,omitempty"` + Value *float64 `json:"value,omitempty"` +} + +// PerfMonSet is metric information. +type PerfMonSet struct { + Name *string `json:"name,omitempty"` + StartTime *date.Time `json:"startTime,omitempty"` + EndTime *date.Time `json:"endTime,omitempty"` + TimeGrain *string `json:"timeGrain,omitempty"` + Values *[]PerfMonSample `json:"values,omitempty"` +} + +// PremierAddOn is premier add-on. +type PremierAddOn struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Kind *string `json:"kind,omitempty"` + Location *string `json:"location,omitempty"` + Type *string `json:"type,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + *PremierAddOnProperties `json:"properties,omitempty"` +} + +// PremierAddOnProperties is premierAddOn resource specific properties +type PremierAddOnProperties struct { + Sku *string `json:"sku,omitempty"` + Product *string `json:"product,omitempty"` + Vendor *string `json:"vendor,omitempty"` + PremierAddOnName *string `json:"name,omitempty"` + Location *string `json:"location,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + MarketplacePublisher *string `json:"marketplacePublisher,omitempty"` + MarketplaceOffer *string `json:"marketplaceOffer,omitempty"` +} + +// PremierAddOnOffer is premier add-on offer. +type PremierAddOnOffer struct { + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Kind *string `json:"kind,omitempty"` + Location *string `json:"location,omitempty"` + Type *string `json:"type,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + *PremierAddOnOfferProperties `json:"properties,omitempty"` +} + +// PremierAddOnOfferProperties is premierAddOnOffer resource specific +// properties +type PremierAddOnOfferProperties struct { + Sku *string `json:"sku,omitempty"` + Product *string `json:"product,omitempty"` + Vendor *string `json:"vendor,omitempty"` + Name *string `json:"name,omitempty"` + PromoCodeRequired *bool `json:"promoCodeRequired,omitempty"` + Quota *int32 `json:"quota,omitempty"` + WebHostingPlanRestrictions AppServicePlanRestrictions `json:"webHostingPlanRestrictions,omitempty"` + PrivacyPolicyURL *string `json:"privacyPolicyUrl,omitempty"` + LegalTermsURL *string `json:"legalTermsUrl,omitempty"` + MarketplacePublisher *string `json:"marketplacePublisher,omitempty"` + MarketplaceOffer *string `json:"marketplaceOffer,omitempty"` +} + +// PremierAddOnOfferCollection is collection of premier add-on offers. +type PremierAddOnOfferCollection struct { + autorest.Response `json:"-"` + Value *[]PremierAddOnOffer `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// PremierAddOnOfferCollectionPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client PremierAddOnOfferCollection) PremierAddOnOfferCollectionPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// PushSettings is push settings for the App. +type PushSettings struct { + autorest.Response `json:"-"` + IsPushEnabled *bool `json:"isPushEnabled,omitempty"` + TagWhitelistJSON *string `json:"tagWhitelistJson,omitempty"` + TagsRequiringAuth *string `json:"tagsRequiringAuth,omitempty"` + DynamicTagsJSON *string `json:"dynamicTagsJson,omitempty"` } // RampUpRule is routing rules for ramp up testing. This rule allows to // redirect static traffic % to a slot or to gradually change routing % based -// on performance +// on performance. type RampUpRule struct { ActionHostName *string `json:"actionHostName,omitempty"` ReroutePercentage *float64 `json:"reroutePercentage,omitempty"` @@ -1865,12 +2442,12 @@ type ReadCloser struct { } // Recommendation is represents a recommendation result generated by the -// recommendation engine +// recommendation engine. type Recommendation struct { CreationTime *date.Time `json:"creationTime,omitempty"` RecommendationID *string `json:"recommendationId,omitempty"` ResourceID *string `json:"resourceId,omitempty"` - ResourceScope *string `json:"resourceScope,omitempty"` + ResourceScope ResourceScopeType `json:"resourceScope,omitempty"` RuleName *string `json:"ruleName,omitempty"` DisplayName *string `json:"displayName,omitempty"` Message *string `json:"message,omitempty"` @@ -1878,7 +2455,6 @@ type Recommendation struct { Channels Channels `json:"channels,omitempty"` Tags *[]string `json:"tags,omitempty"` ActionName *string `json:"actionName,omitempty"` - Enabled *int32 `json:"enabled,omitempty"` StartTime *date.Time `json:"startTime,omitempty"` EndTime *date.Time `json:"endTime,omitempty"` NextNotificationTime *date.Time `json:"nextNotificationTime,omitempty"` @@ -1888,23 +2464,39 @@ type Recommendation struct { } // RecommendationRule is represents a recommendation rule that the -// recommendation engine can perform +// recommendation engine can perform. type RecommendationRule struct { autorest.Response `json:"-"` Name *string `json:"name,omitempty"` DisplayName *string `json:"displayName,omitempty"` Message *string `json:"message,omitempty"` - RecommendationID *string `json:"recommendationId,omitempty"` + RecommendationID *uuid.UUID `json:"recommendationId,omitempty"` Description *string `json:"description,omitempty"` ActionName *string `json:"actionName,omitempty"` - Enabled *int32 `json:"enabled,omitempty"` Level NotificationLevel `json:"level,omitempty"` Channels Channels `json:"channels,omitempty"` Tags *[]string `json:"tags,omitempty"` } +// RecoverResponse is response for an app recovery request. +type RecoverResponse struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Kind *string `json:"kind,omitempty"` + Location *string `json:"location,omitempty"` + Type *string `json:"type,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + *RecoverResponseProperties `json:"properties,omitempty"` +} + +// RecoverResponseProperties is recoverResponse resource specific properties +type RecoverResponseProperties struct { + OperationID *string `json:"operationId,omitempty"` +} + // ReissueCertificateOrderRequest is class representing certificate reissue -// request +// request. type ReissueCertificateOrderRequest struct { ID *string `json:"id,omitempty"` Name *string `json:"name,omitempty"` @@ -1915,14 +2507,16 @@ type ReissueCertificateOrderRequest struct { *ReissueCertificateOrderRequestProperties `json:"properties,omitempty"` } -// ReissueCertificateOrderRequestProperties is +// ReissueCertificateOrderRequestProperties is reissueCertificateOrderRequest +// resource specific properties type ReissueCertificateOrderRequestProperties struct { - KeySize *int32 `json:"keySize,omitempty"` - DelayExistingRevokeInHours *int32 `json:"delayExistingRevokeInHours,omitempty"` + KeySize *int32 `json:"keySize,omitempty"` + DelayExistingRevokeInHours *int32 `json:"delayExistingRevokeInHours,omitempty"` + Csr *string `json:"csr,omitempty"` + IsPrivateKeyExternal *bool `json:"isPrivateKeyExternal,omitempty"` } -// RelayServiceConnectionEntity is class that represents a Biztalk Hybrid -// Connection +// RelayServiceConnectionEntity is hybrid Connection for an App Service app. type RelayServiceConnectionEntity struct { autorest.Response `json:"-"` ID *string `json:"id,omitempty"` @@ -1934,7 +2528,8 @@ type RelayServiceConnectionEntity struct { *RelayServiceConnectionEntityProperties `json:"properties,omitempty"` } -// RelayServiceConnectionEntityProperties is +// RelayServiceConnectionEntityProperties is relayServiceConnectionEntity +// resource specific properties type RelayServiceConnectionEntityProperties struct { EntityName *string `json:"entityName,omitempty"` EntityConnectionString *string `json:"entityConnectionString,omitempty"` @@ -1945,7 +2540,8 @@ type RelayServiceConnectionEntityProperties struct { BiztalkURI *string `json:"biztalkUri,omitempty"` } -// RenewCertificateOrderRequest is class representing certificate renew request +// RenewCertificateOrderRequest is class representing certificate renew +// request. type RenewCertificateOrderRequest struct { ID *string `json:"id,omitempty"` Name *string `json:"name,omitempty"` @@ -1956,18 +2552,21 @@ type RenewCertificateOrderRequest struct { *RenewCertificateOrderRequestProperties `json:"properties,omitempty"` } -// RenewCertificateOrderRequestProperties is +// RenewCertificateOrderRequestProperties is renewCertificateOrderRequest +// resource specific properties type RenewCertificateOrderRequestProperties struct { - KeySize *int32 `json:"keySize,omitempty"` + KeySize *int32 `json:"keySize,omitempty"` + Csr *string `json:"csr,omitempty"` + IsPrivateKeyExternal *bool `json:"isPrivateKeyExternal,omitempty"` } -// RequestsBasedTrigger is requestsBasedTrigger +// RequestsBasedTrigger is trigger based on total requests. type RequestsBasedTrigger struct { Count *int32 `json:"count,omitempty"` TimeInterval *string `json:"timeInterval,omitempty"` } -// Resource is +// Resource is azure resource. type Resource struct { ID *string `json:"id,omitempty"` Name *string `json:"name,omitempty"` @@ -1977,19 +2576,45 @@ type Resource struct { Tags *map[string]*string `json:"tags,omitempty"` } -// ResourceMetric is object representing a metric for any resource +// ResourceCollection is collection of resources. +type ResourceCollection struct { + autorest.Response `json:"-"` + Value *[]string `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// ResourceCollectionPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client ResourceCollection) ResourceCollectionPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// ResourceMetric is object representing a metric for any resource . type ResourceMetric struct { - Name *ResourceMetricName `json:"name,omitempty"` - Unit *string `json:"unit,omitempty"` - TimeGrain *string `json:"timeGrain,omitempty"` - StartTime *date.Time `json:"startTime,omitempty"` - EndTime *date.Time `json:"endTime,omitempty"` - ResourceID *string `json:"resourceId,omitempty"` - MetricValues *[]ResourceMetricValue `json:"metricValues,omitempty"` - Properties *[]KeyValuePairStringString `json:"properties,omitempty"` + Name *ResourceMetricName `json:"name,omitempty"` + Unit *string `json:"unit,omitempty"` + TimeGrain *string `json:"timeGrain,omitempty"` + StartTime *date.Time `json:"startTime,omitempty"` + EndTime *date.Time `json:"endTime,omitempty"` + ResourceID *string `json:"resourceId,omitempty"` + ID *string `json:"id,omitempty"` + MetricValues *[]ResourceMetricValue `json:"metricValues,omitempty"` + Properties *[]ResourceMetricProperty `json:"properties,omitempty"` +} + +// ResourceMetricAvailability is metrics availability and retention. +type ResourceMetricAvailability struct { + TimeGrain *string `json:"timeGrain,omitempty"` + Retention *string `json:"retention,omitempty"` } -// ResourceMetricCollection is collection of metric responses +// ResourceMetricCollection is collection of metric responses. type ResourceMetricCollection struct { autorest.Response `json:"-"` Value *[]ResourceMetric `json:"value,omitempty"` @@ -2008,39 +2633,89 @@ func (client ResourceMetricCollection) ResourceMetricCollectionPreparer() (*http autorest.WithBaseURL(to.String(client.NextLink))) } -// ResourceMetricName is name of a metric for any resource +// ResourceMetricDefinition is metadata for the metrics. +type ResourceMetricDefinition struct { + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Kind *string `json:"kind,omitempty"` + Location *string `json:"location,omitempty"` + Type *string `json:"type,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + *ResourceMetricDefinitionProperties `json:"properties,omitempty"` +} + +// ResourceMetricDefinitionProperties is resourceMetricDefinition resource +// specific properties +type ResourceMetricDefinitionProperties struct { + Name *ResourceMetricName `json:"name,omitempty"` + Unit *string `json:"unit,omitempty"` + PrimaryAggregationType *string `json:"primaryAggregationType,omitempty"` + MetricAvailabilities *[]ResourceMetricAvailability `json:"metricAvailabilities,omitempty"` + ResourceURI *string `json:"resourceUri,omitempty"` + ID *string `json:"id,omitempty"` + Properties *map[string]*string `json:"properties,omitempty"` +} + +// ResourceMetricDefinitionCollection is collection of metric definitions. +type ResourceMetricDefinitionCollection struct { + autorest.Response `json:"-"` + Value *[]ResourceMetricDefinition `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// ResourceMetricDefinitionCollectionPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client ResourceMetricDefinitionCollection) ResourceMetricDefinitionCollectionPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// ResourceMetricName is name of a metric for any resource . type ResourceMetricName struct { Value *string `json:"value,omitempty"` LocalizedValue *string `json:"localizedValue,omitempty"` } -// ResourceMetricValue is value of resource metric +// ResourceMetricProperty is resource metric property. +type ResourceMetricProperty struct { + Key *string `json:"key,omitempty"` + Value *string `json:"value,omitempty"` +} + +// ResourceMetricValue is value of resource metric. type ResourceMetricValue struct { - TimeStamp *string `json:"timeStamp,omitempty"` - Average *float64 `json:"average,omitempty"` - Minimum *float64 `json:"minimum,omitempty"` - Maximum *float64 `json:"maximum,omitempty"` - Total *float64 `json:"total,omitempty"` - Count *float64 `json:"count,omitempty"` + Timestamp *string `json:"timestamp,omitempty"` + Average *float64 `json:"average,omitempty"` + Minimum *float64 `json:"minimum,omitempty"` + Maximum *float64 `json:"maximum,omitempty"` + Total *float64 `json:"total,omitempty"` + Count *float64 `json:"count,omitempty"` + Properties *[]ResourceMetricProperty `json:"properties,omitempty"` } -// ResourceNameAvailability is describes if a resource name is available +// ResourceNameAvailability is information regarding availbility of a resource +// name. type ResourceNameAvailability struct { autorest.Response `json:"-"` - NameAvailable *bool `json:"nameAvailable,omitempty"` - Reason *string `json:"reason,omitempty"` - Message *string `json:"message,omitempty"` + NameAvailable *bool `json:"nameAvailable,omitempty"` + Reason InAvailabilityReasonType `json:"reason,omitempty"` + Message *string `json:"message,omitempty"` } // ResourceNameAvailabilityRequest is resource name availability request -// content +// content. type ResourceNameAvailabilityRequest struct { - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - IsFqdn *bool `json:"isFqdn,omitempty"` + Name *string `json:"name,omitempty"` + Type CheckNameResourceTypes `json:"type,omitempty"` + IsFqdn *bool `json:"isFqdn,omitempty"` } -// RestoreRequest is description of a restore request +// RestoreRequest is description of a restore request. type RestoreRequest struct { autorest.Response `json:"-"` ID *string `json:"id,omitempty"` @@ -2052,7 +2727,7 @@ type RestoreRequest struct { *RestoreRequestProperties `json:"properties,omitempty"` } -// RestoreRequestProperties is +// RestoreRequestProperties is restoreRequest resource specific properties type RestoreRequestProperties struct { StorageAccountURL *string `json:"storageAccountUrl,omitempty"` BlobName *string `json:"blobName,omitempty"` @@ -2065,7 +2740,7 @@ type RestoreRequestProperties struct { HostingEnvironment *string `json:"hostingEnvironment,omitempty"` } -// RestoreResponse is response for a restore site request +// RestoreResponse is response for an app restore request. type RestoreResponse struct { autorest.Response `json:"-"` ID *string `json:"id,omitempty"` @@ -2077,71 +2752,12 @@ type RestoreResponse struct { *RestoreResponseProperties `json:"properties,omitempty"` } -// RestoreResponseProperties is +// RestoreResponseProperties is restoreResponse resource specific properties type RestoreResponseProperties struct { OperationID *string `json:"operationId,omitempty"` } -// RoutingRule is routing rules for TiP -type RoutingRule struct { - Name *string `json:"name,omitempty"` -} - -// ServerFarmCollection is collection of serverfarms -type ServerFarmCollection struct { - autorest.Response `json:"-"` - Value *[]ServerFarmWithRichSku `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// ServerFarmCollectionPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client ServerFarmCollection) ServerFarmCollectionPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// ServerFarmWithRichSku is app Service Plan Model -type ServerFarmWithRichSku struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Kind *string `json:"kind,omitempty"` - Location *string `json:"location,omitempty"` - Type *string `json:"type,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - *ServerFarmWithRichSkuProperties `json:"properties,omitempty"` - Sku *SkuDescription `json:"sku,omitempty"` -} - -// ServerFarmWithRichSkuProperties is -type ServerFarmWithRichSkuProperties struct { - Name *string `json:"name,omitempty"` - WorkerTierName *string `json:"workerTierName,omitempty"` - Status StatusOptions `json:"status,omitempty"` - Subscription *string `json:"subscription,omitempty"` - AdminSiteName *string `json:"adminSiteName,omitempty"` - HostingEnvironmentProfile *HostingEnvironmentProfile `json:"hostingEnvironmentProfile,omitempty"` - MaximumNumberOfWorkers *int32 `json:"maximumNumberOfWorkers,omitempty"` - GeoRegion *string `json:"geoRegion,omitempty"` - PerSiteScaling *bool `json:"perSiteScaling,omitempty"` - NumberOfSites *int32 `json:"numberOfSites,omitempty"` - ResourceGroup *string `json:"resourceGroup,omitempty"` - Reserved *bool `json:"reserved,omitempty"` -} - -// SetObject is -type SetObject struct { - autorest.Response `json:"-"` - Value *map[string]interface{} `json:"value,omitempty"` -} - -// Site is represents a web app +// Site is a web app, a mobile app backend, or an API app. type Site struct { autorest.Response `json:"-"` ID *string `json:"id,omitempty"` @@ -2153,9 +2769,8 @@ type Site struct { *SiteProperties `json:"properties,omitempty"` } -// SiteProperties is +// SiteProperties is site resource specific properties type SiteProperties struct { - Name *string `json:"name,omitempty"` State *string `json:"state,omitempty"` HostNames *[]string `json:"hostNames,omitempty"` RepositorySiteName *string `json:"repositorySiteName,omitempty"` @@ -2165,6 +2780,7 @@ type SiteProperties struct { AvailabilityState SiteAvailabilityState `json:"availabilityState,omitempty"` HostNameSslStates *[]HostNameSslState `json:"hostNameSslStates,omitempty"` ServerFarmID *string `json:"serverFarmId,omitempty"` + Reserved *bool `json:"reserved,omitempty"` LastModifiedTimeUtc *date.Time `json:"lastModifiedTimeUtc,omitempty"` SiteConfig *SiteConfig `json:"siteConfig,omitempty"` TrafficManagerHostNames *[]string `json:"trafficManagerHostNames,omitempty"` @@ -2179,19 +2795,33 @@ type SiteProperties struct { HostNamesDisabled *bool `json:"hostNamesDisabled,omitempty"` OutboundIPAddresses *string `json:"outboundIpAddresses,omitempty"` ContainerSize *int32 `json:"containerSize,omitempty"` + DailyMemoryTimeQuota *int32 `json:"dailyMemoryTimeQuota,omitempty"` + SuspendedTill *date.Time `json:"suspendedTill,omitempty"` MaxNumberOfWorkers *int32 `json:"maxNumberOfWorkers,omitempty"` CloningInfo *CloningInfo `json:"cloningInfo,omitempty"` ResourceGroup *string `json:"resourceGroup,omitempty"` IsDefaultContainer *bool `json:"isDefaultContainer,omitempty"` DefaultHostName *string `json:"defaultHostName,omitempty"` + SlotSwapStatus *SlotSwapStatus `json:"slotSwapStatus,omitempty"` } // SiteAuthSettings is configuration settings for the Azure App Service // Authentication / Authorization feature. type SiteAuthSettings struct { - autorest.Response `json:"-"` + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Kind *string `json:"kind,omitempty"` + Location *string `json:"location,omitempty"` + Type *string `json:"type,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + *SiteAuthSettingsProperties `json:"properties,omitempty"` +} + +// SiteAuthSettingsProperties is siteAuthSettings resource specific properties +type SiteAuthSettingsProperties struct { Enabled *bool `json:"enabled,omitempty"` - HTTPAPIPrefixPath *string `json:"httpApiPrefixPath,omitempty"` + RuntimeVersion *string `json:"runtimeVersion,omitempty"` UnauthenticatedClientAction UnauthenticatedClientAction `json:"unauthenticatedClientAction,omitempty"` TokenStoreEnabled *bool `json:"tokenStoreEnabled,omitempty"` AllowedExternalRedirectUrls *[]string `json:"allowedExternalRedirectUrls,omitempty"` @@ -2202,8 +2832,6 @@ type SiteAuthSettings struct { Issuer *string `json:"issuer,omitempty"` AllowedAudiences *[]string `json:"allowedAudiences,omitempty"` AdditionalLoginParams *[]string `json:"additionalLoginParams,omitempty"` - AadClientID *string `json:"aadClientId,omitempty"` - OpenIDIssuer *string `json:"openIdIssuer,omitempty"` GoogleClientID *string `json:"googleClientId,omitempty"` GoogleClientSecret *string `json:"googleClientSecret,omitempty"` GoogleOAuthScopes *[]string `json:"googleOAuthScopes,omitempty"` @@ -2217,7 +2845,7 @@ type SiteAuthSettings struct { MicrosoftAccountOAuthScopes *[]string `json:"microsoftAccountOAuthScopes,omitempty"` } -// SiteCloneability is represents whether or not a web app is cloneable +// SiteCloneability is represents whether or not an app is cloneable. type SiteCloneability struct { autorest.Response `json:"-"` Result CloneAbilityResult `json:"result,omitempty"` @@ -2226,51 +2854,21 @@ type SiteCloneability struct { BlockingCharacteristics *[]SiteCloneabilityCriterion `json:"blockingCharacteristics,omitempty"` } -// SiteCloneabilityCriterion is represents a site cloneability criterion +// SiteCloneabilityCriterion is an app cloneability criterion. type SiteCloneabilityCriterion struct { Name *string `json:"name,omitempty"` Description *string `json:"description,omitempty"` } -// SiteCollection is collection of sites -type SiteCollection struct { - autorest.Response `json:"-"` - Value *[]Site `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// SiteCollectionPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client SiteCollection) SiteCollectionPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// SiteConfig is configuration of Azure web site +// SiteConfig is configuration of an App Service app. type SiteConfig struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Kind *string `json:"kind,omitempty"` - Location *string `json:"location,omitempty"` - Type *string `json:"type,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - *SiteConfigProperties `json:"properties,omitempty"` -} - -// SiteConfigProperties is -type SiteConfigProperties struct { NumberOfWorkers *int32 `json:"numberOfWorkers,omitempty"` DefaultDocuments *[]string `json:"defaultDocuments,omitempty"` NetFrameworkVersion *string `json:"netFrameworkVersion,omitempty"` PhpVersion *string `json:"phpVersion,omitempty"` PythonVersion *string `json:"pythonVersion,omitempty"` NodeVersion *string `json:"nodeVersion,omitempty"` + LinuxFxVersion *string `json:"linuxFxVersion,omitempty"` RequestTracingEnabled *bool `json:"requestTracingEnabled,omitempty"` RequestTracingExpirationTime *date.Time `json:"requestTracingExpirationTime,omitempty"` RemoteDebuggingEnabled *bool `json:"remoteDebuggingEnabled,omitempty"` @@ -2279,13 +2877,12 @@ type SiteConfigProperties struct { LogsDirectorySizeLimit *int32 `json:"logsDirectorySizeLimit,omitempty"` DetailedErrorLoggingEnabled *bool `json:"detailedErrorLoggingEnabled,omitempty"` PublishingUsername *string `json:"publishingUsername,omitempty"` - PublishingPassword *string `json:"publishingPassword,omitempty"` AppSettings *[]NameValuePair `json:"appSettings,omitempty"` - Metadata *[]NameValuePair `json:"metadata,omitempty"` ConnectionStrings *[]ConnStringInfo `json:"connectionStrings,omitempty"` + MachineKey *SiteMachineKey `json:"machineKey,omitempty"` HandlerMappings *[]HandlerMapping `json:"handlerMappings,omitempty"` DocumentRoot *string `json:"documentRoot,omitempty"` - ScmType *string `json:"scmType,omitempty"` + ScmType ScmType `json:"scmType,omitempty"` Use32BitWorkerProcess *bool `json:"use32BitWorkerProcess,omitempty"` WebSocketsEnabled *bool `json:"webSocketsEnabled,omitempty"` AlwaysOn *bool `json:"alwaysOn,omitempty"` @@ -2303,13 +2900,44 @@ type SiteConfigProperties struct { TracingOptions *string `json:"tracingOptions,omitempty"` VnetName *string `json:"vnetName,omitempty"` Cors *CorsSettings `json:"cors,omitempty"` + Push *PushSettings `json:"push,omitempty"` APIDefinition *APIDefinitionInfo `json:"apiDefinition,omitempty"` AutoSwapSlotName *string `json:"autoSwapSlotName,omitempty"` LocalMySQLEnabled *bool `json:"localMySqlEnabled,omitempty"` IPSecurityRestrictions *[]IPSecurityRestriction `json:"ipSecurityRestrictions,omitempty"` } -// SiteInstance is instance of a web app +// SiteConfigResource is web app configuration ARM resource. +type SiteConfigResource struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Kind *string `json:"kind,omitempty"` + Location *string `json:"location,omitempty"` + Type *string `json:"type,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + *SiteConfig `json:"properties,omitempty"` +} + +// SiteConfigurationSnapshotInfo is a snapshot of a web app configuration. +type SiteConfigurationSnapshotInfo struct { + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Kind *string `json:"kind,omitempty"` + Location *string `json:"location,omitempty"` + Type *string `json:"type,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + *SiteConfigurationSnapshotInfoProperties `json:"properties,omitempty"` +} + +// SiteConfigurationSnapshotInfoProperties is siteConfigurationSnapshotInfo +// resource specific properties +type SiteConfigurationSnapshotInfoProperties struct { + Time *date.Time `json:"time,omitempty"` + ID *int32 `json:"id,omitempty"` +} + +// SiteInstance is instance of an app. type SiteInstance struct { ID *string `json:"id,omitempty"` Name *string `json:"name,omitempty"` @@ -2320,38 +2948,19 @@ type SiteInstance struct { *SiteInstanceProperties `json:"properties,omitempty"` } -// SiteInstanceProperties is +// SiteInstanceProperties is siteInstance resource specific properties type SiteInstanceProperties struct { Name *string `json:"name,omitempty"` } -// SiteInstanceCollection is collection of site instances -type SiteInstanceCollection struct { - autorest.Response `json:"-"` - Value *[]SiteInstance `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// SiteInstanceCollectionPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client SiteInstanceCollection) SiteInstanceCollectionPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// SiteLimits is represents metric limits set on a web app. +// SiteLimits is metric limits set on an app. type SiteLimits struct { MaxPercentageCPU *float64 `json:"maxPercentageCpu,omitempty"` MaxMemoryInMb *int64 `json:"maxMemoryInMb,omitempty"` MaxDiskSizeInMb *int64 `json:"maxDiskSizeInMb,omitempty"` } -// SiteLogsConfig is configuration of Azure web site +// SiteLogsConfig is configuration of App Service site logs. type SiteLogsConfig struct { autorest.Response `json:"-"` ID *string `json:"id,omitempty"` @@ -2363,7 +2972,7 @@ type SiteLogsConfig struct { *SiteLogsConfigProperties `json:"properties,omitempty"` } -// SiteLogsConfigProperties is +// SiteLogsConfigProperties is siteLogsConfig resource specific properties type SiteLogsConfigProperties struct { ApplicationLogs *ApplicationLogsConfig `json:"applicationLogs,omitempty"` HTTPLogs *HTTPLogsConfig `json:"httpLogs,omitempty"` @@ -2371,14 +2980,48 @@ type SiteLogsConfigProperties struct { DetailedErrorMessages *EnabledConfig `json:"detailedErrorMessages,omitempty"` } -// SitePropertiesModel is -type SitePropertiesModel struct { - Metadata *[]NameValuePair `json:"metadata,omitempty"` - Properties *[]NameValuePair `json:"properties,omitempty"` - AppSettings *[]NameValuePair `json:"appSettings,omitempty"` +// SiteMachineKey is machineKey of an app. +type SiteMachineKey struct { + Validation *string `json:"validation,omitempty"` + ValidationKey *string `json:"validationKey,omitempty"` + Decryption *string `json:"decryption,omitempty"` + DecryptionKey *string `json:"decryptionKey,omitempty"` +} + +// SitePhpErrorLogFlag is used for getting PHP error logging flag. +type SitePhpErrorLogFlag struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Kind *string `json:"kind,omitempty"` + Location *string `json:"location,omitempty"` + Type *string `json:"type,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + *SitePhpErrorLogFlagProperties `json:"properties,omitempty"` +} + +// SitePhpErrorLogFlagProperties is sitePhpErrorLogFlag resource specific +// properties +type SitePhpErrorLogFlagProperties struct { + LocalLogErrors *string `json:"localLogErrors,omitempty"` + MasterLogErrors *string `json:"masterLogErrors,omitempty"` + LocalLogErrorsMaxLength *string `json:"localLogErrorsMaxLength,omitempty"` + MasterLogErrorsMaxLength *string `json:"masterLogErrorsMaxLength,omitempty"` +} + +// SiteSeal is site seal +type SiteSeal struct { + autorest.Response `json:"-"` + *string `json:"html,omitempty"` +} + +// SiteSealRequest is site seal request. +type SiteSealRequest struct { + LightTheme *bool `json:"lightTheme,omitempty"` + Locale *string `json:"locale,omitempty"` } -// SiteSourceControl is describes the source control configuration for web app +// SiteSourceControl is source control configuration for an app. type SiteSourceControl struct { autorest.Response `json:"-"` ID *string `json:"id,omitempty"` @@ -2390,7 +3033,8 @@ type SiteSourceControl struct { *SiteSourceControlProperties `json:"properties,omitempty"` } -// SiteSourceControlProperties is +// SiteSourceControlProperties is siteSourceControl resource specific +// properties type SiteSourceControlProperties struct { RepoURL *string `json:"repoUrl,omitempty"` Branch *string `json:"branch,omitempty"` @@ -2399,7 +3043,7 @@ type SiteSourceControlProperties struct { IsMercurial *bool `json:"isMercurial,omitempty"` } -// SkuCapacity is description of the App Service Plan scale options +// SkuCapacity is description of the App Service plan scale options. type SkuCapacity struct { Minimum *int32 `json:"minimum,omitempty"` Maximum *int32 `json:"maximum,omitempty"` @@ -2407,23 +3051,26 @@ type SkuCapacity struct { ScaleType *string `json:"scaleType,omitempty"` } -// SkuDescription is describes a sku for a scalable resource +// SkuDescription is description of a SKU for a scalable resource. type SkuDescription struct { - Name *string `json:"name,omitempty"` - Tier *string `json:"tier,omitempty"` - Size *string `json:"size,omitempty"` - Family *string `json:"family,omitempty"` - Capacity *int32 `json:"capacity,omitempty"` + Name *string `json:"name,omitempty"` + Tier *string `json:"tier,omitempty"` + Size *string `json:"size,omitempty"` + Family *string `json:"family,omitempty"` + Capacity *int32 `json:"capacity,omitempty"` + SkuCapacity *SkuCapacity `json:"skuCapacity,omitempty"` + Locations *[]string `json:"locations,omitempty"` + Capabilities *[]Capability `json:"capabilities,omitempty"` } -// SkuInfo is sku discovery information +// SkuInfo is sKU discovery information. type SkuInfo struct { ResourceType *string `json:"resourceType,omitempty"` Sku *SkuDescription `json:"sku,omitempty"` Capacity *SkuCapacity `json:"capacity,omitempty"` } -// SkuInfoCollection is collection of SkuInfos +// SkuInfoCollection is collection of SKU information. type SkuInfoCollection struct { autorest.Response `json:"-"` Value *[]SkuInfo `json:"value,omitempty"` @@ -2442,35 +3089,36 @@ func (client SkuInfoCollection) SkuInfoCollectionPreparer() (*http.Request, erro autorest.WithBaseURL(to.String(client.NextLink))) } -// SlotConfigNames is class containing names for connection strings and -// application settings to be marked as sticky to the slot -// and not moved during swap operation -// This is valid for all deployment slots under the site +// SkuInfos is collection of SKU information. +type SkuInfos struct { + autorest.Response `json:"-"` + ResourceType *string `json:"resourceType,omitempty"` + Skus *[]GlobalCsmSkuDescription `json:"skus,omitempty"` +} + +// SlotConfigNames is names for connection strings and application settings to +// be marked as sticky to the deployment slot and not moved during a swap +// operation. +// This is valid for all deployment slots in an app. type SlotConfigNames struct { ConnectionStringNames *[]string `json:"connectionStringNames,omitempty"` AppSettingNames *[]string `json:"appSettingNames,omitempty"` } -// SlotConfigNamesResource is slot Config names azure resource +// SlotConfigNamesResource is slot Config names azure resource. type SlotConfigNamesResource struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Kind *string `json:"kind,omitempty"` - Location *string `json:"location,omitempty"` - Type *string `json:"type,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - *SlotConfigNamesResourceProperties `json:"properties,omitempty"` -} - -// SlotConfigNamesResourceProperties is -type SlotConfigNamesResourceProperties struct { - ConnectionStringNames *[]string `json:"connectionStringNames,omitempty"` - AppSettingNames *[]string `json:"appSettingNames,omitempty"` + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Kind *string `json:"kind,omitempty"` + Location *string `json:"location,omitempty"` + Type *string `json:"type,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + *SlotConfigNames `json:"properties,omitempty"` } -// SlotDifference is an object describing the difference in setting values -// between two web app slots +// SlotDifference is a setting difference between two deployment slots of an +// app. type SlotDifference struct { ID *string `json:"id,omitempty"` Name *string `json:"name,omitempty"` @@ -2481,7 +3129,7 @@ type SlotDifference struct { *SlotDifferenceProperties `json:"properties,omitempty"` } -// SlotDifferenceProperties is +// SlotDifferenceProperties is slotDifference resource specific properties type SlotDifferenceProperties struct { Type *string `json:"type,omitempty"` SettingType *string `json:"settingType,omitempty"` @@ -2492,7 +3140,7 @@ type SlotDifferenceProperties struct { Description *string `json:"description,omitempty"` } -// SlotDifferenceCollection is collection of Slot Differences +// SlotDifferenceCollection is collection of slot differences. type SlotDifferenceCollection struct { autorest.Response `json:"-"` Value *[]SlotDifference `json:"value,omitempty"` @@ -2511,14 +3159,57 @@ func (client SlotDifferenceCollection) SlotDifferenceCollectionPreparer() (*http autorest.WithBaseURL(to.String(client.NextLink))) } -// SlowRequestsBasedTrigger is slowRequestsBasedTrigger +// SlotSwapStatus is the status of the last successfull slot swap operation. +type SlotSwapStatus struct { + TimestampUtc *date.Time `json:"timestampUtc,omitempty"` + SourceSlotName *string `json:"sourceSlotName,omitempty"` + DestinationSlotName *string `json:"destinationSlotName,omitempty"` +} + +// SlowRequestsBasedTrigger is trigger based on request execution time. type SlowRequestsBasedTrigger struct { TimeTaken *string `json:"timeTaken,omitempty"` Count *int32 `json:"count,omitempty"` TimeInterval *string `json:"timeInterval,omitempty"` } -// SourceControl is describes the Source Control OAuth Token +// Snapshot is a snapshot of an app. +type Snapshot struct { + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Kind *string `json:"kind,omitempty"` + Location *string `json:"location,omitempty"` + Type *string `json:"type,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + *SnapshotProperties `json:"properties,omitempty"` +} + +// SnapshotProperties is snapshot resource specific properties +type SnapshotProperties struct { + Time *date.Time `json:"time,omitempty"` +} + +// SnapshotCollection is collection of snapshots which can be used to revert an +// app to a previous time. +type SnapshotCollection struct { + autorest.Response `json:"-"` + Value *[]Snapshot `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// SnapshotCollectionPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client SnapshotCollection) SnapshotCollectionPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// SourceControl is the source control OAuth token. type SourceControl struct { autorest.Response `json:"-"` ID *string `json:"id,omitempty"` @@ -2530,7 +3221,7 @@ type SourceControl struct { *SourceControlProperties `json:"properties,omitempty"` } -// SourceControlProperties is +// SourceControlProperties is sourceControl resource specific properties type SourceControlProperties struct { Name *string `json:"name,omitempty"` Token *string `json:"token,omitempty"` @@ -2539,7 +3230,7 @@ type SourceControlProperties struct { ExpirationTime *date.Time `json:"expirationTime,omitempty"` } -// SourceControlCollection is collection of soure controls +// SourceControlCollection is collection of source controls. type SourceControlCollection struct { autorest.Response `json:"-"` Value *[]SourceControl `json:"value,omitempty"` @@ -2558,7 +3249,7 @@ func (client SourceControlCollection) SourceControlCollectionPreparer() (*http.R autorest.WithBaseURL(to.String(client.NextLink))) } -// StampCapacity is class containing stamp capacity information +// StampCapacity is stamp capacity information. type StampCapacity struct { Name *string `json:"name,omitempty"` AvailableCapacity *int64 `json:"availableCapacity,omitempty"` @@ -2572,7 +3263,7 @@ type StampCapacity struct { SiteMode *string `json:"siteMode,omitempty"` } -// StampCapacityCollection is collection of stamp capacities +// StampCapacityCollection is collection of stamp capacities. type StampCapacityCollection struct { autorest.Response `json:"-"` Value *[]StampCapacity `json:"value,omitempty"` @@ -2591,7 +3282,7 @@ func (client StampCapacityCollection) StampCapacityCollectionPreparer() (*http.R autorest.WithBaseURL(to.String(client.NextLink))) } -// StatusCodesBasedTrigger is statusCodeBasedTrigger +// StatusCodesBasedTrigger is trigger based on status code. type StatusCodesBasedTrigger struct { Status *int32 `json:"status,omitempty"` SubStatus *int32 `json:"subStatus,omitempty"` @@ -2600,7 +3291,51 @@ type StatusCodesBasedTrigger struct { TimeInterval *string `json:"timeInterval,omitempty"` } -// StringDictionary is string dictionary resource +// StorageMigrationOptions is options for app content migration. +type StorageMigrationOptions struct { + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Kind *string `json:"kind,omitempty"` + Location *string `json:"location,omitempty"` + Type *string `json:"type,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + *StorageMigrationOptionsProperties `json:"properties,omitempty"` +} + +// StorageMigrationOptionsProperties is storageMigrationOptions resource +// specific properties +type StorageMigrationOptionsProperties struct { + AzurefilesConnectionString *string `json:"azurefilesConnectionString,omitempty"` + AzurefilesShare *string `json:"azurefilesShare,omitempty"` + SwitchSiteAfterMigration *bool `json:"switchSiteAfterMigration,omitempty"` + BlockWriteAccessToSite *bool `json:"blockWriteAccessToSite,omitempty"` +} + +// StorageMigrationResponse is response for a migration of app content request. +type StorageMigrationResponse struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Kind *string `json:"kind,omitempty"` + Location *string `json:"location,omitempty"` + Type *string `json:"type,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + *StorageMigrationResponseProperties `json:"properties,omitempty"` +} + +// StorageMigrationResponseProperties is storageMigrationResponse resource +// specific properties +type StorageMigrationResponseProperties struct { + OperationID *string `json:"operationId,omitempty"` +} + +// String is +type String struct { + autorest.Response `json:"-"` + Value *string `json:"value,omitempty"` +} + +// StringDictionary is string dictionary resource. type StringDictionary struct { autorest.Response `json:"-"` ID *string `json:"id,omitempty"` @@ -2612,7 +3347,7 @@ type StringDictionary struct { Properties *map[string]*string `json:"properties,omitempty"` } -// TldLegalAgreement is represents a legal agreement for top level domain +// TldLegalAgreement is legal agreement for a top level domain. type TldLegalAgreement struct { AgreementKey *string `json:"agreementKey,omitempty"` Title *string `json:"title,omitempty"` @@ -2620,7 +3355,8 @@ type TldLegalAgreement struct { URL *string `json:"url,omitempty"` } -// TldLegalAgreementCollection is collection of Tld Legal Agreements +// TldLegalAgreementCollection is collection of top-level domain legal +// agreements. type TldLegalAgreementCollection struct { autorest.Response `json:"-"` Value *[]TldLegalAgreement `json:"value,omitempty"` @@ -2639,7 +3375,7 @@ func (client TldLegalAgreementCollection) TldLegalAgreementCollectionPreparer() autorest.WithBaseURL(to.String(client.NextLink))) } -// TopLevelDomain is a top level domain object +// TopLevelDomain is a top level domain object. type TopLevelDomain struct { autorest.Response `json:"-"` ID *string `json:"id,omitempty"` @@ -2651,19 +3387,19 @@ type TopLevelDomain struct { *TopLevelDomainProperties `json:"properties,omitempty"` } -// TopLevelDomainProperties is +// TopLevelDomainProperties is topLevelDomain resource specific properties type TopLevelDomainProperties struct { - Name *string `json:"name,omitempty"` - Privacy *bool `json:"privacy,omitempty"` + DomainName *string `json:"name,omitempty"` + Privacy *bool `json:"privacy,omitempty"` } // TopLevelDomainAgreementOption is options for retrieving the list of top -// level domain legal agreements +// level domain legal agreements. type TopLevelDomainAgreementOption struct { IncludePrivacy *bool `json:"includePrivacy,omitempty"` } -// TopLevelDomainCollection is collection of Top Level Domains +// TopLevelDomainCollection is collection of Top-level domains. type TopLevelDomainCollection struct { autorest.Response `json:"-"` Value *[]TopLevelDomain `json:"value,omitempty"` @@ -2682,7 +3418,7 @@ func (client TopLevelDomainCollection) TopLevelDomainCollectionPreparer() (*http autorest.WithBaseURL(to.String(client.NextLink))) } -// Usage is class that represents usage of the quota resource. +// Usage is usage of the quota resource. type Usage struct { ID *string `json:"id,omitempty"` Name *string `json:"name,omitempty"` @@ -2693,7 +3429,7 @@ type Usage struct { *UsageProperties `json:"properties,omitempty"` } -// UsageProperties is +// UsageProperties is usage resource specific properties type UsageProperties struct { DisplayName *string `json:"displayName,omitempty"` Name *string `json:"name,omitempty"` @@ -2706,7 +3442,7 @@ type UsageProperties struct { SiteMode *string `json:"siteMode,omitempty"` } -// UsageCollection is collection of usages +// UsageCollection is collection of usages. type UsageCollection struct { autorest.Response `json:"-"` Value *[]Usage `json:"value,omitempty"` @@ -2725,7 +3461,7 @@ func (client UsageCollection) UsageCollectionPreparer() (*http.Request, error) { autorest.WithBaseURL(to.String(client.NextLink))) } -// User is represents user crendentials used for publishing activity +// User is user crendentials used for publishing activity. type User struct { autorest.Response `json:"-"` ID *string `json:"id,omitempty"` @@ -2737,15 +3473,46 @@ type User struct { *UserProperties `json:"properties,omitempty"` } -// UserProperties is +// UserProperties is user resource specific properties type UserProperties struct { - Name *string `json:"name,omitempty"` - PublishingUserName *string `json:"publishingUserName,omitempty"` - PublishingPassword *string `json:"publishingPassword,omitempty"` - ScmURI *string `json:"scmUri,omitempty"` + UserName *string `json:"name,omitempty"` + PublishingUserName *string `json:"publishingUserName,omitempty"` + PublishingPassword *string `json:"publishingPassword,omitempty"` + PublishingPasswordHash *string `json:"publishingPasswordHash,omitempty"` + PublishingPasswordHashSalt *string `json:"publishingPasswordHashSalt,omitempty"` +} + +// ValidateProperties is app properties used for validation. +type ValidateProperties struct { + ServerFarmID *string `json:"serverFarmId,omitempty"` + SkuName *string `json:"skuName,omitempty"` + NeedLinuxWorkers *bool `json:"needLinuxWorkers,omitempty"` + Capacity *int32 `json:"capacity,omitempty"` + HostingEnvironment *string `json:"hostingEnvironment,omitempty"` +} + +// ValidateRequest is resource validation request content. +type ValidateRequest struct { + Name *string `json:"name,omitempty"` + Type ValidateResourceTypes `json:"type,omitempty"` + Location *string `json:"location,omitempty"` + *ValidateProperties `json:"properties,omitempty"` +} + +// ValidateResponse is describes the result of resource validation. +type ValidateResponse struct { + autorest.Response `json:"-"` + Status *string `json:"status,omitempty"` + Error *ValidateResponseError `json:"error,omitempty"` } -// VirtualApplication is +// ValidateResponseError is error details for when validation fails. +type ValidateResponseError struct { + Code *string `json:"code,omitempty"` + Message *string `json:"message,omitempty"` +} + +// VirtualApplication is virtual application in an app. type VirtualApplication struct { VirtualPath *string `json:"virtualPath,omitempty"` PhysicalPath *string `json:"physicalPath,omitempty"` @@ -2753,13 +3520,13 @@ type VirtualApplication struct { VirtualDirectories *[]VirtualDirectory `json:"virtualDirectories,omitempty"` } -// VirtualDirectory is +// VirtualDirectory is directory for virtual application. type VirtualDirectory struct { VirtualPath *string `json:"virtualPath,omitempty"` PhysicalPath *string `json:"physicalPath,omitempty"` } -// VirtualIPMapping is class that represents a VIP mapping +// VirtualIPMapping is virtual IP mapping. type VirtualIPMapping struct { VirtualIP *string `json:"virtualIP,omitempty"` InternalHTTPPort *int32 `json:"internalHttpPort,omitempty"` @@ -2767,7 +3534,7 @@ type VirtualIPMapping struct { InUse *bool `json:"inUse,omitempty"` } -// VirtualNetworkProfile is specification for using a virtual network +// VirtualNetworkProfile is specification for using a Virtual Network. type VirtualNetworkProfile struct { ID *string `json:"id,omitempty"` Name *string `json:"name,omitempty"` @@ -2775,8 +3542,8 @@ type VirtualNetworkProfile struct { Subnet *string `json:"subnet,omitempty"` } -// VnetGateway is the VnetGateway contract. This is used to give the vnet -// gateway access to the VPN package. +// VnetGateway is the Virtual Network gateway contract. This is used to give +// the Virtual Network gateway access to the VPN package. type VnetGateway struct { autorest.Response `json:"-"` ID *string `json:"id,omitempty"` @@ -2788,36 +3555,25 @@ type VnetGateway struct { *VnetGatewayProperties `json:"properties,omitempty"` } -// VnetGatewayProperties is +// VnetGatewayProperties is vnetGateway resource specific properties type VnetGatewayProperties struct { VnetName *string `json:"vnetName,omitempty"` VpnPackageURI *string `json:"vpnPackageUri,omitempty"` } -// VnetInfo is vNETInfo contract. This contract is public and is a stripped -// down version of VNETInfoInternal +// VnetInfo is virtual Network information contract. type VnetInfo struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Kind *string `json:"kind,omitempty"` - Location *string `json:"location,omitempty"` - Type *string `json:"type,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - *VnetInfoProperties `json:"properties,omitempty"` -} - -// VnetInfoProperties is -type VnetInfoProperties struct { - VnetResourceID *string `json:"vnetResourceId,omitempty"` - CertThumbprint *string `json:"certThumbprint,omitempty"` - CertBlob *string `json:"certBlob,omitempty"` - Routes *[]VnetRoute `json:"routes,omitempty"` - ResyncRequired *bool `json:"resyncRequired,omitempty"` - DNSServers *string `json:"dnsServers,omitempty"` + autorest.Response `json:"-"` + VnetResourceID *string `json:"vnetResourceId,omitempty"` + CertThumbprint *string `json:"certThumbprint,omitempty"` + CertBlob *string `json:"certBlob,omitempty"` + Routes *[]VnetRoute `json:"routes,omitempty"` + ResyncRequired *bool `json:"resyncRequired,omitempty"` + DNSServers *string `json:"dnsServers,omitempty"` } -// VnetRoute is vnetRoute contract used to pass routing information for a vnet. +// VnetRoute is virtual Network route contract used to pass routing information +// for a Virtual Network. type VnetRoute struct { autorest.Response `json:"-"` ID *string `json:"id,omitempty"` @@ -2829,29 +3585,16 @@ type VnetRoute struct { *VnetRouteProperties `json:"properties,omitempty"` } -// VnetRouteProperties is +// VnetRouteProperties is vnetRoute resource specific properties type VnetRouteProperties struct { - Name *string `json:"name,omitempty"` - StartAddress *string `json:"startAddress,omitempty"` - EndAddress *string `json:"endAddress,omitempty"` - RouteType *string `json:"routeType,omitempty"` + VnetRouteName *string `json:"name,omitempty"` + StartAddress *string `json:"startAddress,omitempty"` + EndAddress *string `json:"endAddress,omitempty"` + RouteType RouteType `json:"routeType,omitempty"` } -// WorkerPool is worker pool of a hostingEnvironment (App Service Environment) +// WorkerPool is worker pool of an App Service Environment. type WorkerPool struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Kind *string `json:"kind,omitempty"` - Location *string `json:"location,omitempty"` - Type *string `json:"type,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - *WorkerPoolProperties `json:"properties,omitempty"` - Sku *SkuDescription `json:"sku,omitempty"` -} - -// WorkerPoolProperties is -type WorkerPoolProperties struct { WorkerSizeID *int32 `json:"workerSizeId,omitempty"` ComputeMode ComputeModeOptions `json:"computeMode,omitempty"` WorkerSize *string `json:"workerSize,omitempty"` @@ -2859,11 +3602,11 @@ type WorkerPoolProperties struct { InstanceNames *[]string `json:"instanceNames,omitempty"` } -// WorkerPoolCollection is collection of worker pools +// WorkerPoolCollection is collection of worker pools. type WorkerPoolCollection struct { autorest.Response `json:"-"` - Value *[]WorkerPool `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` + Value *[]WorkerPoolResource `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` } // WorkerPoolCollectionPreparer prepares a request to retrieve the next set of results. It returns @@ -2877,3 +3620,17 @@ func (client WorkerPoolCollection) WorkerPoolCollectionPreparer() (*http.Request autorest.AsGet(), autorest.WithBaseURL(to.String(client.NextLink))) } + +// WorkerPoolResource is worker pool of an App Service Environment ARM +// resource. +type WorkerPoolResource struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Kind *string `json:"kind,omitempty"` + Location *string `json:"location,omitempty"` + Type *string `json:"type,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + *WorkerPool `json:"properties,omitempty"` + Sku *SkuDescription `json:"sku,omitempty"` +} diff --git a/arm/web/provider.go b/arm/web/provider.go deleted file mode 100644 index 309013497142..000000000000 --- a/arm/web/provider.go +++ /dev/null @@ -1,360 +0,0 @@ -package web - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// -// See the License for the specific language governing permissions and -// limitations under the License. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// 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/azure" - "net/http" -) - -// ProviderClient is the use these APIs to manage Azure Websites resources -// through the Azure Resource Manager. All task operations conform to the -// HTTP/1.1 protocol specification and each operation returns an -// x-ms-request-id header that can be used to obtain information about the -// request. You must make sure that requests made to these resources are -// secure. For more information, see -// https://msdn.microsoft.com/en-us/library/azure/dn790557.aspx. -type ProviderClient struct { - ManagementClient -} - -// NewProviderClient creates an instance of the ProviderClient client. -func NewProviderClient(subscriptionID string) ProviderClient { - return NewProviderClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewProviderClientWithBaseURI creates an instance of the ProviderClient -// client. -func NewProviderClientWithBaseURI(baseURI string, subscriptionID string) ProviderClient { - return ProviderClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// GetPublishingUser sends the get publishing user request. -func (client ProviderClient) GetPublishingUser() (result User, err error) { - req, err := client.GetPublishingUserPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "web.ProviderClient", "GetPublishingUser", nil, "Failure preparing request") - } - - resp, err := client.GetPublishingUserSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.ProviderClient", "GetPublishingUser", resp, "Failure sending request") - } - - result, err = client.GetPublishingUserResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.ProviderClient", "GetPublishingUser", resp, "Failure responding to request") - } - - return -} - -// GetPublishingUserPreparer prepares the GetPublishingUser request. -func (client ProviderClient) GetPublishingUserPreparer() (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPath("/providers/Microsoft.Web/publishingUsers/web"), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetPublishingUserSender sends the GetPublishingUser request. The method will close the -// http.Response Body if it receives an error. -func (client ProviderClient) GetPublishingUserSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetPublishingUserResponder handles the response to the GetPublishingUser request. The method always -// closes the http.Response Body. -func (client ProviderClient) GetPublishingUserResponder(resp *http.Response) (result User, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetSourceControl sends the get source control request. -// -// sourceControlType is type of source control -func (client ProviderClient) GetSourceControl(sourceControlType string) (result SourceControl, err error) { - req, err := client.GetSourceControlPreparer(sourceControlType) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.ProviderClient", "GetSourceControl", nil, "Failure preparing request") - } - - resp, err := client.GetSourceControlSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.ProviderClient", "GetSourceControl", resp, "Failure sending request") - } - - result, err = client.GetSourceControlResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.ProviderClient", "GetSourceControl", resp, "Failure responding to request") - } - - return -} - -// GetSourceControlPreparer prepares the GetSourceControl request. -func (client ProviderClient) GetSourceControlPreparer(sourceControlType string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "sourceControlType": autorest.Encode("path", sourceControlType), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/providers/Microsoft.Web/sourcecontrols/{sourceControlType}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSourceControlSender sends the GetSourceControl request. The method will close the -// http.Response Body if it receives an error. -func (client ProviderClient) GetSourceControlSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetSourceControlResponder handles the response to the GetSourceControl request. The method always -// closes the http.Response Body. -func (client ProviderClient) GetSourceControlResponder(resp *http.Response) (result SourceControl, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetSourceControls sends the get source controls request. -func (client ProviderClient) GetSourceControls() (result SourceControlCollection, err error) { - req, err := client.GetSourceControlsPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "web.ProviderClient", "GetSourceControls", nil, "Failure preparing request") - } - - resp, err := client.GetSourceControlsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.ProviderClient", "GetSourceControls", resp, "Failure sending request") - } - - result, err = client.GetSourceControlsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.ProviderClient", "GetSourceControls", resp, "Failure responding to request") - } - - return -} - -// GetSourceControlsPreparer prepares the GetSourceControls request. -func (client ProviderClient) GetSourceControlsPreparer() (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPath("/providers/Microsoft.Web/sourcecontrols"), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSourceControlsSender sends the GetSourceControls request. The method will close the -// http.Response Body if it receives an error. -func (client ProviderClient) GetSourceControlsSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetSourceControlsResponder handles the response to the GetSourceControls request. The method always -// closes the http.Response Body. -func (client ProviderClient) GetSourceControlsResponder(resp *http.Response) (result SourceControlCollection, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetSourceControlsNextResults retrieves the next set of results, if any. -func (client ProviderClient) GetSourceControlsNextResults(lastResults SourceControlCollection) (result SourceControlCollection, err error) { - req, err := lastResults.SourceControlCollectionPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "web.ProviderClient", "GetSourceControls", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.GetSourceControlsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.ProviderClient", "GetSourceControls", resp, "Failure sending next results request") - } - - result, err = client.GetSourceControlsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.ProviderClient", "GetSourceControls", resp, "Failure responding to next results request") - } - - return -} - -// UpdatePublishingUser sends the update publishing user request. -// -// requestMessage is details of publishing user -func (client ProviderClient) UpdatePublishingUser(requestMessage User) (result User, err error) { - req, err := client.UpdatePublishingUserPreparer(requestMessage) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.ProviderClient", "UpdatePublishingUser", nil, "Failure preparing request") - } - - resp, err := client.UpdatePublishingUserSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.ProviderClient", "UpdatePublishingUser", resp, "Failure sending request") - } - - result, err = client.UpdatePublishingUserResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.ProviderClient", "UpdatePublishingUser", resp, "Failure responding to request") - } - - return -} - -// UpdatePublishingUserPreparer prepares the UpdatePublishingUser request. -func (client ProviderClient) UpdatePublishingUserPreparer(requestMessage User) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPath("/providers/Microsoft.Web/publishingUsers/web"), - autorest.WithJSON(requestMessage), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// UpdatePublishingUserSender sends the UpdatePublishingUser request. The method will close the -// http.Response Body if it receives an error. -func (client ProviderClient) UpdatePublishingUserSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// UpdatePublishingUserResponder handles the response to the UpdatePublishingUser request. The method always -// closes the http.Response Body. -func (client ProviderClient) UpdatePublishingUserResponder(resp *http.Response) (result User, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// UpdateSourceControl sends the update source control request. -// -// sourceControlType is type of source control requestMessage is source control -// token information -func (client ProviderClient) UpdateSourceControl(sourceControlType string, requestMessage SourceControl) (result SourceControl, err error) { - req, err := client.UpdateSourceControlPreparer(sourceControlType, requestMessage) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.ProviderClient", "UpdateSourceControl", nil, "Failure preparing request") - } - - resp, err := client.UpdateSourceControlSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.ProviderClient", "UpdateSourceControl", resp, "Failure sending request") - } - - result, err = client.UpdateSourceControlResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.ProviderClient", "UpdateSourceControl", resp, "Failure responding to request") - } - - return -} - -// UpdateSourceControlPreparer prepares the UpdateSourceControl request. -func (client ProviderClient) UpdateSourceControlPreparer(sourceControlType string, requestMessage SourceControl) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "sourceControlType": autorest.Encode("path", sourceControlType), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/providers/Microsoft.Web/sourcecontrols/{sourceControlType}", pathParameters), - autorest.WithJSON(requestMessage), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// UpdateSourceControlSender sends the UpdateSourceControl request. The method will close the -// http.Response Body if it receives an error. -func (client ProviderClient) UpdateSourceControlSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// UpdateSourceControlResponder handles the response to the UpdateSourceControl request. The method always -// closes the http.Response Body. -func (client ProviderClient) UpdateSourceControlResponder(resp *http.Response) (result SourceControl, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/arm/web/recommendations.go b/arm/web/recommendations.go old mode 100644 new mode 100755 index d200a4b8f130..2e48a591d327 --- a/arm/web/recommendations.go +++ b/arm/web/recommendations.go @@ -21,16 +21,11 @@ package web import ( "github.com/Azure/go-autorest/autorest" "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" "net/http" ) -// RecommendationsClient is the use these APIs to manage Azure Websites -// resources through the Azure Resource Manager. All task operations conform to -// the HTTP/1.1 protocol specification and each operation returns an -// x-ms-request-id header that can be used to obtain information about the -// request. You must make sure that requests made to these resources are -// secure. For more information, see -// https://msdn.microsoft.com/en-us/library/azure/dn790557.aspx. +// RecommendationsClient is the composite Swagger for WebSite Management Client type RecommendationsClient struct { ManagementClient } @@ -47,48 +42,198 @@ func NewRecommendationsClientWithBaseURI(baseURI string, subscriptionID string) return RecommendationsClient{NewWithBaseURI(baseURI, subscriptionID)} } -// GetRecommendationBySubscription sends the get recommendation by subscription -// request. +// DisableAllForWebApp disable all recommendations for an app. // -// featured is if set, this API returns only the most critical recommendation -// among the others. Otherwise this API returns all recommendations available -// filter is return only channels specified in the filter. Filter is specified -// by using OData syntax. Example: $filter=channels eq 'Api' or channel eq -// 'Notification' -func (client RecommendationsClient) GetRecommendationBySubscription(featured *bool, filter string) (result ListRecommendation, err error) { - req, err := client.GetRecommendationBySubscriptionPreparer(featured, filter) +// resourceGroupName is name of the resource group to which the resource +// belongs. siteName is name of the app. +func (client RecommendationsClient) DisableAllForWebApp(resourceGroupName string, siteName string) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.RecommendationsClient", "DisableAllForWebApp") + } + + req, err := client.DisableAllForWebAppPreparer(resourceGroupName, siteName) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.RecommendationsClient", "DisableAllForWebApp", nil, "Failure preparing request") + } + + resp, err := client.DisableAllForWebAppSender(req) + if err != nil { + result.Response = resp + return result, autorest.NewErrorWithError(err, "web.RecommendationsClient", "DisableAllForWebApp", resp, "Failure sending request") + } + + result, err = client.DisableAllForWebAppResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.RecommendationsClient", "DisableAllForWebApp", resp, "Failure responding to request") + } + + return +} + +// DisableAllForWebAppPreparer prepares the DisableAllForWebApp request. +func (client RecommendationsClient) DisableAllForWebAppPreparer(resourceGroupName string, siteName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "siteName": autorest.Encode("path", siteName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-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.Web/sites/{siteName}/recommendations/disable", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DisableAllForWebAppSender sends the DisableAllForWebApp request. The method will close the +// http.Response Body if it receives an error. +func (client RecommendationsClient) DisableAllForWebAppSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DisableAllForWebAppResponder handles the response to the DisableAllForWebApp request. The method always +// closes the http.Response Body. +func (client RecommendationsClient) DisableAllForWebAppResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// GetRuleDetailsByWebApp get a recommendation rule for an app. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. siteName is name of the app. name is name of the recommendation. +// updateSeen is specify true to update the last-seen timestamp of +// the recommendation object. +func (client RecommendationsClient) GetRuleDetailsByWebApp(resourceGroupName string, siteName string, name string, updateSeen *bool) (result RecommendationRule, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.RecommendationsClient", "GetRuleDetailsByWebApp") + } + + req, err := client.GetRuleDetailsByWebAppPreparer(resourceGroupName, siteName, name, updateSeen) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.RecommendationsClient", "GetRuleDetailsByWebApp", nil, "Failure preparing request") + } + + resp, err := client.GetRuleDetailsByWebAppSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.RecommendationsClient", "GetRuleDetailsByWebApp", resp, "Failure sending request") + } + + result, err = client.GetRuleDetailsByWebAppResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.RecommendationsClient", "GetRuleDetailsByWebApp", resp, "Failure responding to request") + } + + return +} + +// GetRuleDetailsByWebAppPreparer prepares the GetRuleDetailsByWebApp request. +func (client RecommendationsClient) GetRuleDetailsByWebAppPreparer(resourceGroupName string, siteName string, name string, updateSeen *bool) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "siteName": autorest.Encode("path", siteName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if updateSeen != nil { + queryParameters["updateSeen"] = autorest.Encode("query", *updateSeen) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/recommendations/{name}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetRuleDetailsByWebAppSender sends the GetRuleDetailsByWebApp request. The method will close the +// http.Response Body if it receives an error. +func (client RecommendationsClient) GetRuleDetailsByWebAppSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetRuleDetailsByWebAppResponder handles the response to the GetRuleDetailsByWebApp request. The method always +// closes the http.Response Body. +func (client RecommendationsClient) GetRuleDetailsByWebAppResponder(resp *http.Response) (result RecommendationRule, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List list all recommendations for a subscription. +// +// featured is specify true to return only the most critical +// recommendations. The default is false, which returns all +// recommendations. filter is filter is specified by using OData syntax. +// Example: $filter=channels eq 'Api' or channel eq 'Notification' and +// startTime eq '2014-01-01T00:00:00Z' and endTime eq '2014-12-31T23:59:59Z' +// and timeGrain eq duration'[PT1H|PT1M|P1D] +func (client RecommendationsClient) List(featured *bool, filter string) (result ListRecommendation, err error) { + req, err := client.ListPreparer(featured, filter) if err != nil { - return result, autorest.NewErrorWithError(err, "web.RecommendationsClient", "GetRecommendationBySubscription", nil, "Failure preparing request") + return result, autorest.NewErrorWithError(err, "web.RecommendationsClient", "List", nil, "Failure preparing request") } - resp, err := client.GetRecommendationBySubscriptionSender(req) + resp, err := client.ListSender(req) if err != nil { result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.RecommendationsClient", "GetRecommendationBySubscription", resp, "Failure sending request") + return result, autorest.NewErrorWithError(err, "web.RecommendationsClient", "List", resp, "Failure sending request") } - result, err = client.GetRecommendationBySubscriptionResponder(resp) + result, err = client.ListResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "web.RecommendationsClient", "GetRecommendationBySubscription", resp, "Failure responding to request") + err = autorest.NewErrorWithError(err, "web.RecommendationsClient", "List", resp, "Failure responding to request") } return } -// GetRecommendationBySubscriptionPreparer prepares the GetRecommendationBySubscription request. -func (client RecommendationsClient) GetRecommendationBySubscriptionPreparer(featured *bool, filter string) (*http.Request, error) { +// ListPreparer prepares the List request. +func (client RecommendationsClient) ListPreparer(featured *bool, filter string) (*http.Request, error) { pathParameters := map[string]interface{}{ "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-03-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } if featured != nil { queryParameters["featured"] = autorest.Encode("query", *featured) } if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) + queryParameters["$filter"] = filter } preparer := autorest.CreatePreparer( @@ -99,15 +244,15 @@ func (client RecommendationsClient) GetRecommendationBySubscriptionPreparer(feat return preparer.Prepare(&http.Request{}) } -// GetRecommendationBySubscriptionSender sends the GetRecommendationBySubscription request. The method will close the +// ListSender sends the List request. The method will close the // http.Response Body if it receives an error. -func (client RecommendationsClient) GetRecommendationBySubscriptionSender(req *http.Request) (*http.Response, error) { +func (client RecommendationsClient) ListSender(req *http.Request) (*http.Response, error) { return autorest.SendWithSender(client, req) } -// GetRecommendationBySubscriptionResponder handles the response to the GetRecommendationBySubscription request. The method always +// ListResponder handles the response to the List request. The method always // closes the http.Response Body. -func (client RecommendationsClient) GetRecommendationBySubscriptionResponder(resp *http.Response) (result ListRecommendation, err error) { +func (client RecommendationsClient) ListResponder(resp *http.Response) (result ListRecommendation, err error) { err = autorest.Respond( resp, client.ByInspecting(), @@ -118,50 +263,56 @@ func (client RecommendationsClient) GetRecommendationBySubscriptionResponder(res return } -// GetRecommendationHistoryForSite sends the get recommendation history for -// site request. +// ListHistoryForWebApp get past recommendations for an app, optionally +// specified by the time range. // -// resourceGroupName is resource group name siteName is site name startTime is -// the start time of a time range to query, e.g. $filter=startTime eq -// '2015-01-01T00:00:00Z' and endTime eq '2015-01-02T00:00:00Z' endTime is the -// end time of a time range to query, e.g. $filter=startTime eq -// '2015-01-01T00:00:00Z' and endTime eq '2015-01-02T00:00:00Z' -func (client RecommendationsClient) GetRecommendationHistoryForSite(resourceGroupName string, siteName string, startTime string, endTime string) (result ListRecommendation, err error) { - req, err := client.GetRecommendationHistoryForSitePreparer(resourceGroupName, siteName, startTime, endTime) +// resourceGroupName is name of the resource group to which the resource +// belongs. siteName is name of the app. filter is filter is specified by using +// OData syntax. Example: $filter=channels eq 'Api' or channel eq +// 'Notification' and startTime eq '2014-01-01T00:00:00Z' and endTime eq +// '2014-12-31T23:59:59Z' and timeGrain eq duration'[PT1H|PT1M|P1D] +func (client RecommendationsClient) ListHistoryForWebApp(resourceGroupName string, siteName string, filter string) (result ListRecommendation, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.RecommendationsClient", "ListHistoryForWebApp") + } + + req, err := client.ListHistoryForWebAppPreparer(resourceGroupName, siteName, filter) if err != nil { - return result, autorest.NewErrorWithError(err, "web.RecommendationsClient", "GetRecommendationHistoryForSite", nil, "Failure preparing request") + return result, autorest.NewErrorWithError(err, "web.RecommendationsClient", "ListHistoryForWebApp", nil, "Failure preparing request") } - resp, err := client.GetRecommendationHistoryForSiteSender(req) + resp, err := client.ListHistoryForWebAppSender(req) if err != nil { result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.RecommendationsClient", "GetRecommendationHistoryForSite", resp, "Failure sending request") + return result, autorest.NewErrorWithError(err, "web.RecommendationsClient", "ListHistoryForWebApp", resp, "Failure sending request") } - result, err = client.GetRecommendationHistoryForSiteResponder(resp) + result, err = client.ListHistoryForWebAppResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "web.RecommendationsClient", "GetRecommendationHistoryForSite", resp, "Failure responding to request") + err = autorest.NewErrorWithError(err, "web.RecommendationsClient", "ListHistoryForWebApp", resp, "Failure responding to request") } return } -// GetRecommendationHistoryForSitePreparer prepares the GetRecommendationHistoryForSite request. -func (client RecommendationsClient) GetRecommendationHistoryForSitePreparer(resourceGroupName string, siteName string, startTime string, endTime string) (*http.Request, error) { +// ListHistoryForWebAppPreparer prepares the ListHistoryForWebApp request. +func (client RecommendationsClient) ListHistoryForWebAppPreparer(resourceGroupName string, siteName string, filter string) (*http.Request, error) { pathParameters := map[string]interface{}{ "resourceGroupName": autorest.Encode("path", resourceGroupName), "siteName": autorest.Encode("path", siteName), "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-03-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - if len(startTime) > 0 { - queryParameters["startTime"] = autorest.Encode("query", startTime) + "api-version": APIVersion, } - if len(endTime) > 0 { - queryParameters["endTime"] = autorest.Encode("query", endTime) + if len(filter) > 0 { + queryParameters["$filter"] = filter } preparer := autorest.CreatePreparer( @@ -172,15 +323,15 @@ func (client RecommendationsClient) GetRecommendationHistoryForSitePreparer(reso return preparer.Prepare(&http.Request{}) } -// GetRecommendationHistoryForSiteSender sends the GetRecommendationHistoryForSite request. The method will close the +// ListHistoryForWebAppSender sends the ListHistoryForWebApp request. The method will close the // http.Response Body if it receives an error. -func (client RecommendationsClient) GetRecommendationHistoryForSiteSender(req *http.Request) (*http.Response, error) { +func (client RecommendationsClient) ListHistoryForWebAppSender(req *http.Request) (*http.Response, error) { return autorest.SendWithSender(client, req) } -// GetRecommendationHistoryForSiteResponder handles the response to the GetRecommendationHistoryForSite request. The method always +// ListHistoryForWebAppResponder handles the response to the ListHistoryForWebApp request. The method always // closes the http.Response Body. -func (client RecommendationsClient) GetRecommendationHistoryForSiteResponder(resp *http.Response) (result ListRecommendation, err error) { +func (client RecommendationsClient) ListHistoryForWebAppResponder(resp *http.Response) (result ListRecommendation, err error) { err = autorest.Respond( resp, client.ByInspecting(), @@ -191,52 +342,59 @@ func (client RecommendationsClient) GetRecommendationHistoryForSiteResponder(res return } -// GetRecommendedRulesForSite sends the get recommended rules for site request. +// ListRecommendedRulesForWebApp get all recommendations for an app. // -// resourceGroupName is resource group name siteName is site name featured is -// if set, this API returns only the most critical recommendation among the -// others. Otherwise this API returns all recommendations available siteSku is -// the name of site SKU. numSlots is the number of site slots associated to the -// site -func (client RecommendationsClient) GetRecommendedRulesForSite(resourceGroupName string, siteName string, featured *bool, siteSku string, numSlots *int32) (result ListRecommendation, err error) { - req, err := client.GetRecommendedRulesForSitePreparer(resourceGroupName, siteName, featured, siteSku, numSlots) +// resourceGroupName is name of the resource group to which the resource +// belongs. siteName is name of the app. featured is specify true +// to return only the most critical recommendations. The default is +// false, which returns all recommendations. filter is return only +// channels specified in the filter. Filter is specified by using OData syntax. +// Example: $filter=channels eq 'Api' or channel eq 'Notification' +func (client RecommendationsClient) ListRecommendedRulesForWebApp(resourceGroupName string, siteName string, featured *bool, filter string) (result ListRecommendation, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.RecommendationsClient", "ListRecommendedRulesForWebApp") + } + + req, err := client.ListRecommendedRulesForWebAppPreparer(resourceGroupName, siteName, featured, filter) if err != nil { - return result, autorest.NewErrorWithError(err, "web.RecommendationsClient", "GetRecommendedRulesForSite", nil, "Failure preparing request") + return result, autorest.NewErrorWithError(err, "web.RecommendationsClient", "ListRecommendedRulesForWebApp", nil, "Failure preparing request") } - resp, err := client.GetRecommendedRulesForSiteSender(req) + resp, err := client.ListRecommendedRulesForWebAppSender(req) if err != nil { result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.RecommendationsClient", "GetRecommendedRulesForSite", resp, "Failure sending request") + return result, autorest.NewErrorWithError(err, "web.RecommendationsClient", "ListRecommendedRulesForWebApp", resp, "Failure sending request") } - result, err = client.GetRecommendedRulesForSiteResponder(resp) + result, err = client.ListRecommendedRulesForWebAppResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "web.RecommendationsClient", "GetRecommendedRulesForSite", resp, "Failure responding to request") + err = autorest.NewErrorWithError(err, "web.RecommendationsClient", "ListRecommendedRulesForWebApp", resp, "Failure responding to request") } return } -// GetRecommendedRulesForSitePreparer prepares the GetRecommendedRulesForSite request. -func (client RecommendationsClient) GetRecommendedRulesForSitePreparer(resourceGroupName string, siteName string, featured *bool, siteSku string, numSlots *int32) (*http.Request, error) { +// ListRecommendedRulesForWebAppPreparer prepares the ListRecommendedRulesForWebApp request. +func (client RecommendationsClient) ListRecommendedRulesForWebAppPreparer(resourceGroupName string, siteName string, featured *bool, filter string) (*http.Request, error) { pathParameters := map[string]interface{}{ "resourceGroupName": autorest.Encode("path", resourceGroupName), "siteName": autorest.Encode("path", siteName), "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-03-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } if featured != nil { queryParameters["featured"] = autorest.Encode("query", *featured) } - if len(siteSku) > 0 { - queryParameters["siteSku"] = autorest.Encode("query", siteSku) - } - if numSlots != nil { - queryParameters["numSlots"] = autorest.Encode("query", *numSlots) + if len(filter) > 0 { + queryParameters["$filter"] = filter } preparer := autorest.CreatePreparer( @@ -247,15 +405,15 @@ func (client RecommendationsClient) GetRecommendedRulesForSitePreparer(resourceG return preparer.Prepare(&http.Request{}) } -// GetRecommendedRulesForSiteSender sends the GetRecommendedRulesForSite request. The method will close the +// ListRecommendedRulesForWebAppSender sends the ListRecommendedRulesForWebApp request. The method will close the // http.Response Body if it receives an error. -func (client RecommendationsClient) GetRecommendedRulesForSiteSender(req *http.Request) (*http.Response, error) { +func (client RecommendationsClient) ListRecommendedRulesForWebAppSender(req *http.Request) (*http.Response, error) { return autorest.SendWithSender(client, req) } -// GetRecommendedRulesForSiteResponder handles the response to the GetRecommendedRulesForSite request. The method always +// ListRecommendedRulesForWebAppResponder handles the response to the ListRecommendedRulesForWebApp request. The method always // closes the http.Response Body. -func (client RecommendationsClient) GetRecommendedRulesForSiteResponder(resp *http.Response) (result ListRecommendation, err error) { +func (client RecommendationsClient) ListRecommendedRulesForWebAppResponder(resp *http.Response) (result ListRecommendation, err error) { err = autorest.Respond( resp, client.ByInspecting(), @@ -266,66 +424,133 @@ func (client RecommendationsClient) GetRecommendedRulesForSiteResponder(resp *ht return } -// GetRuleDetailsBySiteName sends the get rule details by site name request. +// ResetAllFilters reset all recommendation opt-out settings for a +// subscription. +func (client RecommendationsClient) ResetAllFilters() (result autorest.Response, err error) { + req, err := client.ResetAllFiltersPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "web.RecommendationsClient", "ResetAllFilters", nil, "Failure preparing request") + } + + resp, err := client.ResetAllFiltersSender(req) + if err != nil { + result.Response = resp + return result, autorest.NewErrorWithError(err, "web.RecommendationsClient", "ResetAllFilters", resp, "Failure sending request") + } + + result, err = client.ResetAllFiltersResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.RecommendationsClient", "ResetAllFilters", resp, "Failure responding to request") + } + + return +} + +// ResetAllFiltersPreparer prepares the ResetAllFilters request. +func (client RecommendationsClient) ResetAllFiltersPreparer() (*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.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Web/recommendations/reset", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ResetAllFiltersSender sends the ResetAllFilters request. The method will close the +// http.Response Body if it receives an error. +func (client RecommendationsClient) ResetAllFiltersSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ResetAllFiltersResponder handles the response to the ResetAllFilters request. The method always +// closes the http.Response Body. +func (client RecommendationsClient) ResetAllFiltersResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// ResetAllFiltersForWebApp reset all recommendation opt-out settings for an +// app. // -// resourceGroupName is resource group name siteName is site name name is -// recommendation rule name -func (client RecommendationsClient) GetRuleDetailsBySiteName(resourceGroupName string, siteName string, name string) (result RecommendationRule, err error) { - req, err := client.GetRuleDetailsBySiteNamePreparer(resourceGroupName, siteName, name) +// resourceGroupName is name of the resource group to which the resource +// belongs. siteName is name of the app. +func (client RecommendationsClient) ResetAllFiltersForWebApp(resourceGroupName string, siteName string) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.RecommendationsClient", "ResetAllFiltersForWebApp") + } + + req, err := client.ResetAllFiltersForWebAppPreparer(resourceGroupName, siteName) if err != nil { - return result, autorest.NewErrorWithError(err, "web.RecommendationsClient", "GetRuleDetailsBySiteName", nil, "Failure preparing request") + return result, autorest.NewErrorWithError(err, "web.RecommendationsClient", "ResetAllFiltersForWebApp", nil, "Failure preparing request") } - resp, err := client.GetRuleDetailsBySiteNameSender(req) + resp, err := client.ResetAllFiltersForWebAppSender(req) if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.RecommendationsClient", "GetRuleDetailsBySiteName", resp, "Failure sending request") + result.Response = resp + return result, autorest.NewErrorWithError(err, "web.RecommendationsClient", "ResetAllFiltersForWebApp", resp, "Failure sending request") } - result, err = client.GetRuleDetailsBySiteNameResponder(resp) + result, err = client.ResetAllFiltersForWebAppResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "web.RecommendationsClient", "GetRuleDetailsBySiteName", resp, "Failure responding to request") + err = autorest.NewErrorWithError(err, "web.RecommendationsClient", "ResetAllFiltersForWebApp", resp, "Failure responding to request") } return } -// GetRuleDetailsBySiteNamePreparer prepares the GetRuleDetailsBySiteName request. -func (client RecommendationsClient) GetRuleDetailsBySiteNamePreparer(resourceGroupName string, siteName string, name string) (*http.Request, error) { +// ResetAllFiltersForWebAppPreparer prepares the ResetAllFiltersForWebApp request. +func (client RecommendationsClient) ResetAllFiltersForWebAppPreparer(resourceGroupName string, siteName string) (*http.Request, error) { pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), "resourceGroupName": autorest.Encode("path", resourceGroupName), "siteName": autorest.Encode("path", siteName), "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2016-03-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( - autorest.AsGet(), + autorest.AsPost(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/recommendations/{name}", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/recommendations/reset", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare(&http.Request{}) } -// GetRuleDetailsBySiteNameSender sends the GetRuleDetailsBySiteName request. The method will close the +// ResetAllFiltersForWebAppSender sends the ResetAllFiltersForWebApp request. The method will close the // http.Response Body if it receives an error. -func (client RecommendationsClient) GetRuleDetailsBySiteNameSender(req *http.Request) (*http.Response, error) { +func (client RecommendationsClient) ResetAllFiltersForWebAppSender(req *http.Request) (*http.Response, error) { return autorest.SendWithSender(client, req) } -// GetRuleDetailsBySiteNameResponder handles the response to the GetRuleDetailsBySiteName request. The method always +// ResetAllFiltersForWebAppResponder handles the response to the ResetAllFiltersForWebApp request. The method always // closes the http.Response Body. -func (client RecommendationsClient) GetRuleDetailsBySiteNameResponder(resp *http.Response) (result RecommendationRule, err error) { +func (client RecommendationsClient) ResetAllFiltersForWebAppResponder(resp *http.Response) (result autorest.Response, err error) { err = autorest.Respond( resp, client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} + result.Response = resp return } diff --git a/arm/web/serverfarms.go b/arm/web/serverfarms.go deleted file mode 100644 index f483e83e56cd..000000000000 --- a/arm/web/serverfarms.go +++ /dev/null @@ -1,1403 +0,0 @@ -package web - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// -// See the License for the specific language governing permissions and -// limitations under the License. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// 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/azure" - "net/http" -) - -// ServerFarmsClient is the use these APIs to manage Azure Websites resources -// through the Azure Resource Manager. All task operations conform to the -// HTTP/1.1 protocol specification and each operation returns an -// x-ms-request-id header that can be used to obtain information about the -// request. You must make sure that requests made to these resources are -// secure. For more information, see -// https://msdn.microsoft.com/en-us/library/azure/dn790557.aspx. -type ServerFarmsClient struct { - ManagementClient -} - -// NewServerFarmsClient creates an instance of the ServerFarmsClient client. -func NewServerFarmsClient(subscriptionID string) ServerFarmsClient { - return NewServerFarmsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewServerFarmsClientWithBaseURI creates an instance of the ServerFarmsClient -// client. -func NewServerFarmsClientWithBaseURI(baseURI string, subscriptionID string) ServerFarmsClient { - return ServerFarmsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdateServerFarm sends the create or update server farm request. -// This method may poll for completion. Polling can be canceled by passing the -// cancel channel argument. The channel will be used to cancel polling and any -// outstanding HTTP requests. -// -// resourceGroupName is name of resource group name is name of App Service Plan -// serverFarmEnvelope is details of App Service Plan allowPendingState is -// oBSOLETE: If true, allow pending state for App Service Plan -func (client ServerFarmsClient) CreateOrUpdateServerFarm(resourceGroupName string, name string, serverFarmEnvelope ServerFarmWithRichSku, allowPendingState *bool, cancel <-chan struct{}) (result autorest.Response, err error) { - req, err := client.CreateOrUpdateServerFarmPreparer(resourceGroupName, name, serverFarmEnvelope, allowPendingState, cancel) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.ServerFarmsClient", "CreateOrUpdateServerFarm", nil, "Failure preparing request") - } - - resp, err := client.CreateOrUpdateServerFarmSender(req) - if err != nil { - result.Response = resp - return result, autorest.NewErrorWithError(err, "web.ServerFarmsClient", "CreateOrUpdateServerFarm", resp, "Failure sending request") - } - - result, err = client.CreateOrUpdateServerFarmResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.ServerFarmsClient", "CreateOrUpdateServerFarm", resp, "Failure responding to request") - } - - return -} - -// CreateOrUpdateServerFarmPreparer prepares the CreateOrUpdateServerFarm request. -func (client ServerFarmsClient) CreateOrUpdateServerFarmPreparer(resourceGroupName string, name string, serverFarmEnvelope ServerFarmWithRichSku, allowPendingState *bool, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - if allowPendingState != nil { - queryParameters["allowPendingState"] = autorest.Encode("query", *allowPendingState) - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}", pathParameters), - autorest.WithJSON(serverFarmEnvelope), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// CreateOrUpdateServerFarmSender sends the CreateOrUpdateServerFarm request. The method will close the -// http.Response Body if it receives an error. -func (client ServerFarmsClient) CreateOrUpdateServerFarmSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// CreateOrUpdateServerFarmResponder handles the response to the CreateOrUpdateServerFarm request. The method always -// closes the http.Response Body. -func (client ServerFarmsClient) CreateOrUpdateServerFarmResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} - -// CreateOrUpdateVnetRoute sends the create or update vnet route request. -// -// resourceGroupName is name of resource group name is name of App Service Plan -// vnetName is name of virtual network routeName is name of the virtual network -// route route is the route object -func (client ServerFarmsClient) CreateOrUpdateVnetRoute(resourceGroupName string, name string, vnetName string, routeName string, route VnetRoute) (result VnetRoute, err error) { - req, err := client.CreateOrUpdateVnetRoutePreparer(resourceGroupName, name, vnetName, routeName, route) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.ServerFarmsClient", "CreateOrUpdateVnetRoute", nil, "Failure preparing request") - } - - resp, err := client.CreateOrUpdateVnetRouteSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.ServerFarmsClient", "CreateOrUpdateVnetRoute", resp, "Failure sending request") - } - - result, err = client.CreateOrUpdateVnetRouteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.ServerFarmsClient", "CreateOrUpdateVnetRoute", resp, "Failure responding to request") - } - - return -} - -// CreateOrUpdateVnetRoutePreparer prepares the CreateOrUpdateVnetRoute request. -func (client ServerFarmsClient) CreateOrUpdateVnetRoutePreparer(resourceGroupName string, name string, vnetName string, routeName string, route VnetRoute) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "routeName": autorest.Encode("path", routeName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vnetName": autorest.Encode("path", vnetName), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/virtualNetworkConnections/{vnetName}/routes/{routeName}", pathParameters), - autorest.WithJSON(route), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CreateOrUpdateVnetRouteSender sends the CreateOrUpdateVnetRoute request. The method will close the -// http.Response Body if it receives an error. -func (client ServerFarmsClient) CreateOrUpdateVnetRouteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CreateOrUpdateVnetRouteResponder handles the response to the CreateOrUpdateVnetRoute request. The method always -// closes the http.Response Body. -func (client ServerFarmsClient) CreateOrUpdateVnetRouteResponder(resp *http.Response) (result VnetRoute, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusBadRequest, http.StatusNotFound), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// DeleteServerFarm sends the delete server farm request. -// -// resourceGroupName is name of resource group name is name of App Service Plan -func (client ServerFarmsClient) DeleteServerFarm(resourceGroupName string, name string) (result SetObject, err error) { - req, err := client.DeleteServerFarmPreparer(resourceGroupName, name) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.ServerFarmsClient", "DeleteServerFarm", nil, "Failure preparing request") - } - - resp, err := client.DeleteServerFarmSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.ServerFarmsClient", "DeleteServerFarm", resp, "Failure sending request") - } - - result, err = client.DeleteServerFarmResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.ServerFarmsClient", "DeleteServerFarm", resp, "Failure responding to request") - } - - return -} - -// DeleteServerFarmPreparer prepares the DeleteServerFarm request. -func (client ServerFarmsClient) DeleteServerFarmPreparer(resourceGroupName string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// DeleteServerFarmSender sends the DeleteServerFarm request. The method will close the -// http.Response Body if it receives an error. -func (client ServerFarmsClient) DeleteServerFarmSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DeleteServerFarmResponder handles the response to the DeleteServerFarm request. The method always -// closes the http.Response Body. -func (client ServerFarmsClient) DeleteServerFarmResponder(resp *http.Response) (result SetObject, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Value), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// DeleteVnetRoute sends the delete vnet route request. -// -// resourceGroupName is name of resource group name is name of App Service Plan -// vnetName is name of virtual network routeName is name of the virtual network -// route -func (client ServerFarmsClient) DeleteVnetRoute(resourceGroupName string, name string, vnetName string, routeName string) (result SetObject, err error) { - req, err := client.DeleteVnetRoutePreparer(resourceGroupName, name, vnetName, routeName) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.ServerFarmsClient", "DeleteVnetRoute", nil, "Failure preparing request") - } - - resp, err := client.DeleteVnetRouteSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.ServerFarmsClient", "DeleteVnetRoute", resp, "Failure sending request") - } - - result, err = client.DeleteVnetRouteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.ServerFarmsClient", "DeleteVnetRoute", resp, "Failure responding to request") - } - - return -} - -// DeleteVnetRoutePreparer prepares the DeleteVnetRoute request. -func (client ServerFarmsClient) DeleteVnetRoutePreparer(resourceGroupName string, name string, vnetName string, routeName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "routeName": autorest.Encode("path", routeName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vnetName": autorest.Encode("path", vnetName), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/virtualNetworkConnections/{vnetName}/routes/{routeName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// DeleteVnetRouteSender sends the DeleteVnetRoute request. The method will close the -// http.Response Body if it receives an error. -func (client ServerFarmsClient) DeleteVnetRouteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DeleteVnetRouteResponder handles the response to the DeleteVnetRoute request. The method always -// closes the http.Response Body. -func (client ServerFarmsClient) DeleteVnetRouteResponder(resp *http.Response) (result SetObject, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNotFound), - autorest.ByUnmarshallingJSON(&result.Value), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetRouteForVnet sends the get route for vnet request. -// -// resourceGroupName is name of resource group name is name of App Service Plan -// vnetName is name of virtual network routeName is name of the virtual network -// route -func (client ServerFarmsClient) GetRouteForVnet(resourceGroupName string, name string, vnetName string, routeName string) (result ListVnetRoute, err error) { - req, err := client.GetRouteForVnetPreparer(resourceGroupName, name, vnetName, routeName) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.ServerFarmsClient", "GetRouteForVnet", nil, "Failure preparing request") - } - - resp, err := client.GetRouteForVnetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.ServerFarmsClient", "GetRouteForVnet", resp, "Failure sending request") - } - - result, err = client.GetRouteForVnetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.ServerFarmsClient", "GetRouteForVnet", resp, "Failure responding to request") - } - - return -} - -// GetRouteForVnetPreparer prepares the GetRouteForVnet request. -func (client ServerFarmsClient) GetRouteForVnetPreparer(resourceGroupName string, name string, vnetName string, routeName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "routeName": autorest.Encode("path", routeName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vnetName": autorest.Encode("path", vnetName), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/virtualNetworkConnections/{vnetName}/routes/{routeName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetRouteForVnetSender sends the GetRouteForVnet request. The method will close the -// http.Response Body if it receives an error. -func (client ServerFarmsClient) GetRouteForVnetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetRouteForVnetResponder handles the response to the GetRouteForVnet request. The method always -// closes the http.Response Body. -func (client ServerFarmsClient) GetRouteForVnetResponder(resp *http.Response) (result ListVnetRoute, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNotFound), - autorest.ByUnmarshallingJSON(&result.Value), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetRoutesForVnet sends the get routes for vnet request. -// -// resourceGroupName is name of resource group name is name of App Service Plan -// vnetName is name of virtual network -func (client ServerFarmsClient) GetRoutesForVnet(resourceGroupName string, name string, vnetName string) (result ListVnetRoute, err error) { - req, err := client.GetRoutesForVnetPreparer(resourceGroupName, name, vnetName) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.ServerFarmsClient", "GetRoutesForVnet", nil, "Failure preparing request") - } - - resp, err := client.GetRoutesForVnetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.ServerFarmsClient", "GetRoutesForVnet", resp, "Failure sending request") - } - - result, err = client.GetRoutesForVnetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.ServerFarmsClient", "GetRoutesForVnet", resp, "Failure responding to request") - } - - return -} - -// GetRoutesForVnetPreparer prepares the GetRoutesForVnet request. -func (client ServerFarmsClient) GetRoutesForVnetPreparer(resourceGroupName string, name string, vnetName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vnetName": autorest.Encode("path", vnetName), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/virtualNetworkConnections/{vnetName}/routes", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetRoutesForVnetSender sends the GetRoutesForVnet request. The method will close the -// http.Response Body if it receives an error. -func (client ServerFarmsClient) GetRoutesForVnetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetRoutesForVnetResponder handles the response to the GetRoutesForVnet request. The method always -// closes the http.Response Body. -func (client ServerFarmsClient) GetRoutesForVnetResponder(resp *http.Response) (result ListVnetRoute, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Value), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetServerFarm sends the get server farm request. -// -// resourceGroupName is name of resource group name is name of App Service Plan -func (client ServerFarmsClient) GetServerFarm(resourceGroupName string, name string) (result ServerFarmWithRichSku, err error) { - req, err := client.GetServerFarmPreparer(resourceGroupName, name) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.ServerFarmsClient", "GetServerFarm", nil, "Failure preparing request") - } - - resp, err := client.GetServerFarmSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.ServerFarmsClient", "GetServerFarm", resp, "Failure sending request") - } - - result, err = client.GetServerFarmResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.ServerFarmsClient", "GetServerFarm", resp, "Failure responding to request") - } - - return -} - -// GetServerFarmPreparer prepares the GetServerFarm request. -func (client ServerFarmsClient) GetServerFarmPreparer(resourceGroupName string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetServerFarmSender sends the GetServerFarm request. The method will close the -// http.Response Body if it receives an error. -func (client ServerFarmsClient) GetServerFarmSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetServerFarmResponder handles the response to the GetServerFarm request. The method always -// closes the http.Response Body. -func (client ServerFarmsClient) GetServerFarmResponder(resp *http.Response) (result ServerFarmWithRichSku, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetServerFarmMetricDefintions sends the get server farm metric defintions -// request. -// -// resourceGroupName is name of resource group name is name of App Service Plan -func (client ServerFarmsClient) GetServerFarmMetricDefintions(resourceGroupName string, name string) (result MetricDefinitionCollection, err error) { - req, err := client.GetServerFarmMetricDefintionsPreparer(resourceGroupName, name) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.ServerFarmsClient", "GetServerFarmMetricDefintions", nil, "Failure preparing request") - } - - resp, err := client.GetServerFarmMetricDefintionsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.ServerFarmsClient", "GetServerFarmMetricDefintions", resp, "Failure sending request") - } - - result, err = client.GetServerFarmMetricDefintionsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.ServerFarmsClient", "GetServerFarmMetricDefintions", resp, "Failure responding to request") - } - - return -} - -// GetServerFarmMetricDefintionsPreparer prepares the GetServerFarmMetricDefintions request. -func (client ServerFarmsClient) GetServerFarmMetricDefintionsPreparer(resourceGroupName string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/metricdefinitions", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetServerFarmMetricDefintionsSender sends the GetServerFarmMetricDefintions request. The method will close the -// http.Response Body if it receives an error. -func (client ServerFarmsClient) GetServerFarmMetricDefintionsSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetServerFarmMetricDefintionsResponder handles the response to the GetServerFarmMetricDefintions request. The method always -// closes the http.Response Body. -func (client ServerFarmsClient) GetServerFarmMetricDefintionsResponder(resp *http.Response) (result MetricDefinitionCollection, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetServerFarmMetricDefintionsNextResults retrieves the next set of results, if any. -func (client ServerFarmsClient) GetServerFarmMetricDefintionsNextResults(lastResults MetricDefinitionCollection) (result MetricDefinitionCollection, err error) { - req, err := lastResults.MetricDefinitionCollectionPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "web.ServerFarmsClient", "GetServerFarmMetricDefintions", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.GetServerFarmMetricDefintionsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.ServerFarmsClient", "GetServerFarmMetricDefintions", resp, "Failure sending next results request") - } - - result, err = client.GetServerFarmMetricDefintionsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.ServerFarmsClient", "GetServerFarmMetricDefintions", resp, "Failure responding to next results request") - } - - return -} - -// GetServerFarmMetrics sends the get server farm metrics request. -// -// resourceGroupName is name of resource group name is name of App Service Plan -// details is if true, metrics are broken down per App Service Plan instance -// filter is return only usages/metrics specified in the filter. Filter -// conforms to odata syntax. Example: $filter=(name.value eq 'Metric1' or -// name.value eq 'Metric2') and startTime eq '2014-01-01T00:00:00Z' and endTime -// eq '2014-12-31T23:59:59Z' and timeGrain eq duration'[Hour|Minute|Day]'. -func (client ServerFarmsClient) GetServerFarmMetrics(resourceGroupName string, name string, details *bool, filter string) (result ResourceMetricCollection, err error) { - req, err := client.GetServerFarmMetricsPreparer(resourceGroupName, name, details, filter) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.ServerFarmsClient", "GetServerFarmMetrics", nil, "Failure preparing request") - } - - resp, err := client.GetServerFarmMetricsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.ServerFarmsClient", "GetServerFarmMetrics", resp, "Failure sending request") - } - - result, err = client.GetServerFarmMetricsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.ServerFarmsClient", "GetServerFarmMetrics", resp, "Failure responding to request") - } - - return -} - -// GetServerFarmMetricsPreparer prepares the GetServerFarmMetrics request. -func (client ServerFarmsClient) GetServerFarmMetricsPreparer(resourceGroupName string, name string, details *bool, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - if details != nil { - queryParameters["details"] = autorest.Encode("query", *details) - } - if len(filter) > 0 { - queryParameters["$filter"] = filter - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/metrics", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetServerFarmMetricsSender sends the GetServerFarmMetrics request. The method will close the -// http.Response Body if it receives an error. -func (client ServerFarmsClient) GetServerFarmMetricsSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetServerFarmMetricsResponder handles the response to the GetServerFarmMetrics request. The method always -// closes the http.Response Body. -func (client ServerFarmsClient) GetServerFarmMetricsResponder(resp *http.Response) (result ResourceMetricCollection, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetServerFarmMetricsNextResults retrieves the next set of results, if any. -func (client ServerFarmsClient) GetServerFarmMetricsNextResults(lastResults ResourceMetricCollection) (result ResourceMetricCollection, err error) { - req, err := lastResults.ResourceMetricCollectionPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "web.ServerFarmsClient", "GetServerFarmMetrics", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.GetServerFarmMetricsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.ServerFarmsClient", "GetServerFarmMetrics", resp, "Failure sending next results request") - } - - result, err = client.GetServerFarmMetricsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.ServerFarmsClient", "GetServerFarmMetrics", resp, "Failure responding to next results request") - } - - return -} - -// GetServerFarmOperation sends the get server farm operation request. -// -// resourceGroupName is name of resource group name is name of server farm -// operationID is id of Server farm operation"> -func (client ServerFarmsClient) GetServerFarmOperation(resourceGroupName string, name string, operationID string) (result ServerFarmWithRichSku, err error) { - req, err := client.GetServerFarmOperationPreparer(resourceGroupName, name, operationID) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.ServerFarmsClient", "GetServerFarmOperation", nil, "Failure preparing request") - } - - resp, err := client.GetServerFarmOperationSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.ServerFarmsClient", "GetServerFarmOperation", resp, "Failure sending request") - } - - result, err = client.GetServerFarmOperationResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.ServerFarmsClient", "GetServerFarmOperation", resp, "Failure responding to request") - } - - return -} - -// GetServerFarmOperationPreparer prepares the GetServerFarmOperation request. -func (client ServerFarmsClient) GetServerFarmOperationPreparer(resourceGroupName string, name string, operationID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "operationId": autorest.Encode("path", operationID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/operationresults/{operationId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetServerFarmOperationSender sends the GetServerFarmOperation request. The method will close the -// http.Response Body if it receives an error. -func (client ServerFarmsClient) GetServerFarmOperationSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetServerFarmOperationResponder handles the response to the GetServerFarmOperation request. The method always -// closes the http.Response Body. -func (client ServerFarmsClient) GetServerFarmOperationResponder(resp *http.Response) (result ServerFarmWithRichSku, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetServerFarms sends the get server farms request. -// -// resourceGroupName is name of resource group -func (client ServerFarmsClient) GetServerFarms(resourceGroupName string) (result ServerFarmCollection, err error) { - req, err := client.GetServerFarmsPreparer(resourceGroupName) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.ServerFarmsClient", "GetServerFarms", nil, "Failure preparing request") - } - - resp, err := client.GetServerFarmsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.ServerFarmsClient", "GetServerFarms", resp, "Failure sending request") - } - - result, err = client.GetServerFarmsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.ServerFarmsClient", "GetServerFarms", resp, "Failure responding to request") - } - - return -} - -// GetServerFarmsPreparer prepares the GetServerFarms request. -func (client ServerFarmsClient) GetServerFarmsPreparer(resourceGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetServerFarmsSender sends the GetServerFarms request. The method will close the -// http.Response Body if it receives an error. -func (client ServerFarmsClient) GetServerFarmsSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetServerFarmsResponder handles the response to the GetServerFarms request. The method always -// closes the http.Response Body. -func (client ServerFarmsClient) GetServerFarmsResponder(resp *http.Response) (result ServerFarmCollection, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetServerFarmsNextResults retrieves the next set of results, if any. -func (client ServerFarmsClient) GetServerFarmsNextResults(lastResults ServerFarmCollection) (result ServerFarmCollection, err error) { - req, err := lastResults.ServerFarmCollectionPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "web.ServerFarmsClient", "GetServerFarms", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.GetServerFarmsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.ServerFarmsClient", "GetServerFarms", resp, "Failure sending next results request") - } - - result, err = client.GetServerFarmsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.ServerFarmsClient", "GetServerFarms", resp, "Failure responding to next results request") - } - - return -} - -// GetServerFarmSites sends the get server farm sites request. -// -// resourceGroupName is name of resource group name is name of App Service Plan -// skipToken is skip to of web apps in a list. If specified, the resulting list -// will contain web apps starting from (including) the skipToken. Else, the -// resulting list contains web apps from the start of the list filter is -// supported filter: $filter=state eq running. Returns only web apps that are -// currently running top is list page size. If specified, results are paged. -func (client ServerFarmsClient) GetServerFarmSites(resourceGroupName string, name string, skipToken string, filter string, top string) (result SiteCollection, err error) { - req, err := client.GetServerFarmSitesPreparer(resourceGroupName, name, skipToken, filter, top) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.ServerFarmsClient", "GetServerFarmSites", nil, "Failure preparing request") - } - - resp, err := client.GetServerFarmSitesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.ServerFarmsClient", "GetServerFarmSites", resp, "Failure sending request") - } - - result, err = client.GetServerFarmSitesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.ServerFarmsClient", "GetServerFarmSites", resp, "Failure responding to request") - } - - return -} - -// GetServerFarmSitesPreparer prepares the GetServerFarmSites request. -func (client ServerFarmsClient) GetServerFarmSitesPreparer(resourceGroupName string, name string, skipToken string, filter string, top string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - if len(skipToken) > 0 { - queryParameters["$skipToken"] = autorest.Encode("query", skipToken) - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - 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.Web/serverfarms/{name}/sites", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetServerFarmSitesSender sends the GetServerFarmSites request. The method will close the -// http.Response Body if it receives an error. -func (client ServerFarmsClient) GetServerFarmSitesSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetServerFarmSitesResponder handles the response to the GetServerFarmSites request. The method always -// closes the http.Response Body. -func (client ServerFarmsClient) GetServerFarmSitesResponder(resp *http.Response) (result SiteCollection, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetServerFarmSitesNextResults retrieves the next set of results, if any. -func (client ServerFarmsClient) GetServerFarmSitesNextResults(lastResults SiteCollection) (result SiteCollection, err error) { - req, err := lastResults.SiteCollectionPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "web.ServerFarmsClient", "GetServerFarmSites", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.GetServerFarmSitesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.ServerFarmsClient", "GetServerFarmSites", resp, "Failure sending next results request") - } - - result, err = client.GetServerFarmSitesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.ServerFarmsClient", "GetServerFarmSites", resp, "Failure responding to next results request") - } - - return -} - -// GetServerFarmVnetGateway sends the get server farm vnet gateway request. -// -// resourceGroupName is name of resource group name is name of the App Service -// Plan vnetName is name of the virtual network gatewayName is name of the -// gateway. Only the 'primary' gateway is supported. -func (client ServerFarmsClient) GetServerFarmVnetGateway(resourceGroupName string, name string, vnetName string, gatewayName string) (result VnetGateway, err error) { - req, err := client.GetServerFarmVnetGatewayPreparer(resourceGroupName, name, vnetName, gatewayName) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.ServerFarmsClient", "GetServerFarmVnetGateway", nil, "Failure preparing request") - } - - resp, err := client.GetServerFarmVnetGatewaySender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.ServerFarmsClient", "GetServerFarmVnetGateway", resp, "Failure sending request") - } - - result, err = client.GetServerFarmVnetGatewayResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.ServerFarmsClient", "GetServerFarmVnetGateway", resp, "Failure responding to request") - } - - return -} - -// GetServerFarmVnetGatewayPreparer prepares the GetServerFarmVnetGateway request. -func (client ServerFarmsClient) GetServerFarmVnetGatewayPreparer(resourceGroupName string, name string, vnetName string, gatewayName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "gatewayName": autorest.Encode("path", gatewayName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vnetName": autorest.Encode("path", vnetName), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/virtualNetworkConnections/{vnetName}/gateways/{gatewayName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetServerFarmVnetGatewaySender sends the GetServerFarmVnetGateway request. The method will close the -// http.Response Body if it receives an error. -func (client ServerFarmsClient) GetServerFarmVnetGatewaySender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetServerFarmVnetGatewayResponder handles the response to the GetServerFarmVnetGateway request. The method always -// closes the http.Response Body. -func (client ServerFarmsClient) GetServerFarmVnetGatewayResponder(resp *http.Response) (result VnetGateway, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetVnetFromServerFarm sends the get vnet from server farm request. -// -// resourceGroupName is name of resource group name is name of App Service Plan -// vnetName is name of virtual network -func (client ServerFarmsClient) GetVnetFromServerFarm(resourceGroupName string, name string, vnetName string) (result VnetInfo, err error) { - req, err := client.GetVnetFromServerFarmPreparer(resourceGroupName, name, vnetName) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.ServerFarmsClient", "GetVnetFromServerFarm", nil, "Failure preparing request") - } - - resp, err := client.GetVnetFromServerFarmSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.ServerFarmsClient", "GetVnetFromServerFarm", resp, "Failure sending request") - } - - result, err = client.GetVnetFromServerFarmResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.ServerFarmsClient", "GetVnetFromServerFarm", resp, "Failure responding to request") - } - - return -} - -// GetVnetFromServerFarmPreparer prepares the GetVnetFromServerFarm request. -func (client ServerFarmsClient) GetVnetFromServerFarmPreparer(resourceGroupName string, name string, vnetName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vnetName": autorest.Encode("path", vnetName), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/virtualNetworkConnections/{vnetName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetVnetFromServerFarmSender sends the GetVnetFromServerFarm request. The method will close the -// http.Response Body if it receives an error. -func (client ServerFarmsClient) GetVnetFromServerFarmSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetVnetFromServerFarmResponder handles the response to the GetVnetFromServerFarm request. The method always -// closes the http.Response Body. -func (client ServerFarmsClient) GetVnetFromServerFarmResponder(resp *http.Response) (result VnetInfo, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNotFound), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetVnetsForServerFarm sends the get vnets for server farm request. -// -// resourceGroupName is name of resource group name is name of App Service Plan -func (client ServerFarmsClient) GetVnetsForServerFarm(resourceGroupName string, name string) (result ListVnetInfo, err error) { - req, err := client.GetVnetsForServerFarmPreparer(resourceGroupName, name) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.ServerFarmsClient", "GetVnetsForServerFarm", nil, "Failure preparing request") - } - - resp, err := client.GetVnetsForServerFarmSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.ServerFarmsClient", "GetVnetsForServerFarm", resp, "Failure sending request") - } - - result, err = client.GetVnetsForServerFarmResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.ServerFarmsClient", "GetVnetsForServerFarm", resp, "Failure responding to request") - } - - return -} - -// GetVnetsForServerFarmPreparer prepares the GetVnetsForServerFarm request. -func (client ServerFarmsClient) GetVnetsForServerFarmPreparer(resourceGroupName string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/virtualNetworkConnections", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetVnetsForServerFarmSender sends the GetVnetsForServerFarm request. The method will close the -// http.Response Body if it receives an error. -func (client ServerFarmsClient) GetVnetsForServerFarmSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetVnetsForServerFarmResponder handles the response to the GetVnetsForServerFarm request. The method always -// closes the http.Response Body. -func (client ServerFarmsClient) GetVnetsForServerFarmResponder(resp *http.Response) (result ListVnetInfo, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Value), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// RebootWorkerForServerFarm sends the reboot worker for server farm request. -// -// resourceGroupName is name of resource group name is name of server farm -// workerName is name of worker machine, typically starts with RD -func (client ServerFarmsClient) RebootWorkerForServerFarm(resourceGroupName string, name string, workerName string) (result SetObject, err error) { - req, err := client.RebootWorkerForServerFarmPreparer(resourceGroupName, name, workerName) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.ServerFarmsClient", "RebootWorkerForServerFarm", nil, "Failure preparing request") - } - - resp, err := client.RebootWorkerForServerFarmSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.ServerFarmsClient", "RebootWorkerForServerFarm", resp, "Failure sending request") - } - - result, err = client.RebootWorkerForServerFarmResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.ServerFarmsClient", "RebootWorkerForServerFarm", resp, "Failure responding to request") - } - - return -} - -// RebootWorkerForServerFarmPreparer prepares the RebootWorkerForServerFarm request. -func (client ServerFarmsClient) RebootWorkerForServerFarmPreparer(resourceGroupName string, name string, workerName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workerName": autorest.Encode("path", workerName), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/workers/{workerName}/reboot", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// RebootWorkerForServerFarmSender sends the RebootWorkerForServerFarm request. The method will close the -// http.Response Body if it receives an error. -func (client ServerFarmsClient) RebootWorkerForServerFarmSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// RebootWorkerForServerFarmResponder handles the response to the RebootWorkerForServerFarm request. The method always -// closes the http.Response Body. -func (client ServerFarmsClient) RebootWorkerForServerFarmResponder(resp *http.Response) (result SetObject, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Value), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// RestartSitesForServerFarm sends the restart sites for server farm request. -// -// resourceGroupName is name of resource group name is name of App Service Plan -// softRestart is soft restart applies the configuration settings and restarts -// the apps if necessary. Hard restart always restarts and reprovisions the -// apps -func (client ServerFarmsClient) RestartSitesForServerFarm(resourceGroupName string, name string, softRestart *bool) (result SetObject, err error) { - req, err := client.RestartSitesForServerFarmPreparer(resourceGroupName, name, softRestart) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.ServerFarmsClient", "RestartSitesForServerFarm", nil, "Failure preparing request") - } - - resp, err := client.RestartSitesForServerFarmSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.ServerFarmsClient", "RestartSitesForServerFarm", resp, "Failure sending request") - } - - result, err = client.RestartSitesForServerFarmResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.ServerFarmsClient", "RestartSitesForServerFarm", resp, "Failure responding to request") - } - - return -} - -// RestartSitesForServerFarmPreparer prepares the RestartSitesForServerFarm request. -func (client ServerFarmsClient) RestartSitesForServerFarmPreparer(resourceGroupName string, name string, softRestart *bool) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - if softRestart != nil { - queryParameters["softRestart"] = autorest.Encode("query", *softRestart) - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/restartSites", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// RestartSitesForServerFarmSender sends the RestartSitesForServerFarm request. The method will close the -// http.Response Body if it receives an error. -func (client ServerFarmsClient) RestartSitesForServerFarmSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// RestartSitesForServerFarmResponder handles the response to the RestartSitesForServerFarm request. The method always -// closes the http.Response Body. -func (client ServerFarmsClient) RestartSitesForServerFarmResponder(resp *http.Response) (result SetObject, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Value), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// UpdateServerFarmVnetGateway sends the update server farm vnet gateway -// request. -// -// resourceGroupName is the resource group name is the name of the App Service -// Plan vnetName is the name of the virtual network gatewayName is the name of -// the gateway. Only 'primary' is supported. connectionEnvelope is the gateway -// entity. -func (client ServerFarmsClient) UpdateServerFarmVnetGateway(resourceGroupName string, name string, vnetName string, gatewayName string, connectionEnvelope VnetGateway) (result VnetGateway, err error) { - req, err := client.UpdateServerFarmVnetGatewayPreparer(resourceGroupName, name, vnetName, gatewayName, connectionEnvelope) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.ServerFarmsClient", "UpdateServerFarmVnetGateway", nil, "Failure preparing request") - } - - resp, err := client.UpdateServerFarmVnetGatewaySender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.ServerFarmsClient", "UpdateServerFarmVnetGateway", resp, "Failure sending request") - } - - result, err = client.UpdateServerFarmVnetGatewayResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.ServerFarmsClient", "UpdateServerFarmVnetGateway", resp, "Failure responding to request") - } - - return -} - -// UpdateServerFarmVnetGatewayPreparer prepares the UpdateServerFarmVnetGateway request. -func (client ServerFarmsClient) UpdateServerFarmVnetGatewayPreparer(resourceGroupName string, name string, vnetName string, gatewayName string, connectionEnvelope VnetGateway) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "gatewayName": autorest.Encode("path", gatewayName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vnetName": autorest.Encode("path", vnetName), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/virtualNetworkConnections/{vnetName}/gateways/{gatewayName}", pathParameters), - autorest.WithJSON(connectionEnvelope), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// UpdateServerFarmVnetGatewaySender sends the UpdateServerFarmVnetGateway request. The method will close the -// http.Response Body if it receives an error. -func (client ServerFarmsClient) UpdateServerFarmVnetGatewaySender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// UpdateServerFarmVnetGatewayResponder handles the response to the UpdateServerFarmVnetGateway request. The method always -// closes the http.Response Body. -func (client ServerFarmsClient) UpdateServerFarmVnetGatewayResponder(resp *http.Response) (result VnetGateway, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// UpdateVnetRoute sends the update vnet route request. -// -// resourceGroupName is name of resource group name is name of App Service Plan -// vnetName is name of virtual network routeName is name of the virtual network -// route route is the route object -func (client ServerFarmsClient) UpdateVnetRoute(resourceGroupName string, name string, vnetName string, routeName string, route VnetRoute) (result VnetRoute, err error) { - req, err := client.UpdateVnetRoutePreparer(resourceGroupName, name, vnetName, routeName, route) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.ServerFarmsClient", "UpdateVnetRoute", nil, "Failure preparing request") - } - - resp, err := client.UpdateVnetRouteSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.ServerFarmsClient", "UpdateVnetRoute", resp, "Failure sending request") - } - - result, err = client.UpdateVnetRouteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.ServerFarmsClient", "UpdateVnetRoute", resp, "Failure responding to request") - } - - return -} - -// UpdateVnetRoutePreparer prepares the UpdateVnetRoute request. -func (client ServerFarmsClient) UpdateVnetRoutePreparer(resourceGroupName string, name string, vnetName string, routeName string, route VnetRoute) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "routeName": autorest.Encode("path", routeName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vnetName": autorest.Encode("path", vnetName), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/virtualNetworkConnections/{vnetName}/routes/{routeName}", pathParameters), - autorest.WithJSON(route), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// UpdateVnetRouteSender sends the UpdateVnetRoute request. The method will close the -// http.Response Body if it receives an error. -func (client ServerFarmsClient) UpdateVnetRouteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// UpdateVnetRouteResponder handles the response to the UpdateVnetRoute request. The method always -// closes the http.Response Body. -func (client ServerFarmsClient) UpdateVnetRouteResponder(resp *http.Response) (result VnetRoute, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusBadRequest, http.StatusNotFound), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/arm/web/sites.go b/arm/web/sites.go deleted file mode 100644 index bae51557cc3d..000000000000 --- a/arm/web/sites.go +++ /dev/null @@ -1,11239 +0,0 @@ -package web - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// -// See the License for the specific language governing permissions and -// limitations under the License. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// 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/azure" - "net/http" -) - -// SitesClient is the use these APIs to manage Azure Websites resources through -// the Azure Resource Manager. All task operations conform to the HTTP/1.1 -// protocol specification and each operation returns an x-ms-request-id header -// that can be used to obtain information about the request. You must make sure -// that requests made to these resources are secure. For more information, see -// https://msdn.microsoft.com/en-us/library/azure/dn790557.aspx. -type SitesClient struct { - ManagementClient -} - -// NewSitesClient creates an instance of the SitesClient client. -func NewSitesClient(subscriptionID string) SitesClient { - return NewSitesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewSitesClientWithBaseURI creates an instance of the SitesClient client. -func NewSitesClientWithBaseURI(baseURI string, subscriptionID string) SitesClient { - return SitesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// AddSitePremierAddOn sends the add site premier add on request. -// -func (client SitesClient) AddSitePremierAddOn(resourceGroupName string, name string, premierAddOnName string, premierAddOn PremierAddOnRequest) (result SetObject, err error) { - req, err := client.AddSitePremierAddOnPreparer(resourceGroupName, name, premierAddOnName, premierAddOn) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.SitesClient", "AddSitePremierAddOn", nil, "Failure preparing request") - } - - resp, err := client.AddSitePremierAddOnSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.SitesClient", "AddSitePremierAddOn", resp, "Failure sending request") - } - - result, err = client.AddSitePremierAddOnResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.SitesClient", "AddSitePremierAddOn", resp, "Failure responding to request") - } - - return -} - -// AddSitePremierAddOnPreparer prepares the AddSitePremierAddOn request. -func (client SitesClient) AddSitePremierAddOnPreparer(resourceGroupName string, name string, premierAddOnName string, premierAddOn PremierAddOnRequest) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "premierAddOnName": autorest.Encode("path", premierAddOnName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/premieraddons/{premierAddOnName}", pathParameters), - autorest.WithJSON(premierAddOn), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// AddSitePremierAddOnSender sends the AddSitePremierAddOn request. The method will close the -// http.Response Body if it receives an error. -func (client SitesClient) AddSitePremierAddOnSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// AddSitePremierAddOnResponder handles the response to the AddSitePremierAddOn request. The method always -// closes the http.Response Body. -func (client SitesClient) AddSitePremierAddOnResponder(resp *http.Response) (result SetObject, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Value), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// AddSitePremierAddOnSlot sends the add site premier add on slot request. -// -func (client SitesClient) AddSitePremierAddOnSlot(resourceGroupName string, name string, premierAddOnName string, premierAddOn PremierAddOnRequest, slot string) (result SetObject, err error) { - req, err := client.AddSitePremierAddOnSlotPreparer(resourceGroupName, name, premierAddOnName, premierAddOn, slot) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.SitesClient", "AddSitePremierAddOnSlot", nil, "Failure preparing request") - } - - resp, err := client.AddSitePremierAddOnSlotSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.SitesClient", "AddSitePremierAddOnSlot", resp, "Failure sending request") - } - - result, err = client.AddSitePremierAddOnSlotResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.SitesClient", "AddSitePremierAddOnSlot", resp, "Failure responding to request") - } - - return -} - -// AddSitePremierAddOnSlotPreparer prepares the AddSitePremierAddOnSlot request. -func (client SitesClient) AddSitePremierAddOnSlotPreparer(resourceGroupName string, name string, premierAddOnName string, premierAddOn PremierAddOnRequest, slot string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "premierAddOnName": autorest.Encode("path", premierAddOnName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "slot": autorest.Encode("path", slot), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/premieraddons/{premierAddOnName}", pathParameters), - autorest.WithJSON(premierAddOn), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// AddSitePremierAddOnSlotSender sends the AddSitePremierAddOnSlot request. The method will close the -// http.Response Body if it receives an error. -func (client SitesClient) AddSitePremierAddOnSlotSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// AddSitePremierAddOnSlotResponder handles the response to the AddSitePremierAddOnSlot request. The method always -// closes the http.Response Body. -func (client SitesClient) AddSitePremierAddOnSlotResponder(resp *http.Response) (result SetObject, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Value), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ApplySlotConfigSlot sends the apply slot config slot request. -// -// resourceGroupName is name of resource group name is name of web app -// slotSwapEntity is request body that contains the target slot name. Settings -// from that slot will be applied on the source slot slot is name of the source -// slot. Settings from the target slot will be applied onto this slot -func (client SitesClient) ApplySlotConfigSlot(resourceGroupName string, name string, slotSwapEntity CsmSlotEntity, slot string) (result SetObject, err error) { - req, err := client.ApplySlotConfigSlotPreparer(resourceGroupName, name, slotSwapEntity, slot) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.SitesClient", "ApplySlotConfigSlot", nil, "Failure preparing request") - } - - resp, err := client.ApplySlotConfigSlotSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.SitesClient", "ApplySlotConfigSlot", resp, "Failure sending request") - } - - result, err = client.ApplySlotConfigSlotResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.SitesClient", "ApplySlotConfigSlot", resp, "Failure responding to request") - } - - return -} - -// ApplySlotConfigSlotPreparer prepares the ApplySlotConfigSlot request. -func (client SitesClient) ApplySlotConfigSlotPreparer(resourceGroupName string, name string, slotSwapEntity CsmSlotEntity, slot string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "slot": autorest.Encode("path", slot), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/applySlotConfig", pathParameters), - autorest.WithJSON(slotSwapEntity), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ApplySlotConfigSlotSender sends the ApplySlotConfigSlot request. The method will close the -// http.Response Body if it receives an error. -func (client SitesClient) ApplySlotConfigSlotSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ApplySlotConfigSlotResponder handles the response to the ApplySlotConfigSlot request. The method always -// closes the http.Response Body. -func (client SitesClient) ApplySlotConfigSlotResponder(resp *http.Response) (result SetObject, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Value), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ApplySlotConfigToProduction sends the apply slot config to production -// request. -// -// resourceGroupName is name of resource group name is name of web app -// slotSwapEntity is request body that contains the target slot name. Settings -// from that slot will be applied on the source slot -func (client SitesClient) ApplySlotConfigToProduction(resourceGroupName string, name string, slotSwapEntity CsmSlotEntity) (result SetObject, err error) { - req, err := client.ApplySlotConfigToProductionPreparer(resourceGroupName, name, slotSwapEntity) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.SitesClient", "ApplySlotConfigToProduction", nil, "Failure preparing request") - } - - resp, err := client.ApplySlotConfigToProductionSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.SitesClient", "ApplySlotConfigToProduction", resp, "Failure sending request") - } - - result, err = client.ApplySlotConfigToProductionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.SitesClient", "ApplySlotConfigToProduction", resp, "Failure responding to request") - } - - return -} - -// ApplySlotConfigToProductionPreparer prepares the ApplySlotConfigToProduction request. -func (client SitesClient) ApplySlotConfigToProductionPreparer(resourceGroupName string, name string, slotSwapEntity CsmSlotEntity) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/applySlotConfig", pathParameters), - autorest.WithJSON(slotSwapEntity), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ApplySlotConfigToProductionSender sends the ApplySlotConfigToProduction request. The method will close the -// http.Response Body if it receives an error. -func (client SitesClient) ApplySlotConfigToProductionSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ApplySlotConfigToProductionResponder handles the response to the ApplySlotConfigToProduction request. The method always -// closes the http.Response Body. -func (client SitesClient) ApplySlotConfigToProductionResponder(resp *http.Response) (result SetObject, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Value), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// BackupSite sends the backup site request. -// -// resourceGroupName is name of resource group name is name of web app request -// is information on backup request -func (client SitesClient) BackupSite(resourceGroupName string, name string, request BackupRequest) (result BackupItem, err error) { - req, err := client.BackupSitePreparer(resourceGroupName, name, request) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.SitesClient", "BackupSite", nil, "Failure preparing request") - } - - resp, err := client.BackupSiteSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.SitesClient", "BackupSite", resp, "Failure sending request") - } - - result, err = client.BackupSiteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.SitesClient", "BackupSite", resp, "Failure responding to request") - } - - return -} - -// BackupSitePreparer prepares the BackupSite request. -func (client SitesClient) BackupSitePreparer(resourceGroupName string, name string, request BackupRequest) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/backup", pathParameters), - autorest.WithJSON(request), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// BackupSiteSender sends the BackupSite request. The method will close the -// http.Response Body if it receives an error. -func (client SitesClient) BackupSiteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// BackupSiteResponder handles the response to the BackupSite request. The method always -// closes the http.Response Body. -func (client SitesClient) BackupSiteResponder(resp *http.Response) (result BackupItem, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// BackupSiteSlot sends the backup site slot request. -// -// resourceGroupName is name of resource group name is name of web app request -// is information on backup request slot is name of web app slot. If not -// specified then will default to production slot. -func (client SitesClient) BackupSiteSlot(resourceGroupName string, name string, request BackupRequest, slot string) (result BackupItem, err error) { - req, err := client.BackupSiteSlotPreparer(resourceGroupName, name, request, slot) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.SitesClient", "BackupSiteSlot", nil, "Failure preparing request") - } - - resp, err := client.BackupSiteSlotSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.SitesClient", "BackupSiteSlot", resp, "Failure sending request") - } - - result, err = client.BackupSiteSlotResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.SitesClient", "BackupSiteSlot", resp, "Failure responding to request") - } - - return -} - -// BackupSiteSlotPreparer prepares the BackupSiteSlot request. -func (client SitesClient) BackupSiteSlotPreparer(resourceGroupName string, name string, request BackupRequest, slot string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "slot": autorest.Encode("path", slot), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/backup", pathParameters), - autorest.WithJSON(request), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// BackupSiteSlotSender sends the BackupSiteSlot request. The method will close the -// http.Response Body if it receives an error. -func (client SitesClient) BackupSiteSlotSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// BackupSiteSlotResponder handles the response to the BackupSiteSlot request. The method always -// closes the http.Response Body. -func (client SitesClient) BackupSiteSlotResponder(resp *http.Response) (result BackupItem, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// CreateDeployment sends the create deployment request. -// -// resourceGroupName is name of resource group name is name of web app id is id -// of the deployment deployment is details of deployment -func (client SitesClient) CreateDeployment(resourceGroupName string, name string, id string, deployment Deployment) (result Deployment, err error) { - req, err := client.CreateDeploymentPreparer(resourceGroupName, name, id, deployment) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.SitesClient", "CreateDeployment", nil, "Failure preparing request") - } - - resp, err := client.CreateDeploymentSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.SitesClient", "CreateDeployment", resp, "Failure sending request") - } - - result, err = client.CreateDeploymentResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.SitesClient", "CreateDeployment", resp, "Failure responding to request") - } - - return -} - -// CreateDeploymentPreparer prepares the CreateDeployment request. -func (client SitesClient) CreateDeploymentPreparer(resourceGroupName string, name string, id string, deployment Deployment) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "id": autorest.Encode("path", id), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/deployments/{id}", pathParameters), - autorest.WithJSON(deployment), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CreateDeploymentSender sends the CreateDeployment request. The method will close the -// http.Response Body if it receives an error. -func (client SitesClient) CreateDeploymentSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CreateDeploymentResponder handles the response to the CreateDeployment request. The method always -// closes the http.Response Body. -func (client SitesClient) CreateDeploymentResponder(resp *http.Response) (result Deployment, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// CreateDeploymentSlot sends the create deployment slot request. -// -// resourceGroupName is name of resource group name is name of web app id is id -// of the deployment slot is name of web app slot. If not specified then will -// default to production slot. deployment is details of deployment -func (client SitesClient) CreateDeploymentSlot(resourceGroupName string, name string, id string, slot string, deployment Deployment) (result Deployment, err error) { - req, err := client.CreateDeploymentSlotPreparer(resourceGroupName, name, id, slot, deployment) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.SitesClient", "CreateDeploymentSlot", nil, "Failure preparing request") - } - - resp, err := client.CreateDeploymentSlotSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.SitesClient", "CreateDeploymentSlot", resp, "Failure sending request") - } - - result, err = client.CreateDeploymentSlotResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.SitesClient", "CreateDeploymentSlot", resp, "Failure responding to request") - } - - return -} - -// CreateDeploymentSlotPreparer prepares the CreateDeploymentSlot request. -func (client SitesClient) CreateDeploymentSlotPreparer(resourceGroupName string, name string, id string, slot string, deployment Deployment) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "id": autorest.Encode("path", id), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "slot": autorest.Encode("path", slot), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/deployments/{id}", pathParameters), - autorest.WithJSON(deployment), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CreateDeploymentSlotSender sends the CreateDeploymentSlot request. The method will close the -// http.Response Body if it receives an error. -func (client SitesClient) CreateDeploymentSlotSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CreateDeploymentSlotResponder handles the response to the CreateDeploymentSlot request. The method always -// closes the http.Response Body. -func (client SitesClient) CreateDeploymentSlotResponder(resp *http.Response) (result Deployment, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// CreateInstanceDeployment sends the create instance deployment request. -// -// resourceGroupName is name of resource group name is name of web app id is id -// of the deployment instanceID is id of web app instance deployment is details -// of deployment -func (client SitesClient) CreateInstanceDeployment(resourceGroupName string, name string, id string, instanceID string, deployment Deployment) (result Deployment, err error) { - req, err := client.CreateInstanceDeploymentPreparer(resourceGroupName, name, id, instanceID, deployment) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.SitesClient", "CreateInstanceDeployment", nil, "Failure preparing request") - } - - resp, err := client.CreateInstanceDeploymentSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.SitesClient", "CreateInstanceDeployment", resp, "Failure sending request") - } - - result, err = client.CreateInstanceDeploymentResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.SitesClient", "CreateInstanceDeployment", resp, "Failure responding to request") - } - - return -} - -// CreateInstanceDeploymentPreparer prepares the CreateInstanceDeployment request. -func (client SitesClient) CreateInstanceDeploymentPreparer(resourceGroupName string, name string, id string, instanceID string, deployment Deployment) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "id": autorest.Encode("path", id), - "instanceId": autorest.Encode("path", instanceID), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/instances/{instanceId}/deployments/{id}", pathParameters), - autorest.WithJSON(deployment), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CreateInstanceDeploymentSender sends the CreateInstanceDeployment request. The method will close the -// http.Response Body if it receives an error. -func (client SitesClient) CreateInstanceDeploymentSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CreateInstanceDeploymentResponder handles the response to the CreateInstanceDeployment request. The method always -// closes the http.Response Body. -func (client SitesClient) CreateInstanceDeploymentResponder(resp *http.Response) (result Deployment, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// CreateInstanceDeploymentSlot sends the create instance deployment slot -// request. -// -// resourceGroupName is name of resource group name is name of web app id is id -// of the deployment slot is name of web app slot. If not specified then will -// default to production slot. instanceID is id of web app instance deployment -// is details of deployment -func (client SitesClient) CreateInstanceDeploymentSlot(resourceGroupName string, name string, id string, slot string, instanceID string, deployment Deployment) (result Deployment, err error) { - req, err := client.CreateInstanceDeploymentSlotPreparer(resourceGroupName, name, id, slot, instanceID, deployment) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.SitesClient", "CreateInstanceDeploymentSlot", nil, "Failure preparing request") - } - - resp, err := client.CreateInstanceDeploymentSlotSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.SitesClient", "CreateInstanceDeploymentSlot", resp, "Failure sending request") - } - - result, err = client.CreateInstanceDeploymentSlotResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.SitesClient", "CreateInstanceDeploymentSlot", resp, "Failure responding to request") - } - - return -} - -// CreateInstanceDeploymentSlotPreparer prepares the CreateInstanceDeploymentSlot request. -func (client SitesClient) CreateInstanceDeploymentSlotPreparer(resourceGroupName string, name string, id string, slot string, instanceID string, deployment Deployment) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "id": autorest.Encode("path", id), - "instanceId": autorest.Encode("path", instanceID), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "slot": autorest.Encode("path", slot), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/instances/{instanceId}/deployments/{id}", pathParameters), - autorest.WithJSON(deployment), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CreateInstanceDeploymentSlotSender sends the CreateInstanceDeploymentSlot request. The method will close the -// http.Response Body if it receives an error. -func (client SitesClient) CreateInstanceDeploymentSlotSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CreateInstanceDeploymentSlotResponder handles the response to the CreateInstanceDeploymentSlot request. The method always -// closes the http.Response Body. -func (client SitesClient) CreateInstanceDeploymentSlotResponder(resp *http.Response) (result Deployment, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// CreateOrUpdateSite sends the create or update site request. This method may -// poll for completion. Polling can be canceled by passing the cancel channel -// argument. The channel will be used to cancel polling and any outstanding -// HTTP requests. -// -// resourceGroupName is name of the resource group name is name of the web app -// siteEnvelope is details of web app if it exists already skipDNSRegistration -// is if true web app hostname is not registered with DNS on creation. This -// parameter is -// only used for app creation skipCustomDomainVerification is if true, custom -// (non *.azurewebsites.net) domains associated with web app are not verified. -// forceDNSRegistration is if true, web app hostname is force registered with -// DNS ttlInSeconds is time to live in seconds for web app's default domain -// name -func (client SitesClient) CreateOrUpdateSite(resourceGroupName string, name string, siteEnvelope Site, skipDNSRegistration string, skipCustomDomainVerification string, forceDNSRegistration string, ttlInSeconds string, cancel <-chan struct{}) (result autorest.Response, err error) { - req, err := client.CreateOrUpdateSitePreparer(resourceGroupName, name, siteEnvelope, skipDNSRegistration, skipCustomDomainVerification, forceDNSRegistration, ttlInSeconds, cancel) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.SitesClient", "CreateOrUpdateSite", nil, "Failure preparing request") - } - - resp, err := client.CreateOrUpdateSiteSender(req) - if err != nil { - result.Response = resp - return result, autorest.NewErrorWithError(err, "web.SitesClient", "CreateOrUpdateSite", resp, "Failure sending request") - } - - result, err = client.CreateOrUpdateSiteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.SitesClient", "CreateOrUpdateSite", resp, "Failure responding to request") - } - - return -} - -// CreateOrUpdateSitePreparer prepares the CreateOrUpdateSite request. -func (client SitesClient) CreateOrUpdateSitePreparer(resourceGroupName string, name string, siteEnvelope Site, skipDNSRegistration string, skipCustomDomainVerification string, forceDNSRegistration string, ttlInSeconds string, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - if len(skipDNSRegistration) > 0 { - queryParameters["skipDnsRegistration"] = autorest.Encode("query", skipDNSRegistration) - } - if len(skipCustomDomainVerification) > 0 { - queryParameters["skipCustomDomainVerification"] = autorest.Encode("query", skipCustomDomainVerification) - } - if len(forceDNSRegistration) > 0 { - queryParameters["forceDnsRegistration"] = autorest.Encode("query", forceDNSRegistration) - } - if len(ttlInSeconds) > 0 { - queryParameters["ttlInSeconds"] = autorest.Encode("query", ttlInSeconds) - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}", pathParameters), - autorest.WithJSON(siteEnvelope), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// CreateOrUpdateSiteSender sends the CreateOrUpdateSite request. The method will close the -// http.Response Body if it receives an error. -func (client SitesClient) CreateOrUpdateSiteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// CreateOrUpdateSiteResponder handles the response to the CreateOrUpdateSite request. The method always -// closes the http.Response Body. -func (client SitesClient) CreateOrUpdateSiteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} - -// CreateOrUpdateSiteConfig sends the create or update site config request. -// -// resourceGroupName is name of resource group name is name of web app -// siteConfig is request body that contains the configuraiton setting for the -// web app -func (client SitesClient) CreateOrUpdateSiteConfig(resourceGroupName string, name string, siteConfig SiteConfig) (result SiteConfig, err error) { - req, err := client.CreateOrUpdateSiteConfigPreparer(resourceGroupName, name, siteConfig) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.SitesClient", "CreateOrUpdateSiteConfig", nil, "Failure preparing request") - } - - resp, err := client.CreateOrUpdateSiteConfigSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.SitesClient", "CreateOrUpdateSiteConfig", resp, "Failure sending request") - } - - result, err = client.CreateOrUpdateSiteConfigResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.SitesClient", "CreateOrUpdateSiteConfig", resp, "Failure responding to request") - } - - return -} - -// CreateOrUpdateSiteConfigPreparer prepares the CreateOrUpdateSiteConfig request. -func (client SitesClient) CreateOrUpdateSiteConfigPreparer(resourceGroupName string, name string, siteConfig SiteConfig) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/web", pathParameters), - autorest.WithJSON(siteConfig), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CreateOrUpdateSiteConfigSender sends the CreateOrUpdateSiteConfig request. The method will close the -// http.Response Body if it receives an error. -func (client SitesClient) CreateOrUpdateSiteConfigSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CreateOrUpdateSiteConfigResponder handles the response to the CreateOrUpdateSiteConfig request. The method always -// closes the http.Response Body. -func (client SitesClient) CreateOrUpdateSiteConfigResponder(resp *http.Response) (result SiteConfig, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// CreateOrUpdateSiteConfigSlot sends the create or update site config slot -// request. -// -// resourceGroupName is name of resource group name is name of web app -// siteConfig is request body that contains the configuraiton setting for the -// web app slot is name of web app slot. If not specified then will default to -// production slot. -func (client SitesClient) CreateOrUpdateSiteConfigSlot(resourceGroupName string, name string, siteConfig SiteConfig, slot string) (result SiteConfig, err error) { - req, err := client.CreateOrUpdateSiteConfigSlotPreparer(resourceGroupName, name, siteConfig, slot) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.SitesClient", "CreateOrUpdateSiteConfigSlot", nil, "Failure preparing request") - } - - resp, err := client.CreateOrUpdateSiteConfigSlotSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.SitesClient", "CreateOrUpdateSiteConfigSlot", resp, "Failure sending request") - } - - result, err = client.CreateOrUpdateSiteConfigSlotResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.SitesClient", "CreateOrUpdateSiteConfigSlot", resp, "Failure responding to request") - } - - return -} - -// CreateOrUpdateSiteConfigSlotPreparer prepares the CreateOrUpdateSiteConfigSlot request. -func (client SitesClient) CreateOrUpdateSiteConfigSlotPreparer(resourceGroupName string, name string, siteConfig SiteConfig, slot string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "slot": autorest.Encode("path", slot), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/web", pathParameters), - autorest.WithJSON(siteConfig), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CreateOrUpdateSiteConfigSlotSender sends the CreateOrUpdateSiteConfigSlot request. The method will close the -// http.Response Body if it receives an error. -func (client SitesClient) CreateOrUpdateSiteConfigSlotSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CreateOrUpdateSiteConfigSlotResponder handles the response to the CreateOrUpdateSiteConfigSlot request. The method always -// closes the http.Response Body. -func (client SitesClient) CreateOrUpdateSiteConfigSlotResponder(resp *http.Response) (result SiteConfig, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// CreateOrUpdateSiteHostNameBinding sends the create or update site host name -// binding request. -// -// resourceGroupName is name of resource group name is name of web app hostName -// is name of host hostNameBinding is host name binding information -func (client SitesClient) CreateOrUpdateSiteHostNameBinding(resourceGroupName string, name string, hostName string, hostNameBinding HostNameBinding) (result HostNameBinding, err error) { - req, err := client.CreateOrUpdateSiteHostNameBindingPreparer(resourceGroupName, name, hostName, hostNameBinding) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.SitesClient", "CreateOrUpdateSiteHostNameBinding", nil, "Failure preparing request") - } - - resp, err := client.CreateOrUpdateSiteHostNameBindingSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.SitesClient", "CreateOrUpdateSiteHostNameBinding", resp, "Failure sending request") - } - - result, err = client.CreateOrUpdateSiteHostNameBindingResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.SitesClient", "CreateOrUpdateSiteHostNameBinding", resp, "Failure responding to request") - } - - return -} - -// CreateOrUpdateSiteHostNameBindingPreparer prepares the CreateOrUpdateSiteHostNameBinding request. -func (client SitesClient) CreateOrUpdateSiteHostNameBindingPreparer(resourceGroupName string, name string, hostName string, hostNameBinding HostNameBinding) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "hostName": autorest.Encode("path", hostName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/hostNameBindings/{hostName}", pathParameters), - autorest.WithJSON(hostNameBinding), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CreateOrUpdateSiteHostNameBindingSender sends the CreateOrUpdateSiteHostNameBinding request. The method will close the -// http.Response Body if it receives an error. -func (client SitesClient) CreateOrUpdateSiteHostNameBindingSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CreateOrUpdateSiteHostNameBindingResponder handles the response to the CreateOrUpdateSiteHostNameBinding request. The method always -// closes the http.Response Body. -func (client SitesClient) CreateOrUpdateSiteHostNameBindingResponder(resp *http.Response) (result HostNameBinding, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// CreateOrUpdateSiteHostNameBindingSlot sends the create or update site host -// name binding slot request. -// -// resourceGroupName is name of resource group name is name of web app hostName -// is name of host hostNameBinding is host name binding information slot is -// name of web app slot. If not specified then will default to production slot. -func (client SitesClient) CreateOrUpdateSiteHostNameBindingSlot(resourceGroupName string, name string, hostName string, hostNameBinding HostNameBinding, slot string) (result HostNameBinding, err error) { - req, err := client.CreateOrUpdateSiteHostNameBindingSlotPreparer(resourceGroupName, name, hostName, hostNameBinding, slot) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.SitesClient", "CreateOrUpdateSiteHostNameBindingSlot", nil, "Failure preparing request") - } - - resp, err := client.CreateOrUpdateSiteHostNameBindingSlotSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.SitesClient", "CreateOrUpdateSiteHostNameBindingSlot", resp, "Failure sending request") - } - - result, err = client.CreateOrUpdateSiteHostNameBindingSlotResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.SitesClient", "CreateOrUpdateSiteHostNameBindingSlot", resp, "Failure responding to request") - } - - return -} - -// CreateOrUpdateSiteHostNameBindingSlotPreparer prepares the CreateOrUpdateSiteHostNameBindingSlot request. -func (client SitesClient) CreateOrUpdateSiteHostNameBindingSlotPreparer(resourceGroupName string, name string, hostName string, hostNameBinding HostNameBinding, slot string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "hostName": autorest.Encode("path", hostName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "slot": autorest.Encode("path", slot), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/hostNameBindings/{hostName}", pathParameters), - autorest.WithJSON(hostNameBinding), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CreateOrUpdateSiteHostNameBindingSlotSender sends the CreateOrUpdateSiteHostNameBindingSlot request. The method will close the -// http.Response Body if it receives an error. -func (client SitesClient) CreateOrUpdateSiteHostNameBindingSlotSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CreateOrUpdateSiteHostNameBindingSlotResponder handles the response to the CreateOrUpdateSiteHostNameBindingSlot request. The method always -// closes the http.Response Body. -func (client SitesClient) CreateOrUpdateSiteHostNameBindingSlotResponder(resp *http.Response) (result HostNameBinding, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// CreateOrUpdateSiteRelayServiceConnection sends the create or update site -// relay service connection request. -// -// resourceGroupName is the resource group name name is the name of the web app -// entityName is the name by which the Hybrid Connection is identified -// connectionEnvelope is the details of the Hybrid Connection -func (client SitesClient) CreateOrUpdateSiteRelayServiceConnection(resourceGroupName string, name string, entityName string, connectionEnvelope RelayServiceConnectionEntity) (result RelayServiceConnectionEntity, err error) { - req, err := client.CreateOrUpdateSiteRelayServiceConnectionPreparer(resourceGroupName, name, entityName, connectionEnvelope) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.SitesClient", "CreateOrUpdateSiteRelayServiceConnection", nil, "Failure preparing request") - } - - resp, err := client.CreateOrUpdateSiteRelayServiceConnectionSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.SitesClient", "CreateOrUpdateSiteRelayServiceConnection", resp, "Failure sending request") - } - - result, err = client.CreateOrUpdateSiteRelayServiceConnectionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.SitesClient", "CreateOrUpdateSiteRelayServiceConnection", resp, "Failure responding to request") - } - - return -} - -// CreateOrUpdateSiteRelayServiceConnectionPreparer prepares the CreateOrUpdateSiteRelayServiceConnection request. -func (client SitesClient) CreateOrUpdateSiteRelayServiceConnectionPreparer(resourceGroupName string, name string, entityName string, connectionEnvelope RelayServiceConnectionEntity) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "entityName": autorest.Encode("path", entityName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/hybridconnection/{entityName}", pathParameters), - autorest.WithJSON(connectionEnvelope), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CreateOrUpdateSiteRelayServiceConnectionSender sends the CreateOrUpdateSiteRelayServiceConnection request. The method will close the -// http.Response Body if it receives an error. -func (client SitesClient) CreateOrUpdateSiteRelayServiceConnectionSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CreateOrUpdateSiteRelayServiceConnectionResponder handles the response to the CreateOrUpdateSiteRelayServiceConnection request. The method always -// closes the http.Response Body. -func (client SitesClient) CreateOrUpdateSiteRelayServiceConnectionResponder(resp *http.Response) (result RelayServiceConnectionEntity, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// CreateOrUpdateSiteRelayServiceConnectionSlot sends the create or update site -// relay service connection slot request. -// -// resourceGroupName is the resource group name name is the name of the web app -// entityName is the name by which the Hybrid Connection is identified -// connectionEnvelope is the details of the Hybrid Connection slot is the name -// of the slot for the web app. -func (client SitesClient) CreateOrUpdateSiteRelayServiceConnectionSlot(resourceGroupName string, name string, entityName string, connectionEnvelope RelayServiceConnectionEntity, slot string) (result RelayServiceConnectionEntity, err error) { - req, err := client.CreateOrUpdateSiteRelayServiceConnectionSlotPreparer(resourceGroupName, name, entityName, connectionEnvelope, slot) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.SitesClient", "CreateOrUpdateSiteRelayServiceConnectionSlot", nil, "Failure preparing request") - } - - resp, err := client.CreateOrUpdateSiteRelayServiceConnectionSlotSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.SitesClient", "CreateOrUpdateSiteRelayServiceConnectionSlot", resp, "Failure sending request") - } - - result, err = client.CreateOrUpdateSiteRelayServiceConnectionSlotResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.SitesClient", "CreateOrUpdateSiteRelayServiceConnectionSlot", resp, "Failure responding to request") - } - - return -} - -// CreateOrUpdateSiteRelayServiceConnectionSlotPreparer prepares the CreateOrUpdateSiteRelayServiceConnectionSlot request. -func (client SitesClient) CreateOrUpdateSiteRelayServiceConnectionSlotPreparer(resourceGroupName string, name string, entityName string, connectionEnvelope RelayServiceConnectionEntity, slot string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "entityName": autorest.Encode("path", entityName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "slot": autorest.Encode("path", slot), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/hybridconnection/{entityName}", pathParameters), - autorest.WithJSON(connectionEnvelope), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CreateOrUpdateSiteRelayServiceConnectionSlotSender sends the CreateOrUpdateSiteRelayServiceConnectionSlot request. The method will close the -// http.Response Body if it receives an error. -func (client SitesClient) CreateOrUpdateSiteRelayServiceConnectionSlotSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CreateOrUpdateSiteRelayServiceConnectionSlotResponder handles the response to the CreateOrUpdateSiteRelayServiceConnectionSlot request. The method always -// closes the http.Response Body. -func (client SitesClient) CreateOrUpdateSiteRelayServiceConnectionSlotResponder(resp *http.Response) (result RelayServiceConnectionEntity, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// CreateOrUpdateSiteSlot sends the create or update site slot request. This -// method may poll for completion. Polling can be canceled by passing the -// cancel channel argument. The channel will be used to cancel polling and any -// outstanding HTTP requests. -// -// resourceGroupName is name of the resource group name is name of the web app -// siteEnvelope is details of web app if it exists already slot is name of web -// app slot. If not specified then will default to production slot. -// skipDNSRegistration is if true web app hostname is not registered with DNS -// on creation. This parameter is -// only used for app creation skipCustomDomainVerification is if true, custom -// (non *.azurewebsites.net) domains associated with web app are not verified. -// forceDNSRegistration is if true, web app hostname is force registered with -// DNS ttlInSeconds is time to live in seconds for web app's default domain -// name -func (client SitesClient) CreateOrUpdateSiteSlot(resourceGroupName string, name string, siteEnvelope Site, slot string, skipDNSRegistration string, skipCustomDomainVerification string, forceDNSRegistration string, ttlInSeconds string, cancel <-chan struct{}) (result autorest.Response, err error) { - req, err := client.CreateOrUpdateSiteSlotPreparer(resourceGroupName, name, siteEnvelope, slot, skipDNSRegistration, skipCustomDomainVerification, forceDNSRegistration, ttlInSeconds, cancel) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.SitesClient", "CreateOrUpdateSiteSlot", nil, "Failure preparing request") - } - - resp, err := client.CreateOrUpdateSiteSlotSender(req) - if err != nil { - result.Response = resp - return result, autorest.NewErrorWithError(err, "web.SitesClient", "CreateOrUpdateSiteSlot", resp, "Failure sending request") - } - - result, err = client.CreateOrUpdateSiteSlotResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.SitesClient", "CreateOrUpdateSiteSlot", resp, "Failure responding to request") - } - - return -} - -// CreateOrUpdateSiteSlotPreparer prepares the CreateOrUpdateSiteSlot request. -func (client SitesClient) CreateOrUpdateSiteSlotPreparer(resourceGroupName string, name string, siteEnvelope Site, slot string, skipDNSRegistration string, skipCustomDomainVerification string, forceDNSRegistration string, ttlInSeconds string, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "slot": autorest.Encode("path", slot), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - if len(skipDNSRegistration) > 0 { - queryParameters["skipDnsRegistration"] = autorest.Encode("query", skipDNSRegistration) - } - if len(skipCustomDomainVerification) > 0 { - queryParameters["skipCustomDomainVerification"] = autorest.Encode("query", skipCustomDomainVerification) - } - if len(forceDNSRegistration) > 0 { - queryParameters["forceDnsRegistration"] = autorest.Encode("query", forceDNSRegistration) - } - if len(ttlInSeconds) > 0 { - queryParameters["ttlInSeconds"] = autorest.Encode("query", ttlInSeconds) - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}", pathParameters), - autorest.WithJSON(siteEnvelope), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// CreateOrUpdateSiteSlotSender sends the CreateOrUpdateSiteSlot request. The method will close the -// http.Response Body if it receives an error. -func (client SitesClient) CreateOrUpdateSiteSlotSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// CreateOrUpdateSiteSlotResponder handles the response to the CreateOrUpdateSiteSlot request. The method always -// closes the http.Response Body. -func (client SitesClient) CreateOrUpdateSiteSlotResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} - -// CreateOrUpdateSiteSourceControl sends the create or update site source -// control request. -// -// resourceGroupName is name of resource group name is name of web app -// siteSourceControl is request body that contains the source control -// parameters -func (client SitesClient) CreateOrUpdateSiteSourceControl(resourceGroupName string, name string, siteSourceControl SiteSourceControl) (result SiteSourceControl, err error) { - req, err := client.CreateOrUpdateSiteSourceControlPreparer(resourceGroupName, name, siteSourceControl) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.SitesClient", "CreateOrUpdateSiteSourceControl", nil, "Failure preparing request") - } - - resp, err := client.CreateOrUpdateSiteSourceControlSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.SitesClient", "CreateOrUpdateSiteSourceControl", resp, "Failure sending request") - } - - result, err = client.CreateOrUpdateSiteSourceControlResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.SitesClient", "CreateOrUpdateSiteSourceControl", resp, "Failure responding to request") - } - - return -} - -// CreateOrUpdateSiteSourceControlPreparer prepares the CreateOrUpdateSiteSourceControl request. -func (client SitesClient) CreateOrUpdateSiteSourceControlPreparer(resourceGroupName string, name string, siteSourceControl SiteSourceControl) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/sourcecontrols/web", pathParameters), - autorest.WithJSON(siteSourceControl), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CreateOrUpdateSiteSourceControlSender sends the CreateOrUpdateSiteSourceControl request. The method will close the -// http.Response Body if it receives an error. -func (client SitesClient) CreateOrUpdateSiteSourceControlSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CreateOrUpdateSiteSourceControlResponder handles the response to the CreateOrUpdateSiteSourceControl request. The method always -// closes the http.Response Body. -func (client SitesClient) CreateOrUpdateSiteSourceControlResponder(resp *http.Response) (result SiteSourceControl, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// CreateOrUpdateSiteSourceControlSlot sends the create or update site source -// control slot request. -// -// resourceGroupName is name of resource group name is name of web app -// siteSourceControl is request body that contains the source control -// parameters slot is name of web app slot. If not specified then will default -// to production slot. -func (client SitesClient) CreateOrUpdateSiteSourceControlSlot(resourceGroupName string, name string, siteSourceControl SiteSourceControl, slot string) (result SiteSourceControl, err error) { - req, err := client.CreateOrUpdateSiteSourceControlSlotPreparer(resourceGroupName, name, siteSourceControl, slot) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.SitesClient", "CreateOrUpdateSiteSourceControlSlot", nil, "Failure preparing request") - } - - resp, err := client.CreateOrUpdateSiteSourceControlSlotSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.SitesClient", "CreateOrUpdateSiteSourceControlSlot", resp, "Failure sending request") - } - - result, err = client.CreateOrUpdateSiteSourceControlSlotResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.SitesClient", "CreateOrUpdateSiteSourceControlSlot", resp, "Failure responding to request") - } - - return -} - -// CreateOrUpdateSiteSourceControlSlotPreparer prepares the CreateOrUpdateSiteSourceControlSlot request. -func (client SitesClient) CreateOrUpdateSiteSourceControlSlotPreparer(resourceGroupName string, name string, siteSourceControl SiteSourceControl, slot string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "slot": autorest.Encode("path", slot), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/sourcecontrols/web", pathParameters), - autorest.WithJSON(siteSourceControl), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CreateOrUpdateSiteSourceControlSlotSender sends the CreateOrUpdateSiteSourceControlSlot request. The method will close the -// http.Response Body if it receives an error. -func (client SitesClient) CreateOrUpdateSiteSourceControlSlotSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CreateOrUpdateSiteSourceControlSlotResponder handles the response to the CreateOrUpdateSiteSourceControlSlot request. The method always -// closes the http.Response Body. -func (client SitesClient) CreateOrUpdateSiteSourceControlSlotResponder(resp *http.Response) (result SiteSourceControl, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// CreateOrUpdateSiteVNETConnection sends the create or update site vnet -// connection request. -// -// resourceGroupName is the resource group name name is the name of the web app -// vnetName is the name of the Virtual Network connectionEnvelope is the -// properties of this Virtual Network Connection -func (client SitesClient) CreateOrUpdateSiteVNETConnection(resourceGroupName string, name string, vnetName string, connectionEnvelope VnetInfo) (result VnetInfo, err error) { - req, err := client.CreateOrUpdateSiteVNETConnectionPreparer(resourceGroupName, name, vnetName, connectionEnvelope) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.SitesClient", "CreateOrUpdateSiteVNETConnection", nil, "Failure preparing request") - } - - resp, err := client.CreateOrUpdateSiteVNETConnectionSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.SitesClient", "CreateOrUpdateSiteVNETConnection", resp, "Failure sending request") - } - - result, err = client.CreateOrUpdateSiteVNETConnectionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.SitesClient", "CreateOrUpdateSiteVNETConnection", resp, "Failure responding to request") - } - - return -} - -// CreateOrUpdateSiteVNETConnectionPreparer prepares the CreateOrUpdateSiteVNETConnection request. -func (client SitesClient) CreateOrUpdateSiteVNETConnectionPreparer(resourceGroupName string, name string, vnetName string, connectionEnvelope VnetInfo) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vnetName": autorest.Encode("path", vnetName), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/virtualNetworkConnections/{vnetName}", pathParameters), - autorest.WithJSON(connectionEnvelope), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CreateOrUpdateSiteVNETConnectionSender sends the CreateOrUpdateSiteVNETConnection request. The method will close the -// http.Response Body if it receives an error. -func (client SitesClient) CreateOrUpdateSiteVNETConnectionSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CreateOrUpdateSiteVNETConnectionResponder handles the response to the CreateOrUpdateSiteVNETConnection request. The method always -// closes the http.Response Body. -func (client SitesClient) CreateOrUpdateSiteVNETConnectionResponder(resp *http.Response) (result VnetInfo, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// CreateOrUpdateSiteVNETConnectionGateway sends the create or update site vnet -// connection gateway request. -// -// resourceGroupName is the resource group name name is the name of the web app -// vnetName is the name of the Virtual Network gatewayName is the name of the -// gateway. The only gateway that exists presently is "primary" -// connectionEnvelope is the properties to update this gateway with. -func (client SitesClient) CreateOrUpdateSiteVNETConnectionGateway(resourceGroupName string, name string, vnetName string, gatewayName string, connectionEnvelope VnetGateway) (result VnetGateway, err error) { - req, err := client.CreateOrUpdateSiteVNETConnectionGatewayPreparer(resourceGroupName, name, vnetName, gatewayName, connectionEnvelope) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.SitesClient", "CreateOrUpdateSiteVNETConnectionGateway", nil, "Failure preparing request") - } - - resp, err := client.CreateOrUpdateSiteVNETConnectionGatewaySender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.SitesClient", "CreateOrUpdateSiteVNETConnectionGateway", resp, "Failure sending request") - } - - result, err = client.CreateOrUpdateSiteVNETConnectionGatewayResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.SitesClient", "CreateOrUpdateSiteVNETConnectionGateway", resp, "Failure responding to request") - } - - return -} - -// CreateOrUpdateSiteVNETConnectionGatewayPreparer prepares the CreateOrUpdateSiteVNETConnectionGateway request. -func (client SitesClient) CreateOrUpdateSiteVNETConnectionGatewayPreparer(resourceGroupName string, name string, vnetName string, gatewayName string, connectionEnvelope VnetGateway) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "gatewayName": autorest.Encode("path", gatewayName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vnetName": autorest.Encode("path", vnetName), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/virtualNetworkConnections/{vnetName}/gateways/{gatewayName}", pathParameters), - autorest.WithJSON(connectionEnvelope), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CreateOrUpdateSiteVNETConnectionGatewaySender sends the CreateOrUpdateSiteVNETConnectionGateway request. The method will close the -// http.Response Body if it receives an error. -func (client SitesClient) CreateOrUpdateSiteVNETConnectionGatewaySender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CreateOrUpdateSiteVNETConnectionGatewayResponder handles the response to the CreateOrUpdateSiteVNETConnectionGateway request. The method always -// closes the http.Response Body. -func (client SitesClient) CreateOrUpdateSiteVNETConnectionGatewayResponder(resp *http.Response) (result VnetGateway, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// CreateOrUpdateSiteVNETConnectionGatewaySlot sends the create or update site -// vnet connection gateway slot request. -// -// resourceGroupName is the resource group name name is the name of the web app -// vnetName is the name of the Virtual Network gatewayName is the name of the -// gateway. The only gateway that exists presently is "primary" -// connectionEnvelope is the properties to update this gateway with. slot is -// the name of the slot for this web app. -func (client SitesClient) CreateOrUpdateSiteVNETConnectionGatewaySlot(resourceGroupName string, name string, vnetName string, gatewayName string, connectionEnvelope VnetGateway, slot string) (result VnetGateway, err error) { - req, err := client.CreateOrUpdateSiteVNETConnectionGatewaySlotPreparer(resourceGroupName, name, vnetName, gatewayName, connectionEnvelope, slot) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.SitesClient", "CreateOrUpdateSiteVNETConnectionGatewaySlot", nil, "Failure preparing request") - } - - resp, err := client.CreateOrUpdateSiteVNETConnectionGatewaySlotSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.SitesClient", "CreateOrUpdateSiteVNETConnectionGatewaySlot", resp, "Failure sending request") - } - - result, err = client.CreateOrUpdateSiteVNETConnectionGatewaySlotResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.SitesClient", "CreateOrUpdateSiteVNETConnectionGatewaySlot", resp, "Failure responding to request") - } - - return -} - -// CreateOrUpdateSiteVNETConnectionGatewaySlotPreparer prepares the CreateOrUpdateSiteVNETConnectionGatewaySlot request. -func (client SitesClient) CreateOrUpdateSiteVNETConnectionGatewaySlotPreparer(resourceGroupName string, name string, vnetName string, gatewayName string, connectionEnvelope VnetGateway, slot string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "gatewayName": autorest.Encode("path", gatewayName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "slot": autorest.Encode("path", slot), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vnetName": autorest.Encode("path", vnetName), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/virtualNetworkConnections/{vnetName}/gateways/{gatewayName}", pathParameters), - autorest.WithJSON(connectionEnvelope), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CreateOrUpdateSiteVNETConnectionGatewaySlotSender sends the CreateOrUpdateSiteVNETConnectionGatewaySlot request. The method will close the -// http.Response Body if it receives an error. -func (client SitesClient) CreateOrUpdateSiteVNETConnectionGatewaySlotSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CreateOrUpdateSiteVNETConnectionGatewaySlotResponder handles the response to the CreateOrUpdateSiteVNETConnectionGatewaySlot request. The method always -// closes the http.Response Body. -func (client SitesClient) CreateOrUpdateSiteVNETConnectionGatewaySlotResponder(resp *http.Response) (result VnetGateway, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// CreateOrUpdateSiteVNETConnectionSlot sends the create or update site vnet -// connection slot request. -// -// resourceGroupName is the resource group name name is the name of the web app -// vnetName is the name of the Virtual Network connectionEnvelope is the -// properties of this Virtual Network Connection slot is the name of the slot -// for this web app. -func (client SitesClient) CreateOrUpdateSiteVNETConnectionSlot(resourceGroupName string, name string, vnetName string, connectionEnvelope VnetInfo, slot string) (result VnetInfo, err error) { - req, err := client.CreateOrUpdateSiteVNETConnectionSlotPreparer(resourceGroupName, name, vnetName, connectionEnvelope, slot) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.SitesClient", "CreateOrUpdateSiteVNETConnectionSlot", nil, "Failure preparing request") - } - - resp, err := client.CreateOrUpdateSiteVNETConnectionSlotSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.SitesClient", "CreateOrUpdateSiteVNETConnectionSlot", resp, "Failure sending request") - } - - result, err = client.CreateOrUpdateSiteVNETConnectionSlotResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.SitesClient", "CreateOrUpdateSiteVNETConnectionSlot", resp, "Failure responding to request") - } - - return -} - -// CreateOrUpdateSiteVNETConnectionSlotPreparer prepares the CreateOrUpdateSiteVNETConnectionSlot request. -func (client SitesClient) CreateOrUpdateSiteVNETConnectionSlotPreparer(resourceGroupName string, name string, vnetName string, connectionEnvelope VnetInfo, slot string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "slot": autorest.Encode("path", slot), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vnetName": autorest.Encode("path", vnetName), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/virtualNetworkConnections/{vnetName}", pathParameters), - autorest.WithJSON(connectionEnvelope), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CreateOrUpdateSiteVNETConnectionSlotSender sends the CreateOrUpdateSiteVNETConnectionSlot request. The method will close the -// http.Response Body if it receives an error. -func (client SitesClient) CreateOrUpdateSiteVNETConnectionSlotSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CreateOrUpdateSiteVNETConnectionSlotResponder handles the response to the CreateOrUpdateSiteVNETConnectionSlot request. The method always -// closes the http.Response Body. -func (client SitesClient) CreateOrUpdateSiteVNETConnectionSlotResponder(resp *http.Response) (result VnetInfo, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// DeleteBackup sends the delete backup request. -// -// resourceGroupName is name of resource group name is name of web app backupID -// is id of backup -func (client SitesClient) DeleteBackup(resourceGroupName string, name string, backupID string) (result BackupItem, err error) { - req, err := client.DeleteBackupPreparer(resourceGroupName, name, backupID) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.SitesClient", "DeleteBackup", nil, "Failure preparing request") - } - - resp, err := client.DeleteBackupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.SitesClient", "DeleteBackup", resp, "Failure sending request") - } - - result, err = client.DeleteBackupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.SitesClient", "DeleteBackup", resp, "Failure responding to request") - } - - return -} - -// DeleteBackupPreparer prepares the DeleteBackup request. -func (client SitesClient) DeleteBackupPreparer(resourceGroupName string, name string, backupID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "backupId": autorest.Encode("path", backupID), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/backups/{backupId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// DeleteBackupSender sends the DeleteBackup request. The method will close the -// http.Response Body if it receives an error. -func (client SitesClient) DeleteBackupSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DeleteBackupResponder handles the response to the DeleteBackup request. The method always -// closes the http.Response Body. -func (client SitesClient) DeleteBackupResponder(resp *http.Response) (result BackupItem, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// DeleteBackupSlot sends the delete backup slot request. -// -// resourceGroupName is name of resource group name is name of web app backupID -// is id of backup slot is name of web app slot. If not specified then will -// default to production slot. -func (client SitesClient) DeleteBackupSlot(resourceGroupName string, name string, backupID string, slot string) (result BackupItem, err error) { - req, err := client.DeleteBackupSlotPreparer(resourceGroupName, name, backupID, slot) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.SitesClient", "DeleteBackupSlot", nil, "Failure preparing request") - } - - resp, err := client.DeleteBackupSlotSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.SitesClient", "DeleteBackupSlot", resp, "Failure sending request") - } - - result, err = client.DeleteBackupSlotResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.SitesClient", "DeleteBackupSlot", resp, "Failure responding to request") - } - - return -} - -// DeleteBackupSlotPreparer prepares the DeleteBackupSlot request. -func (client SitesClient) DeleteBackupSlotPreparer(resourceGroupName string, name string, backupID string, slot string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "backupId": autorest.Encode("path", backupID), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "slot": autorest.Encode("path", slot), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/backups/{backupId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// DeleteBackupSlotSender sends the DeleteBackupSlot request. The method will close the -// http.Response Body if it receives an error. -func (client SitesClient) DeleteBackupSlotSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DeleteBackupSlotResponder handles the response to the DeleteBackupSlot request. The method always -// closes the http.Response Body. -func (client SitesClient) DeleteBackupSlotResponder(resp *http.Response) (result BackupItem, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// DeleteDeployment sends the delete deployment request. -// -// resourceGroupName is name of resource group name is name of web app id is id -// of the deployment -func (client SitesClient) DeleteDeployment(resourceGroupName string, name string, id string) (result SetObject, err error) { - req, err := client.DeleteDeploymentPreparer(resourceGroupName, name, id) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.SitesClient", "DeleteDeployment", nil, "Failure preparing request") - } - - resp, err := client.DeleteDeploymentSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.SitesClient", "DeleteDeployment", resp, "Failure sending request") - } - - result, err = client.DeleteDeploymentResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.SitesClient", "DeleteDeployment", resp, "Failure responding to request") - } - - return -} - -// DeleteDeploymentPreparer prepares the DeleteDeployment request. -func (client SitesClient) DeleteDeploymentPreparer(resourceGroupName string, name string, id string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "id": autorest.Encode("path", id), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/deployments/{id}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// DeleteDeploymentSender sends the DeleteDeployment request. The method will close the -// http.Response Body if it receives an error. -func (client SitesClient) DeleteDeploymentSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DeleteDeploymentResponder handles the response to the DeleteDeployment request. The method always -// closes the http.Response Body. -func (client SitesClient) DeleteDeploymentResponder(resp *http.Response) (result SetObject, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Value), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// DeleteDeploymentSlot sends the delete deployment slot request. -// -// resourceGroupName is name of resource group name is name of web app id is id -// of the deployment slot is name of web app slot. If not specified then will -// default to production slot. -func (client SitesClient) DeleteDeploymentSlot(resourceGroupName string, name string, id string, slot string) (result SetObject, err error) { - req, err := client.DeleteDeploymentSlotPreparer(resourceGroupName, name, id, slot) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.SitesClient", "DeleteDeploymentSlot", nil, "Failure preparing request") - } - - resp, err := client.DeleteDeploymentSlotSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.SitesClient", "DeleteDeploymentSlot", resp, "Failure sending request") - } - - result, err = client.DeleteDeploymentSlotResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.SitesClient", "DeleteDeploymentSlot", resp, "Failure responding to request") - } - - return -} - -// DeleteDeploymentSlotPreparer prepares the DeleteDeploymentSlot request. -func (client SitesClient) DeleteDeploymentSlotPreparer(resourceGroupName string, name string, id string, slot string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "id": autorest.Encode("path", id), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "slot": autorest.Encode("path", slot), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/deployments/{id}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// DeleteDeploymentSlotSender sends the DeleteDeploymentSlot request. The method will close the -// http.Response Body if it receives an error. -func (client SitesClient) DeleteDeploymentSlotSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DeleteDeploymentSlotResponder handles the response to the DeleteDeploymentSlot request. The method always -// closes the http.Response Body. -func (client SitesClient) DeleteDeploymentSlotResponder(resp *http.Response) (result SetObject, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Value), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// DeleteInstanceDeployment sends the delete instance deployment request. -// -// resourceGroupName is name of resource group name is name of web app id is id -// of the deployment instanceID is id of web app instance -func (client SitesClient) DeleteInstanceDeployment(resourceGroupName string, name string, id string, instanceID string) (result SetObject, err error) { - req, err := client.DeleteInstanceDeploymentPreparer(resourceGroupName, name, id, instanceID) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.SitesClient", "DeleteInstanceDeployment", nil, "Failure preparing request") - } - - resp, err := client.DeleteInstanceDeploymentSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.SitesClient", "DeleteInstanceDeployment", resp, "Failure sending request") - } - - result, err = client.DeleteInstanceDeploymentResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.SitesClient", "DeleteInstanceDeployment", resp, "Failure responding to request") - } - - return -} - -// DeleteInstanceDeploymentPreparer prepares the DeleteInstanceDeployment request. -func (client SitesClient) DeleteInstanceDeploymentPreparer(resourceGroupName string, name string, id string, instanceID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "id": autorest.Encode("path", id), - "instanceId": autorest.Encode("path", instanceID), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/instances/{instanceId}/deployments/{id}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// DeleteInstanceDeploymentSender sends the DeleteInstanceDeployment request. The method will close the -// http.Response Body if it receives an error. -func (client SitesClient) DeleteInstanceDeploymentSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DeleteInstanceDeploymentResponder handles the response to the DeleteInstanceDeployment request. The method always -// closes the http.Response Body. -func (client SitesClient) DeleteInstanceDeploymentResponder(resp *http.Response) (result SetObject, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Value), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// DeleteInstanceDeploymentSlot sends the delete instance deployment slot -// request. -// -// resourceGroupName is name of resource group name is name of web app id is id -// of the deployment slot is name of web app slot. If not specified then will -// default to production slot. instanceID is id of web app instance -func (client SitesClient) DeleteInstanceDeploymentSlot(resourceGroupName string, name string, id string, slot string, instanceID string) (result SetObject, err error) { - req, err := client.DeleteInstanceDeploymentSlotPreparer(resourceGroupName, name, id, slot, instanceID) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.SitesClient", "DeleteInstanceDeploymentSlot", nil, "Failure preparing request") - } - - resp, err := client.DeleteInstanceDeploymentSlotSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.SitesClient", "DeleteInstanceDeploymentSlot", resp, "Failure sending request") - } - - result, err = client.DeleteInstanceDeploymentSlotResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.SitesClient", "DeleteInstanceDeploymentSlot", resp, "Failure responding to request") - } - - return -} - -// DeleteInstanceDeploymentSlotPreparer prepares the DeleteInstanceDeploymentSlot request. -func (client SitesClient) DeleteInstanceDeploymentSlotPreparer(resourceGroupName string, name string, id string, slot string, instanceID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "id": autorest.Encode("path", id), - "instanceId": autorest.Encode("path", instanceID), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "slot": autorest.Encode("path", slot), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/instances/{instanceId}/deployments/{id}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// DeleteInstanceDeploymentSlotSender sends the DeleteInstanceDeploymentSlot request. The method will close the -// http.Response Body if it receives an error. -func (client SitesClient) DeleteInstanceDeploymentSlotSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DeleteInstanceDeploymentSlotResponder handles the response to the DeleteInstanceDeploymentSlot request. The method always -// closes the http.Response Body. -func (client SitesClient) DeleteInstanceDeploymentSlotResponder(resp *http.Response) (result SetObject, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Value), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// DeleteSite sends the delete site request. -// -// resourceGroupName is name of resource group name is name of web app -// deleteMetrics is if true, web app metrics are also deleted -// deleteEmptyServerFarm is if true and App Service Plan is empty after web app -// deletion, App Service Plan is also deleted skipDNSRegistration is if true, -// DNS registration is skipped deleteAllSlots is if true, all slots associated -// with web app are also deleted -func (client SitesClient) DeleteSite(resourceGroupName string, name string, deleteMetrics string, deleteEmptyServerFarm string, skipDNSRegistration string, deleteAllSlots string) (result SetObject, err error) { - req, err := client.DeleteSitePreparer(resourceGroupName, name, deleteMetrics, deleteEmptyServerFarm, skipDNSRegistration, deleteAllSlots) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.SitesClient", "DeleteSite", nil, "Failure preparing request") - } - - resp, err := client.DeleteSiteSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.SitesClient", "DeleteSite", resp, "Failure sending request") - } - - result, err = client.DeleteSiteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.SitesClient", "DeleteSite", resp, "Failure responding to request") - } - - return -} - -// DeleteSitePreparer prepares the DeleteSite request. -func (client SitesClient) DeleteSitePreparer(resourceGroupName string, name string, deleteMetrics string, deleteEmptyServerFarm string, skipDNSRegistration string, deleteAllSlots string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - if len(deleteMetrics) > 0 { - queryParameters["deleteMetrics"] = autorest.Encode("query", deleteMetrics) - } - if len(deleteEmptyServerFarm) > 0 { - queryParameters["deleteEmptyServerFarm"] = autorest.Encode("query", deleteEmptyServerFarm) - } - if len(skipDNSRegistration) > 0 { - queryParameters["skipDnsRegistration"] = autorest.Encode("query", skipDNSRegistration) - } - if len(deleteAllSlots) > 0 { - queryParameters["deleteAllSlots"] = autorest.Encode("query", deleteAllSlots) - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// DeleteSiteSender sends the DeleteSite request. The method will close the -// http.Response Body if it receives an error. -func (client SitesClient) DeleteSiteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DeleteSiteResponder handles the response to the DeleteSite request. The method always -// closes the http.Response Body. -func (client SitesClient) DeleteSiteResponder(resp *http.Response) (result SetObject, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Value), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// DeleteSiteHostNameBinding sends the delete site host name binding request. -// -// resourceGroupName is name of resource group name is name of web app hostName -// is name of host -func (client SitesClient) DeleteSiteHostNameBinding(resourceGroupName string, name string, hostName string) (result SetObject, err error) { - req, err := client.DeleteSiteHostNameBindingPreparer(resourceGroupName, name, hostName) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.SitesClient", "DeleteSiteHostNameBinding", nil, "Failure preparing request") - } - - resp, err := client.DeleteSiteHostNameBindingSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.SitesClient", "DeleteSiteHostNameBinding", resp, "Failure sending request") - } - - result, err = client.DeleteSiteHostNameBindingResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.SitesClient", "DeleteSiteHostNameBinding", resp, "Failure responding to request") - } - - return -} - -// DeleteSiteHostNameBindingPreparer prepares the DeleteSiteHostNameBinding request. -func (client SitesClient) DeleteSiteHostNameBindingPreparer(resourceGroupName string, name string, hostName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "hostName": autorest.Encode("path", hostName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/hostNameBindings/{hostName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// DeleteSiteHostNameBindingSender sends the DeleteSiteHostNameBinding request. The method will close the -// http.Response Body if it receives an error. -func (client SitesClient) DeleteSiteHostNameBindingSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DeleteSiteHostNameBindingResponder handles the response to the DeleteSiteHostNameBinding request. The method always -// closes the http.Response Body. -func (client SitesClient) DeleteSiteHostNameBindingResponder(resp *http.Response) (result SetObject, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Value), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// DeleteSiteHostNameBindingSlot sends the delete site host name binding slot -// request. -// -// resourceGroupName is name of resource group name is name of web app slot is -// name of web app slot. If not specified then will default to production slot. -// hostName is name of host -func (client SitesClient) DeleteSiteHostNameBindingSlot(resourceGroupName string, name string, slot string, hostName string) (result SetObject, err error) { - req, err := client.DeleteSiteHostNameBindingSlotPreparer(resourceGroupName, name, slot, hostName) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.SitesClient", "DeleteSiteHostNameBindingSlot", nil, "Failure preparing request") - } - - resp, err := client.DeleteSiteHostNameBindingSlotSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.SitesClient", "DeleteSiteHostNameBindingSlot", resp, "Failure sending request") - } - - result, err = client.DeleteSiteHostNameBindingSlotResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.SitesClient", "DeleteSiteHostNameBindingSlot", resp, "Failure responding to request") - } - - return -} - -// DeleteSiteHostNameBindingSlotPreparer prepares the DeleteSiteHostNameBindingSlot request. -func (client SitesClient) DeleteSiteHostNameBindingSlotPreparer(resourceGroupName string, name string, slot string, hostName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "hostName": autorest.Encode("path", hostName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "slot": autorest.Encode("path", slot), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/hostNameBindings/{hostName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// DeleteSiteHostNameBindingSlotSender sends the DeleteSiteHostNameBindingSlot request. The method will close the -// http.Response Body if it receives an error. -func (client SitesClient) DeleteSiteHostNameBindingSlotSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DeleteSiteHostNameBindingSlotResponder handles the response to the DeleteSiteHostNameBindingSlot request. The method always -// closes the http.Response Body. -func (client SitesClient) DeleteSiteHostNameBindingSlotResponder(resp *http.Response) (result SetObject, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Value), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// DeleteSitePremierAddOn sends the delete site premier add on request. -// -func (client SitesClient) DeleteSitePremierAddOn(resourceGroupName string, name string, premierAddOnName string) (result SetObject, err error) { - req, err := client.DeleteSitePremierAddOnPreparer(resourceGroupName, name, premierAddOnName) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.SitesClient", "DeleteSitePremierAddOn", nil, "Failure preparing request") - } - - resp, err := client.DeleteSitePremierAddOnSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.SitesClient", "DeleteSitePremierAddOn", resp, "Failure sending request") - } - - result, err = client.DeleteSitePremierAddOnResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.SitesClient", "DeleteSitePremierAddOn", resp, "Failure responding to request") - } - - return -} - -// DeleteSitePremierAddOnPreparer prepares the DeleteSitePremierAddOn request. -func (client SitesClient) DeleteSitePremierAddOnPreparer(resourceGroupName string, name string, premierAddOnName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "premierAddOnName": autorest.Encode("path", premierAddOnName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/premieraddons/{premierAddOnName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// DeleteSitePremierAddOnSender sends the DeleteSitePremierAddOn request. The method will close the -// http.Response Body if it receives an error. -func (client SitesClient) DeleteSitePremierAddOnSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DeleteSitePremierAddOnResponder handles the response to the DeleteSitePremierAddOn request. The method always -// closes the http.Response Body. -func (client SitesClient) DeleteSitePremierAddOnResponder(resp *http.Response) (result SetObject, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Value), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// DeleteSitePremierAddOnSlot sends the delete site premier add on slot -// request. -// -func (client SitesClient) DeleteSitePremierAddOnSlot(resourceGroupName string, name string, premierAddOnName string, slot string) (result SetObject, err error) { - req, err := client.DeleteSitePremierAddOnSlotPreparer(resourceGroupName, name, premierAddOnName, slot) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.SitesClient", "DeleteSitePremierAddOnSlot", nil, "Failure preparing request") - } - - resp, err := client.DeleteSitePremierAddOnSlotSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.SitesClient", "DeleteSitePremierAddOnSlot", resp, "Failure sending request") - } - - result, err = client.DeleteSitePremierAddOnSlotResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.SitesClient", "DeleteSitePremierAddOnSlot", resp, "Failure responding to request") - } - - return -} - -// DeleteSitePremierAddOnSlotPreparer prepares the DeleteSitePremierAddOnSlot request. -func (client SitesClient) DeleteSitePremierAddOnSlotPreparer(resourceGroupName string, name string, premierAddOnName string, slot string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "premierAddOnName": autorest.Encode("path", premierAddOnName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "slot": autorest.Encode("path", slot), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/premieraddons/{premierAddOnName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// DeleteSitePremierAddOnSlotSender sends the DeleteSitePremierAddOnSlot request. The method will close the -// http.Response Body if it receives an error. -func (client SitesClient) DeleteSitePremierAddOnSlotSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DeleteSitePremierAddOnSlotResponder handles the response to the DeleteSitePremierAddOnSlot request. The method always -// closes the http.Response Body. -func (client SitesClient) DeleteSitePremierAddOnSlotResponder(resp *http.Response) (result SetObject, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Value), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// DeleteSiteRelayServiceConnection sends the delete site relay service -// connection request. -// -// resourceGroupName is the resource group name name is the name of the web app -// entityName is the name by which the Hybrid Connection is identified -func (client SitesClient) DeleteSiteRelayServiceConnection(resourceGroupName string, name string, entityName string) (result SetObject, err error) { - req, err := client.DeleteSiteRelayServiceConnectionPreparer(resourceGroupName, name, entityName) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.SitesClient", "DeleteSiteRelayServiceConnection", nil, "Failure preparing request") - } - - resp, err := client.DeleteSiteRelayServiceConnectionSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.SitesClient", "DeleteSiteRelayServiceConnection", resp, "Failure sending request") - } - - result, err = client.DeleteSiteRelayServiceConnectionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.SitesClient", "DeleteSiteRelayServiceConnection", resp, "Failure responding to request") - } - - return -} - -// DeleteSiteRelayServiceConnectionPreparer prepares the DeleteSiteRelayServiceConnection request. -func (client SitesClient) DeleteSiteRelayServiceConnectionPreparer(resourceGroupName string, name string, entityName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "entityName": autorest.Encode("path", entityName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/hybridconnection/{entityName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// DeleteSiteRelayServiceConnectionSender sends the DeleteSiteRelayServiceConnection request. The method will close the -// http.Response Body if it receives an error. -func (client SitesClient) DeleteSiteRelayServiceConnectionSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DeleteSiteRelayServiceConnectionResponder handles the response to the DeleteSiteRelayServiceConnection request. The method always -// closes the http.Response Body. -func (client SitesClient) DeleteSiteRelayServiceConnectionResponder(resp *http.Response) (result SetObject, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Value), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// DeleteSiteRelayServiceConnectionSlot sends the delete site relay service -// connection slot request. -// -// resourceGroupName is the resource group name name is the name of the web app -// entityName is the name by which the Hybrid Connection is identified slot is -// the name of the slot for the web app. -func (client SitesClient) DeleteSiteRelayServiceConnectionSlot(resourceGroupName string, name string, entityName string, slot string) (result SetObject, err error) { - req, err := client.DeleteSiteRelayServiceConnectionSlotPreparer(resourceGroupName, name, entityName, slot) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.SitesClient", "DeleteSiteRelayServiceConnectionSlot", nil, "Failure preparing request") - } - - resp, err := client.DeleteSiteRelayServiceConnectionSlotSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.SitesClient", "DeleteSiteRelayServiceConnectionSlot", resp, "Failure sending request") - } - - result, err = client.DeleteSiteRelayServiceConnectionSlotResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.SitesClient", "DeleteSiteRelayServiceConnectionSlot", resp, "Failure responding to request") - } - - return -} - -// DeleteSiteRelayServiceConnectionSlotPreparer prepares the DeleteSiteRelayServiceConnectionSlot request. -func (client SitesClient) DeleteSiteRelayServiceConnectionSlotPreparer(resourceGroupName string, name string, entityName string, slot string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "entityName": autorest.Encode("path", entityName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "slot": autorest.Encode("path", slot), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/hybridconnection/{entityName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// DeleteSiteRelayServiceConnectionSlotSender sends the DeleteSiteRelayServiceConnectionSlot request. The method will close the -// http.Response Body if it receives an error. -func (client SitesClient) DeleteSiteRelayServiceConnectionSlotSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DeleteSiteRelayServiceConnectionSlotResponder handles the response to the DeleteSiteRelayServiceConnectionSlot request. The method always -// closes the http.Response Body. -func (client SitesClient) DeleteSiteRelayServiceConnectionSlotResponder(resp *http.Response) (result SetObject, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Value), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// DeleteSiteSlot sends the delete site slot request. -// -// resourceGroupName is name of resource group name is name of web app slot is -// name of web app slot. If not specified then will default to production slot. -// deleteMetrics is if true, web app metrics are also deleted -// deleteEmptyServerFarm is if true and App Service Plan is empty after web app -// deletion, App Service Plan is also deleted skipDNSRegistration is if true, -// DNS registration is skipped deleteAllSlots is if true, all slots associated -// with web app are also deleted -func (client SitesClient) DeleteSiteSlot(resourceGroupName string, name string, slot string, deleteMetrics string, deleteEmptyServerFarm string, skipDNSRegistration string, deleteAllSlots string) (result SetObject, err error) { - req, err := client.DeleteSiteSlotPreparer(resourceGroupName, name, slot, deleteMetrics, deleteEmptyServerFarm, skipDNSRegistration, deleteAllSlots) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.SitesClient", "DeleteSiteSlot", nil, "Failure preparing request") - } - - resp, err := client.DeleteSiteSlotSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.SitesClient", "DeleteSiteSlot", resp, "Failure sending request") - } - - result, err = client.DeleteSiteSlotResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.SitesClient", "DeleteSiteSlot", resp, "Failure responding to request") - } - - return -} - -// DeleteSiteSlotPreparer prepares the DeleteSiteSlot request. -func (client SitesClient) DeleteSiteSlotPreparer(resourceGroupName string, name string, slot string, deleteMetrics string, deleteEmptyServerFarm string, skipDNSRegistration string, deleteAllSlots string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "slot": autorest.Encode("path", slot), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - if len(deleteMetrics) > 0 { - queryParameters["deleteMetrics"] = autorest.Encode("query", deleteMetrics) - } - if len(deleteEmptyServerFarm) > 0 { - queryParameters["deleteEmptyServerFarm"] = autorest.Encode("query", deleteEmptyServerFarm) - } - if len(skipDNSRegistration) > 0 { - queryParameters["skipDnsRegistration"] = autorest.Encode("query", skipDNSRegistration) - } - if len(deleteAllSlots) > 0 { - queryParameters["deleteAllSlots"] = autorest.Encode("query", deleteAllSlots) - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// DeleteSiteSlotSender sends the DeleteSiteSlot request. The method will close the -// http.Response Body if it receives an error. -func (client SitesClient) DeleteSiteSlotSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DeleteSiteSlotResponder handles the response to the DeleteSiteSlot request. The method always -// closes the http.Response Body. -func (client SitesClient) DeleteSiteSlotResponder(resp *http.Response) (result SetObject, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Value), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// DeleteSiteSourceControl sends the delete site source control request. -// -// resourceGroupName is name of resource group name is name of web app -func (client SitesClient) DeleteSiteSourceControl(resourceGroupName string, name string) (result SetObject, err error) { - req, err := client.DeleteSiteSourceControlPreparer(resourceGroupName, name) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.SitesClient", "DeleteSiteSourceControl", nil, "Failure preparing request") - } - - resp, err := client.DeleteSiteSourceControlSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.SitesClient", "DeleteSiteSourceControl", resp, "Failure sending request") - } - - result, err = client.DeleteSiteSourceControlResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.SitesClient", "DeleteSiteSourceControl", resp, "Failure responding to request") - } - - return -} - -// DeleteSiteSourceControlPreparer prepares the DeleteSiteSourceControl request. -func (client SitesClient) DeleteSiteSourceControlPreparer(resourceGroupName string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/sourcecontrols/web", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// DeleteSiteSourceControlSender sends the DeleteSiteSourceControl request. The method will close the -// http.Response Body if it receives an error. -func (client SitesClient) DeleteSiteSourceControlSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DeleteSiteSourceControlResponder handles the response to the DeleteSiteSourceControl request. The method always -// closes the http.Response Body. -func (client SitesClient) DeleteSiteSourceControlResponder(resp *http.Response) (result SetObject, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Value), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// DeleteSiteSourceControlSlot sends the delete site source control slot -// request. -// -// resourceGroupName is name of resource group name is name of web app slot is -// name of web app slot. If not specified then will default to production slot. -func (client SitesClient) DeleteSiteSourceControlSlot(resourceGroupName string, name string, slot string) (result SetObject, err error) { - req, err := client.DeleteSiteSourceControlSlotPreparer(resourceGroupName, name, slot) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.SitesClient", "DeleteSiteSourceControlSlot", nil, "Failure preparing request") - } - - resp, err := client.DeleteSiteSourceControlSlotSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.SitesClient", "DeleteSiteSourceControlSlot", resp, "Failure sending request") - } - - result, err = client.DeleteSiteSourceControlSlotResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.SitesClient", "DeleteSiteSourceControlSlot", resp, "Failure responding to request") - } - - return -} - -// DeleteSiteSourceControlSlotPreparer prepares the DeleteSiteSourceControlSlot request. -func (client SitesClient) DeleteSiteSourceControlSlotPreparer(resourceGroupName string, name string, slot string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "slot": autorest.Encode("path", slot), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/sourcecontrols/web", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// DeleteSiteSourceControlSlotSender sends the DeleteSiteSourceControlSlot request. The method will close the -// http.Response Body if it receives an error. -func (client SitesClient) DeleteSiteSourceControlSlotSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DeleteSiteSourceControlSlotResponder handles the response to the DeleteSiteSourceControlSlot request. The method always -// closes the http.Response Body. -func (client SitesClient) DeleteSiteSourceControlSlotResponder(resp *http.Response) (result SetObject, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Value), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// DeleteSiteVNETConnection sends the delete site vnet connection request. -// -// resourceGroupName is the resource group name name is the name of the web app -// vnetName is the name of the Virtual Network -func (client SitesClient) DeleteSiteVNETConnection(resourceGroupName string, name string, vnetName string) (result SetObject, err error) { - req, err := client.DeleteSiteVNETConnectionPreparer(resourceGroupName, name, vnetName) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.SitesClient", "DeleteSiteVNETConnection", nil, "Failure preparing request") - } - - resp, err := client.DeleteSiteVNETConnectionSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.SitesClient", "DeleteSiteVNETConnection", resp, "Failure sending request") - } - - result, err = client.DeleteSiteVNETConnectionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.SitesClient", "DeleteSiteVNETConnection", resp, "Failure responding to request") - } - - return -} - -// DeleteSiteVNETConnectionPreparer prepares the DeleteSiteVNETConnection request. -func (client SitesClient) DeleteSiteVNETConnectionPreparer(resourceGroupName string, name string, vnetName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vnetName": autorest.Encode("path", vnetName), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/virtualNetworkConnections/{vnetName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// DeleteSiteVNETConnectionSender sends the DeleteSiteVNETConnection request. The method will close the -// http.Response Body if it receives an error. -func (client SitesClient) DeleteSiteVNETConnectionSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DeleteSiteVNETConnectionResponder handles the response to the DeleteSiteVNETConnection request. The method always -// closes the http.Response Body. -func (client SitesClient) DeleteSiteVNETConnectionResponder(resp *http.Response) (result SetObject, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Value), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// DeleteSiteVNETConnectionSlot sends the delete site vnet connection slot -// request. -// -// resourceGroupName is the resource group name name is the name of the web app -// vnetName is the name of the Virtual Network slot is the name of the slot for -// this web app. -func (client SitesClient) DeleteSiteVNETConnectionSlot(resourceGroupName string, name string, vnetName string, slot string) (result SetObject, err error) { - req, err := client.DeleteSiteVNETConnectionSlotPreparer(resourceGroupName, name, vnetName, slot) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.SitesClient", "DeleteSiteVNETConnectionSlot", nil, "Failure preparing request") - } - - resp, err := client.DeleteSiteVNETConnectionSlotSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.SitesClient", "DeleteSiteVNETConnectionSlot", resp, "Failure sending request") - } - - result, err = client.DeleteSiteVNETConnectionSlotResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.SitesClient", "DeleteSiteVNETConnectionSlot", resp, "Failure responding to request") - } - - return -} - -// DeleteSiteVNETConnectionSlotPreparer prepares the DeleteSiteVNETConnectionSlot request. -func (client SitesClient) DeleteSiteVNETConnectionSlotPreparer(resourceGroupName string, name string, vnetName string, slot string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "slot": autorest.Encode("path", slot), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vnetName": autorest.Encode("path", vnetName), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/virtualNetworkConnections/{vnetName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// DeleteSiteVNETConnectionSlotSender sends the DeleteSiteVNETConnectionSlot request. The method will close the -// http.Response Body if it receives an error. -func (client SitesClient) DeleteSiteVNETConnectionSlotSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DeleteSiteVNETConnectionSlotResponder handles the response to the DeleteSiteVNETConnectionSlot request. The method always -// closes the http.Response Body. -func (client SitesClient) DeleteSiteVNETConnectionSlotResponder(resp *http.Response) (result SetObject, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Value), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// DiscoverSiteRestore sends the discover site restore request. -// -// resourceGroupName is name of resource group name is name of web app request -// is information on restore request -func (client SitesClient) DiscoverSiteRestore(resourceGroupName string, name string, request RestoreRequest) (result RestoreRequest, err error) { - req, err := client.DiscoverSiteRestorePreparer(resourceGroupName, name, request) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.SitesClient", "DiscoverSiteRestore", nil, "Failure preparing request") - } - - resp, err := client.DiscoverSiteRestoreSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.SitesClient", "DiscoverSiteRestore", resp, "Failure sending request") - } - - result, err = client.DiscoverSiteRestoreResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.SitesClient", "DiscoverSiteRestore", resp, "Failure responding to request") - } - - return -} - -// DiscoverSiteRestorePreparer prepares the DiscoverSiteRestore request. -func (client SitesClient) DiscoverSiteRestorePreparer(resourceGroupName string, name string, request RestoreRequest) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/backups/discover", pathParameters), - autorest.WithJSON(request), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// DiscoverSiteRestoreSender sends the DiscoverSiteRestore request. The method will close the -// http.Response Body if it receives an error. -func (client SitesClient) DiscoverSiteRestoreSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DiscoverSiteRestoreResponder handles the response to the DiscoverSiteRestore request. The method always -// closes the http.Response Body. -func (client SitesClient) DiscoverSiteRestoreResponder(resp *http.Response) (result RestoreRequest, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// DiscoverSiteRestoreSlot sends the discover site restore slot request. -// -// resourceGroupName is name of resource group name is name of web app request -// is information on restore request slot is name of web app slot. If not -// specified then will default to production slot. -func (client SitesClient) DiscoverSiteRestoreSlot(resourceGroupName string, name string, request RestoreRequest, slot string) (result RestoreRequest, err error) { - req, err := client.DiscoverSiteRestoreSlotPreparer(resourceGroupName, name, request, slot) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.SitesClient", "DiscoverSiteRestoreSlot", nil, "Failure preparing request") - } - - resp, err := client.DiscoverSiteRestoreSlotSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.SitesClient", "DiscoverSiteRestoreSlot", resp, "Failure sending request") - } - - result, err = client.DiscoverSiteRestoreSlotResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.SitesClient", "DiscoverSiteRestoreSlot", resp, "Failure responding to request") - } - - return -} - -// DiscoverSiteRestoreSlotPreparer prepares the DiscoverSiteRestoreSlot request. -func (client SitesClient) DiscoverSiteRestoreSlotPreparer(resourceGroupName string, name string, request RestoreRequest, slot string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "slot": autorest.Encode("path", slot), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/backups/discover", pathParameters), - autorest.WithJSON(request), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// DiscoverSiteRestoreSlotSender sends the DiscoverSiteRestoreSlot request. The method will close the -// http.Response Body if it receives an error. -func (client SitesClient) DiscoverSiteRestoreSlotSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DiscoverSiteRestoreSlotResponder handles the response to the DiscoverSiteRestoreSlot request. The method always -// closes the http.Response Body. -func (client SitesClient) DiscoverSiteRestoreSlotResponder(resp *http.Response) (result RestoreRequest, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GenerateNewSitePublishingPassword sends the generate new site publishing -// password request. -// -// resourceGroupName is name of resource group name is name of web app -func (client SitesClient) GenerateNewSitePublishingPassword(resourceGroupName string, name string) (result SetObject, err error) { - req, err := client.GenerateNewSitePublishingPasswordPreparer(resourceGroupName, name) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.SitesClient", "GenerateNewSitePublishingPassword", nil, "Failure preparing request") - } - - resp, err := client.GenerateNewSitePublishingPasswordSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.SitesClient", "GenerateNewSitePublishingPassword", resp, "Failure sending request") - } - - result, err = client.GenerateNewSitePublishingPasswordResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.SitesClient", "GenerateNewSitePublishingPassword", resp, "Failure responding to request") - } - - return -} - -// GenerateNewSitePublishingPasswordPreparer prepares the GenerateNewSitePublishingPassword request. -func (client SitesClient) GenerateNewSitePublishingPasswordPreparer(resourceGroupName string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/newpassword", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GenerateNewSitePublishingPasswordSender sends the GenerateNewSitePublishingPassword request. The method will close the -// http.Response Body if it receives an error. -func (client SitesClient) GenerateNewSitePublishingPasswordSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GenerateNewSitePublishingPasswordResponder handles the response to the GenerateNewSitePublishingPassword request. The method always -// closes the http.Response Body. -func (client SitesClient) GenerateNewSitePublishingPasswordResponder(resp *http.Response) (result SetObject, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Value), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GenerateNewSitePublishingPasswordSlot sends the generate new site publishing -// password slot request. -// -// resourceGroupName is name of resource group name is name of web app slot is -// name of web app slot. If not specified then will default to production slot. -func (client SitesClient) GenerateNewSitePublishingPasswordSlot(resourceGroupName string, name string, slot string) (result SetObject, err error) { - req, err := client.GenerateNewSitePublishingPasswordSlotPreparer(resourceGroupName, name, slot) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.SitesClient", "GenerateNewSitePublishingPasswordSlot", nil, "Failure preparing request") - } - - resp, err := client.GenerateNewSitePublishingPasswordSlotSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.SitesClient", "GenerateNewSitePublishingPasswordSlot", resp, "Failure sending request") - } - - result, err = client.GenerateNewSitePublishingPasswordSlotResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.SitesClient", "GenerateNewSitePublishingPasswordSlot", resp, "Failure responding to request") - } - - return -} - -// GenerateNewSitePublishingPasswordSlotPreparer prepares the GenerateNewSitePublishingPasswordSlot request. -func (client SitesClient) GenerateNewSitePublishingPasswordSlotPreparer(resourceGroupName string, name string, slot string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "slot": autorest.Encode("path", slot), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/newpassword", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GenerateNewSitePublishingPasswordSlotSender sends the GenerateNewSitePublishingPasswordSlot request. The method will close the -// http.Response Body if it receives an error. -func (client SitesClient) GenerateNewSitePublishingPasswordSlotSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GenerateNewSitePublishingPasswordSlotResponder handles the response to the GenerateNewSitePublishingPasswordSlot request. The method always -// closes the http.Response Body. -func (client SitesClient) GenerateNewSitePublishingPasswordSlotResponder(resp *http.Response) (result SetObject, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Value), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetDeletedSites sends the get deleted sites request. -// -// resourceGroupName is name of resource group propertiesToInclude is -// additional web app properties included in the response includeSiteTypes is -// types of apps included in the response -func (client SitesClient) GetDeletedSites(resourceGroupName string, propertiesToInclude string, includeSiteTypes string) (result DeletedSiteCollection, err error) { - req, err := client.GetDeletedSitesPreparer(resourceGroupName, propertiesToInclude, includeSiteTypes) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.SitesClient", "GetDeletedSites", nil, "Failure preparing request") - } - - resp, err := client.GetDeletedSitesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.SitesClient", "GetDeletedSites", resp, "Failure sending request") - } - - result, err = client.GetDeletedSitesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.SitesClient", "GetDeletedSites", resp, "Failure responding to request") - } - - return -} - -// GetDeletedSitesPreparer prepares the GetDeletedSites request. -func (client SitesClient) GetDeletedSitesPreparer(resourceGroupName string, propertiesToInclude string, includeSiteTypes string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - if len(propertiesToInclude) > 0 { - queryParameters["propertiesToInclude"] = autorest.Encode("query", propertiesToInclude) - } - if len(includeSiteTypes) > 0 { - queryParameters["includeSiteTypes"] = autorest.Encode("query", includeSiteTypes) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/deletedSites", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetDeletedSitesSender sends the GetDeletedSites request. The method will close the -// http.Response Body if it receives an error. -func (client SitesClient) GetDeletedSitesSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetDeletedSitesResponder handles the response to the GetDeletedSites request. The method always -// closes the http.Response Body. -func (client SitesClient) GetDeletedSitesResponder(resp *http.Response) (result DeletedSiteCollection, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetDeletedSitesNextResults retrieves the next set of results, if any. -func (client SitesClient) GetDeletedSitesNextResults(lastResults DeletedSiteCollection) (result DeletedSiteCollection, err error) { - req, err := lastResults.DeletedSiteCollectionPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "web.SitesClient", "GetDeletedSites", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.GetDeletedSitesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.SitesClient", "GetDeletedSites", resp, "Failure sending next results request") - } - - result, err = client.GetDeletedSitesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.SitesClient", "GetDeletedSites", resp, "Failure responding to next results request") - } - - return -} - -// GetDeployment sends the get deployment request. -// -// resourceGroupName is name of resource group name is name of web app id is id -// of the deployment -func (client SitesClient) GetDeployment(resourceGroupName string, name string, id string) (result Deployment, err error) { - req, err := client.GetDeploymentPreparer(resourceGroupName, name, id) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.SitesClient", "GetDeployment", nil, "Failure preparing request") - } - - resp, err := client.GetDeploymentSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.SitesClient", "GetDeployment", resp, "Failure sending request") - } - - result, err = client.GetDeploymentResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.SitesClient", "GetDeployment", resp, "Failure responding to request") - } - - return -} - -// GetDeploymentPreparer prepares the GetDeployment request. -func (client SitesClient) GetDeploymentPreparer(resourceGroupName string, name string, id string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "id": autorest.Encode("path", id), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/deployments/{id}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetDeploymentSender sends the GetDeployment request. The method will close the -// http.Response Body if it receives an error. -func (client SitesClient) GetDeploymentSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetDeploymentResponder handles the response to the GetDeployment request. The method always -// closes the http.Response Body. -func (client SitesClient) GetDeploymentResponder(resp *http.Response) (result Deployment, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetDeployments sends the get deployments request. -// -// resourceGroupName is name of resource group name is name of web app -func (client SitesClient) GetDeployments(resourceGroupName string, name string) (result DeploymentCollection, err error) { - req, err := client.GetDeploymentsPreparer(resourceGroupName, name) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.SitesClient", "GetDeployments", nil, "Failure preparing request") - } - - resp, err := client.GetDeploymentsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.SitesClient", "GetDeployments", resp, "Failure sending request") - } - - result, err = client.GetDeploymentsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.SitesClient", "GetDeployments", resp, "Failure responding to request") - } - - return -} - -// GetDeploymentsPreparer prepares the GetDeployments request. -func (client SitesClient) GetDeploymentsPreparer(resourceGroupName string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/deployments", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetDeploymentsSender sends the GetDeployments request. The method will close the -// http.Response Body if it receives an error. -func (client SitesClient) GetDeploymentsSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetDeploymentsResponder handles the response to the GetDeployments request. The method always -// closes the http.Response Body. -func (client SitesClient) GetDeploymentsResponder(resp *http.Response) (result DeploymentCollection, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetDeploymentsNextResults retrieves the next set of results, if any. -func (client SitesClient) GetDeploymentsNextResults(lastResults DeploymentCollection) (result DeploymentCollection, err error) { - req, err := lastResults.DeploymentCollectionPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "web.SitesClient", "GetDeployments", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.GetDeploymentsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.SitesClient", "GetDeployments", resp, "Failure sending next results request") - } - - result, err = client.GetDeploymentsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.SitesClient", "GetDeployments", resp, "Failure responding to next results request") - } - - return -} - -// GetDeploymentSlot sends the get deployment slot request. -// -// resourceGroupName is name of resource group name is name of web app id is id -// of the deployment slot is name of web app slot. If not specified then will -// default to production slot. -func (client SitesClient) GetDeploymentSlot(resourceGroupName string, name string, id string, slot string) (result Deployment, err error) { - req, err := client.GetDeploymentSlotPreparer(resourceGroupName, name, id, slot) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.SitesClient", "GetDeploymentSlot", nil, "Failure preparing request") - } - - resp, err := client.GetDeploymentSlotSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.SitesClient", "GetDeploymentSlot", resp, "Failure sending request") - } - - result, err = client.GetDeploymentSlotResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.SitesClient", "GetDeploymentSlot", resp, "Failure responding to request") - } - - return -} - -// GetDeploymentSlotPreparer prepares the GetDeploymentSlot request. -func (client SitesClient) GetDeploymentSlotPreparer(resourceGroupName string, name string, id string, slot string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "id": autorest.Encode("path", id), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "slot": autorest.Encode("path", slot), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/deployments/{id}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetDeploymentSlotSender sends the GetDeploymentSlot request. The method will close the -// http.Response Body if it receives an error. -func (client SitesClient) GetDeploymentSlotSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetDeploymentSlotResponder handles the response to the GetDeploymentSlot request. The method always -// closes the http.Response Body. -func (client SitesClient) GetDeploymentSlotResponder(resp *http.Response) (result Deployment, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetDeploymentsSlot sends the get deployments slot request. -// -// resourceGroupName is name of resource group name is name of web app slot is -// name of web app slot. If not specified then will default to production slot. -func (client SitesClient) GetDeploymentsSlot(resourceGroupName string, name string, slot string) (result DeploymentCollection, err error) { - req, err := client.GetDeploymentsSlotPreparer(resourceGroupName, name, slot) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.SitesClient", "GetDeploymentsSlot", nil, "Failure preparing request") - } - - resp, err := client.GetDeploymentsSlotSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.SitesClient", "GetDeploymentsSlot", resp, "Failure sending request") - } - - result, err = client.GetDeploymentsSlotResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.SitesClient", "GetDeploymentsSlot", resp, "Failure responding to request") - } - - return -} - -// GetDeploymentsSlotPreparer prepares the GetDeploymentsSlot request. -func (client SitesClient) GetDeploymentsSlotPreparer(resourceGroupName string, name string, slot string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "slot": autorest.Encode("path", slot), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/deployments", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetDeploymentsSlotSender sends the GetDeploymentsSlot request. The method will close the -// http.Response Body if it receives an error. -func (client SitesClient) GetDeploymentsSlotSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetDeploymentsSlotResponder handles the response to the GetDeploymentsSlot request. The method always -// closes the http.Response Body. -func (client SitesClient) GetDeploymentsSlotResponder(resp *http.Response) (result DeploymentCollection, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetDeploymentsSlotNextResults retrieves the next set of results, if any. -func (client SitesClient) GetDeploymentsSlotNextResults(lastResults DeploymentCollection) (result DeploymentCollection, err error) { - req, err := lastResults.DeploymentCollectionPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "web.SitesClient", "GetDeploymentsSlot", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.GetDeploymentsSlotSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.SitesClient", "GetDeploymentsSlot", resp, "Failure sending next results request") - } - - result, err = client.GetDeploymentsSlotResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.SitesClient", "GetDeploymentsSlot", resp, "Failure responding to next results request") - } - - return -} - -// GetInstanceDeployment sends the get instance deployment request. -// -// resourceGroupName is name of resource group name is name of web app id is id -// of the deployment instanceID is id of web app instance -func (client SitesClient) GetInstanceDeployment(resourceGroupName string, name string, id string, instanceID string) (result Deployment, err error) { - req, err := client.GetInstanceDeploymentPreparer(resourceGroupName, name, id, instanceID) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.SitesClient", "GetInstanceDeployment", nil, "Failure preparing request") - } - - resp, err := client.GetInstanceDeploymentSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.SitesClient", "GetInstanceDeployment", resp, "Failure sending request") - } - - result, err = client.GetInstanceDeploymentResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.SitesClient", "GetInstanceDeployment", resp, "Failure responding to request") - } - - return -} - -// GetInstanceDeploymentPreparer prepares the GetInstanceDeployment request. -func (client SitesClient) GetInstanceDeploymentPreparer(resourceGroupName string, name string, id string, instanceID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "id": autorest.Encode("path", id), - "instanceId": autorest.Encode("path", instanceID), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/instances/{instanceId}/deployments/{id}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetInstanceDeploymentSender sends the GetInstanceDeployment request. The method will close the -// http.Response Body if it receives an error. -func (client SitesClient) GetInstanceDeploymentSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetInstanceDeploymentResponder handles the response to the GetInstanceDeployment request. The method always -// closes the http.Response Body. -func (client SitesClient) GetInstanceDeploymentResponder(resp *http.Response) (result Deployment, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetInstanceDeployments sends the get instance deployments request. -// -// resourceGroupName is name of resource group name is name of web app -// instanceID is id of web app instance -func (client SitesClient) GetInstanceDeployments(resourceGroupName string, name string, instanceID string) (result DeploymentCollection, err error) { - req, err := client.GetInstanceDeploymentsPreparer(resourceGroupName, name, instanceID) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.SitesClient", "GetInstanceDeployments", nil, "Failure preparing request") - } - - resp, err := client.GetInstanceDeploymentsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.SitesClient", "GetInstanceDeployments", resp, "Failure sending request") - } - - result, err = client.GetInstanceDeploymentsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.SitesClient", "GetInstanceDeployments", resp, "Failure responding to request") - } - - return -} - -// GetInstanceDeploymentsPreparer prepares the GetInstanceDeployments request. -func (client SitesClient) GetInstanceDeploymentsPreparer(resourceGroupName string, name string, instanceID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "instanceId": autorest.Encode("path", instanceID), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/instances/{instanceId}/deployments", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetInstanceDeploymentsSender sends the GetInstanceDeployments request. The method will close the -// http.Response Body if it receives an error. -func (client SitesClient) GetInstanceDeploymentsSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetInstanceDeploymentsResponder handles the response to the GetInstanceDeployments request. The method always -// closes the http.Response Body. -func (client SitesClient) GetInstanceDeploymentsResponder(resp *http.Response) (result DeploymentCollection, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetInstanceDeploymentsNextResults retrieves the next set of results, if any. -func (client SitesClient) GetInstanceDeploymentsNextResults(lastResults DeploymentCollection) (result DeploymentCollection, err error) { - req, err := lastResults.DeploymentCollectionPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "web.SitesClient", "GetInstanceDeployments", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.GetInstanceDeploymentsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.SitesClient", "GetInstanceDeployments", resp, "Failure sending next results request") - } - - result, err = client.GetInstanceDeploymentsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.SitesClient", "GetInstanceDeployments", resp, "Failure responding to next results request") - } - - return -} - -// GetInstanceDeploymentSlot sends the get instance deployment slot request. -// -// resourceGroupName is name of resource group name is name of web app id is id -// of the deployment slot is name of web app slot. If not specified then will -// default to production slot. instanceID is id of web app instance -func (client SitesClient) GetInstanceDeploymentSlot(resourceGroupName string, name string, id string, slot string, instanceID string) (result Deployment, err error) { - req, err := client.GetInstanceDeploymentSlotPreparer(resourceGroupName, name, id, slot, instanceID) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.SitesClient", "GetInstanceDeploymentSlot", nil, "Failure preparing request") - } - - resp, err := client.GetInstanceDeploymentSlotSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.SitesClient", "GetInstanceDeploymentSlot", resp, "Failure sending request") - } - - result, err = client.GetInstanceDeploymentSlotResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.SitesClient", "GetInstanceDeploymentSlot", resp, "Failure responding to request") - } - - return -} - -// GetInstanceDeploymentSlotPreparer prepares the GetInstanceDeploymentSlot request. -func (client SitesClient) GetInstanceDeploymentSlotPreparer(resourceGroupName string, name string, id string, slot string, instanceID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "id": autorest.Encode("path", id), - "instanceId": autorest.Encode("path", instanceID), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "slot": autorest.Encode("path", slot), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/instances/{instanceId}/deployments/{id}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetInstanceDeploymentSlotSender sends the GetInstanceDeploymentSlot request. The method will close the -// http.Response Body if it receives an error. -func (client SitesClient) GetInstanceDeploymentSlotSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetInstanceDeploymentSlotResponder handles the response to the GetInstanceDeploymentSlot request. The method always -// closes the http.Response Body. -func (client SitesClient) GetInstanceDeploymentSlotResponder(resp *http.Response) (result Deployment, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetInstanceDeploymentsSlot sends the get instance deployments slot request. -// -// resourceGroupName is name of resource group name is name of web app slot is -// name of web app slot. If not specified then will default to production slot. -// instanceID is id of web app instance -func (client SitesClient) GetInstanceDeploymentsSlot(resourceGroupName string, name string, slot string, instanceID string) (result DeploymentCollection, err error) { - req, err := client.GetInstanceDeploymentsSlotPreparer(resourceGroupName, name, slot, instanceID) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.SitesClient", "GetInstanceDeploymentsSlot", nil, "Failure preparing request") - } - - resp, err := client.GetInstanceDeploymentsSlotSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.SitesClient", "GetInstanceDeploymentsSlot", resp, "Failure sending request") - } - - result, err = client.GetInstanceDeploymentsSlotResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.SitesClient", "GetInstanceDeploymentsSlot", resp, "Failure responding to request") - } - - return -} - -// GetInstanceDeploymentsSlotPreparer prepares the GetInstanceDeploymentsSlot request. -func (client SitesClient) GetInstanceDeploymentsSlotPreparer(resourceGroupName string, name string, slot string, instanceID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "instanceId": autorest.Encode("path", instanceID), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "slot": autorest.Encode("path", slot), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/instances/{instanceId}/deployments", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetInstanceDeploymentsSlotSender sends the GetInstanceDeploymentsSlot request. The method will close the -// http.Response Body if it receives an error. -func (client SitesClient) GetInstanceDeploymentsSlotSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetInstanceDeploymentsSlotResponder handles the response to the GetInstanceDeploymentsSlot request. The method always -// closes the http.Response Body. -func (client SitesClient) GetInstanceDeploymentsSlotResponder(resp *http.Response) (result DeploymentCollection, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetInstanceDeploymentsSlotNextResults retrieves the next set of results, if any. -func (client SitesClient) GetInstanceDeploymentsSlotNextResults(lastResults DeploymentCollection) (result DeploymentCollection, err error) { - req, err := lastResults.DeploymentCollectionPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "web.SitesClient", "GetInstanceDeploymentsSlot", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.GetInstanceDeploymentsSlotSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.SitesClient", "GetInstanceDeploymentsSlot", resp, "Failure sending next results request") - } - - result, err = client.GetInstanceDeploymentsSlotResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.SitesClient", "GetInstanceDeploymentsSlot", resp, "Failure responding to next results request") - } - - return -} - -// GetSite sends the get site request. -// -// resourceGroupName is name of resource group name is name of web app -// propertiesToInclude is additional web app properties included in the -// response -func (client SitesClient) GetSite(resourceGroupName string, name string, propertiesToInclude string) (result Site, err error) { - req, err := client.GetSitePreparer(resourceGroupName, name, propertiesToInclude) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.SitesClient", "GetSite", nil, "Failure preparing request") - } - - resp, err := client.GetSiteSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.SitesClient", "GetSite", resp, "Failure sending request") - } - - result, err = client.GetSiteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.SitesClient", "GetSite", resp, "Failure responding to request") - } - - return -} - -// GetSitePreparer prepares the GetSite request. -func (client SitesClient) GetSitePreparer(resourceGroupName string, name string, propertiesToInclude string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - if len(propertiesToInclude) > 0 { - queryParameters["propertiesToInclude"] = autorest.Encode("query", propertiesToInclude) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSiteSender sends the GetSite request. The method will close the -// http.Response Body if it receives an error. -func (client SitesClient) GetSiteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetSiteResponder handles the response to the GetSite request. The method always -// closes the http.Response Body. -func (client SitesClient) GetSiteResponder(resp *http.Response) (result Site, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetSiteBackupConfiguration sends the get site backup configuration request. -// -// resourceGroupName is name of resource group name is name of web app -func (client SitesClient) GetSiteBackupConfiguration(resourceGroupName string, name string) (result BackupRequest, err error) { - req, err := client.GetSiteBackupConfigurationPreparer(resourceGroupName, name) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.SitesClient", "GetSiteBackupConfiguration", nil, "Failure preparing request") - } - - resp, err := client.GetSiteBackupConfigurationSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.SitesClient", "GetSiteBackupConfiguration", resp, "Failure sending request") - } - - result, err = client.GetSiteBackupConfigurationResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.SitesClient", "GetSiteBackupConfiguration", resp, "Failure responding to request") - } - - return -} - -// GetSiteBackupConfigurationPreparer prepares the GetSiteBackupConfiguration request. -func (client SitesClient) GetSiteBackupConfigurationPreparer(resourceGroupName string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/backup/list", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSiteBackupConfigurationSender sends the GetSiteBackupConfiguration request. The method will close the -// http.Response Body if it receives an error. -func (client SitesClient) GetSiteBackupConfigurationSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetSiteBackupConfigurationResponder handles the response to the GetSiteBackupConfiguration request. The method always -// closes the http.Response Body. -func (client SitesClient) GetSiteBackupConfigurationResponder(resp *http.Response) (result BackupRequest, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetSiteBackupConfigurationSlot sends the get site backup configuration slot -// request. -// -// resourceGroupName is name of resource group name is name of web app slot is -// name of web app slot. If not specified then will default to production slot. -func (client SitesClient) GetSiteBackupConfigurationSlot(resourceGroupName string, name string, slot string) (result BackupRequest, err error) { - req, err := client.GetSiteBackupConfigurationSlotPreparer(resourceGroupName, name, slot) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.SitesClient", "GetSiteBackupConfigurationSlot", nil, "Failure preparing request") - } - - resp, err := client.GetSiteBackupConfigurationSlotSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.SitesClient", "GetSiteBackupConfigurationSlot", resp, "Failure sending request") - } - - result, err = client.GetSiteBackupConfigurationSlotResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.SitesClient", "GetSiteBackupConfigurationSlot", resp, "Failure responding to request") - } - - return -} - -// GetSiteBackupConfigurationSlotPreparer prepares the GetSiteBackupConfigurationSlot request. -func (client SitesClient) GetSiteBackupConfigurationSlotPreparer(resourceGroupName string, name string, slot string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "slot": autorest.Encode("path", slot), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/backup/list", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSiteBackupConfigurationSlotSender sends the GetSiteBackupConfigurationSlot request. The method will close the -// http.Response Body if it receives an error. -func (client SitesClient) GetSiteBackupConfigurationSlotSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetSiteBackupConfigurationSlotResponder handles the response to the GetSiteBackupConfigurationSlot request. The method always -// closes the http.Response Body. -func (client SitesClient) GetSiteBackupConfigurationSlotResponder(resp *http.Response) (result BackupRequest, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetSiteBackupStatus sends the get site backup status request. -// -// resourceGroupName is name of resource group name is name of web app backupID -// is id of backup -func (client SitesClient) GetSiteBackupStatus(resourceGroupName string, name string, backupID string) (result BackupItem, err error) { - req, err := client.GetSiteBackupStatusPreparer(resourceGroupName, name, backupID) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.SitesClient", "GetSiteBackupStatus", nil, "Failure preparing request") - } - - resp, err := client.GetSiteBackupStatusSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.SitesClient", "GetSiteBackupStatus", resp, "Failure sending request") - } - - result, err = client.GetSiteBackupStatusResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.SitesClient", "GetSiteBackupStatus", resp, "Failure responding to request") - } - - return -} - -// GetSiteBackupStatusPreparer prepares the GetSiteBackupStatus request. -func (client SitesClient) GetSiteBackupStatusPreparer(resourceGroupName string, name string, backupID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "backupId": autorest.Encode("path", backupID), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/backups/{backupId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSiteBackupStatusSender sends the GetSiteBackupStatus request. The method will close the -// http.Response Body if it receives an error. -func (client SitesClient) GetSiteBackupStatusSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetSiteBackupStatusResponder handles the response to the GetSiteBackupStatus request. The method always -// closes the http.Response Body. -func (client SitesClient) GetSiteBackupStatusResponder(resp *http.Response) (result BackupItem, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetSiteBackupStatusSecrets sends the get site backup status secrets request. -// -// resourceGroupName is name of resource group name is name of web app backupID -// is id of backup request is information on backup request -func (client SitesClient) GetSiteBackupStatusSecrets(resourceGroupName string, name string, backupID string, request BackupRequest) (result BackupItem, err error) { - req, err := client.GetSiteBackupStatusSecretsPreparer(resourceGroupName, name, backupID, request) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.SitesClient", "GetSiteBackupStatusSecrets", nil, "Failure preparing request") - } - - resp, err := client.GetSiteBackupStatusSecretsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.SitesClient", "GetSiteBackupStatusSecrets", resp, "Failure sending request") - } - - result, err = client.GetSiteBackupStatusSecretsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.SitesClient", "GetSiteBackupStatusSecrets", resp, "Failure responding to request") - } - - return -} - -// GetSiteBackupStatusSecretsPreparer prepares the GetSiteBackupStatusSecrets request. -func (client SitesClient) GetSiteBackupStatusSecretsPreparer(resourceGroupName string, name string, backupID string, request BackupRequest) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "backupId": autorest.Encode("path", backupID), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/backups/{backupId}/list", pathParameters), - autorest.WithJSON(request), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSiteBackupStatusSecretsSender sends the GetSiteBackupStatusSecrets request. The method will close the -// http.Response Body if it receives an error. -func (client SitesClient) GetSiteBackupStatusSecretsSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetSiteBackupStatusSecretsResponder handles the response to the GetSiteBackupStatusSecrets request. The method always -// closes the http.Response Body. -func (client SitesClient) GetSiteBackupStatusSecretsResponder(resp *http.Response) (result BackupItem, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetSiteBackupStatusSecretsSlot sends the get site backup status secrets slot -// request. -// -// resourceGroupName is name of resource group name is name of web app backupID -// is id of backup request is information on backup request slot is name of web -// app slot. If not specified then will default to production slot. -func (client SitesClient) GetSiteBackupStatusSecretsSlot(resourceGroupName string, name string, backupID string, request BackupRequest, slot string) (result BackupItem, err error) { - req, err := client.GetSiteBackupStatusSecretsSlotPreparer(resourceGroupName, name, backupID, request, slot) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.SitesClient", "GetSiteBackupStatusSecretsSlot", nil, "Failure preparing request") - } - - resp, err := client.GetSiteBackupStatusSecretsSlotSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.SitesClient", "GetSiteBackupStatusSecretsSlot", resp, "Failure sending request") - } - - result, err = client.GetSiteBackupStatusSecretsSlotResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.SitesClient", "GetSiteBackupStatusSecretsSlot", resp, "Failure responding to request") - } - - return -} - -// GetSiteBackupStatusSecretsSlotPreparer prepares the GetSiteBackupStatusSecretsSlot request. -func (client SitesClient) GetSiteBackupStatusSecretsSlotPreparer(resourceGroupName string, name string, backupID string, request BackupRequest, slot string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "backupId": autorest.Encode("path", backupID), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "slot": autorest.Encode("path", slot), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/backups/{backupId}/list", pathParameters), - autorest.WithJSON(request), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSiteBackupStatusSecretsSlotSender sends the GetSiteBackupStatusSecretsSlot request. The method will close the -// http.Response Body if it receives an error. -func (client SitesClient) GetSiteBackupStatusSecretsSlotSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetSiteBackupStatusSecretsSlotResponder handles the response to the GetSiteBackupStatusSecretsSlot request. The method always -// closes the http.Response Body. -func (client SitesClient) GetSiteBackupStatusSecretsSlotResponder(resp *http.Response) (result BackupItem, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetSiteBackupStatusSlot sends the get site backup status slot request. -// -// resourceGroupName is name of resource group name is name of web app backupID -// is id of backup slot is name of web app slot. If not specified then will -// default to production slot. -func (client SitesClient) GetSiteBackupStatusSlot(resourceGroupName string, name string, backupID string, slot string) (result BackupItem, err error) { - req, err := client.GetSiteBackupStatusSlotPreparer(resourceGroupName, name, backupID, slot) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.SitesClient", "GetSiteBackupStatusSlot", nil, "Failure preparing request") - } - - resp, err := client.GetSiteBackupStatusSlotSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.SitesClient", "GetSiteBackupStatusSlot", resp, "Failure sending request") - } - - result, err = client.GetSiteBackupStatusSlotResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.SitesClient", "GetSiteBackupStatusSlot", resp, "Failure responding to request") - } - - return -} - -// GetSiteBackupStatusSlotPreparer prepares the GetSiteBackupStatusSlot request. -func (client SitesClient) GetSiteBackupStatusSlotPreparer(resourceGroupName string, name string, backupID string, slot string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "backupId": autorest.Encode("path", backupID), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "slot": autorest.Encode("path", slot), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/backups/{backupId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSiteBackupStatusSlotSender sends the GetSiteBackupStatusSlot request. The method will close the -// http.Response Body if it receives an error. -func (client SitesClient) GetSiteBackupStatusSlotSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetSiteBackupStatusSlotResponder handles the response to the GetSiteBackupStatusSlot request. The method always -// closes the http.Response Body. -func (client SitesClient) GetSiteBackupStatusSlotResponder(resp *http.Response) (result BackupItem, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetSiteConfig sends the get site config request. -// -// resourceGroupName is name of resource group name is name of web app -func (client SitesClient) GetSiteConfig(resourceGroupName string, name string) (result SiteConfig, err error) { - req, err := client.GetSiteConfigPreparer(resourceGroupName, name) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.SitesClient", "GetSiteConfig", nil, "Failure preparing request") - } - - resp, err := client.GetSiteConfigSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.SitesClient", "GetSiteConfig", resp, "Failure sending request") - } - - result, err = client.GetSiteConfigResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.SitesClient", "GetSiteConfig", resp, "Failure responding to request") - } - - return -} - -// GetSiteConfigPreparer prepares the GetSiteConfig request. -func (client SitesClient) GetSiteConfigPreparer(resourceGroupName string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/web", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSiteConfigSender sends the GetSiteConfig request. The method will close the -// http.Response Body if it receives an error. -func (client SitesClient) GetSiteConfigSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetSiteConfigResponder handles the response to the GetSiteConfig request. The method always -// closes the http.Response Body. -func (client SitesClient) GetSiteConfigResponder(resp *http.Response) (result SiteConfig, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetSiteConfigSlot sends the get site config slot request. -// -// resourceGroupName is name of resource group name is name of web app slot is -// name of web app slot. If not specified then will default to production slot. -func (client SitesClient) GetSiteConfigSlot(resourceGroupName string, name string, slot string) (result SiteConfig, err error) { - req, err := client.GetSiteConfigSlotPreparer(resourceGroupName, name, slot) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.SitesClient", "GetSiteConfigSlot", nil, "Failure preparing request") - } - - resp, err := client.GetSiteConfigSlotSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.SitesClient", "GetSiteConfigSlot", resp, "Failure sending request") - } - - result, err = client.GetSiteConfigSlotResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.SitesClient", "GetSiteConfigSlot", resp, "Failure responding to request") - } - - return -} - -// GetSiteConfigSlotPreparer prepares the GetSiteConfigSlot request. -func (client SitesClient) GetSiteConfigSlotPreparer(resourceGroupName string, name string, slot string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "slot": autorest.Encode("path", slot), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/web", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSiteConfigSlotSender sends the GetSiteConfigSlot request. The method will close the -// http.Response Body if it receives an error. -func (client SitesClient) GetSiteConfigSlotSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetSiteConfigSlotResponder handles the response to the GetSiteConfigSlot request. The method always -// closes the http.Response Body. -func (client SitesClient) GetSiteConfigSlotResponder(resp *http.Response) (result SiteConfig, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetSiteHostNameBinding sends the get site host name binding request. -// -// resourceGroupName is name of resource group name is name of web app hostName -// is name of host -func (client SitesClient) GetSiteHostNameBinding(resourceGroupName string, name string, hostName string) (result HostNameBinding, err error) { - req, err := client.GetSiteHostNameBindingPreparer(resourceGroupName, name, hostName) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.SitesClient", "GetSiteHostNameBinding", nil, "Failure preparing request") - } - - resp, err := client.GetSiteHostNameBindingSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.SitesClient", "GetSiteHostNameBinding", resp, "Failure sending request") - } - - result, err = client.GetSiteHostNameBindingResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.SitesClient", "GetSiteHostNameBinding", resp, "Failure responding to request") - } - - return -} - -// GetSiteHostNameBindingPreparer prepares the GetSiteHostNameBinding request. -func (client SitesClient) GetSiteHostNameBindingPreparer(resourceGroupName string, name string, hostName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "hostName": autorest.Encode("path", hostName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/hostNameBindings/{hostName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSiteHostNameBindingSender sends the GetSiteHostNameBinding request. The method will close the -// http.Response Body if it receives an error. -func (client SitesClient) GetSiteHostNameBindingSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetSiteHostNameBindingResponder handles the response to the GetSiteHostNameBinding request. The method always -// closes the http.Response Body. -func (client SitesClient) GetSiteHostNameBindingResponder(resp *http.Response) (result HostNameBinding, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetSiteHostNameBindings sends the get site host name bindings request. -// -// resourceGroupName is name of resource group name is name of web app -func (client SitesClient) GetSiteHostNameBindings(resourceGroupName string, name string) (result HostNameBindingCollection, err error) { - req, err := client.GetSiteHostNameBindingsPreparer(resourceGroupName, name) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.SitesClient", "GetSiteHostNameBindings", nil, "Failure preparing request") - } - - resp, err := client.GetSiteHostNameBindingsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.SitesClient", "GetSiteHostNameBindings", resp, "Failure sending request") - } - - result, err = client.GetSiteHostNameBindingsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.SitesClient", "GetSiteHostNameBindings", resp, "Failure responding to request") - } - - return -} - -// GetSiteHostNameBindingsPreparer prepares the GetSiteHostNameBindings request. -func (client SitesClient) GetSiteHostNameBindingsPreparer(resourceGroupName string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/hostNameBindings", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSiteHostNameBindingsSender sends the GetSiteHostNameBindings request. The method will close the -// http.Response Body if it receives an error. -func (client SitesClient) GetSiteHostNameBindingsSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetSiteHostNameBindingsResponder handles the response to the GetSiteHostNameBindings request. The method always -// closes the http.Response Body. -func (client SitesClient) GetSiteHostNameBindingsResponder(resp *http.Response) (result HostNameBindingCollection, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetSiteHostNameBindingsNextResults retrieves the next set of results, if any. -func (client SitesClient) GetSiteHostNameBindingsNextResults(lastResults HostNameBindingCollection) (result HostNameBindingCollection, err error) { - req, err := lastResults.HostNameBindingCollectionPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "web.SitesClient", "GetSiteHostNameBindings", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.GetSiteHostNameBindingsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.SitesClient", "GetSiteHostNameBindings", resp, "Failure sending next results request") - } - - result, err = client.GetSiteHostNameBindingsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.SitesClient", "GetSiteHostNameBindings", resp, "Failure responding to next results request") - } - - return -} - -// GetSiteHostNameBindingSlot sends the get site host name binding slot -// request. -// -// resourceGroupName is name of resource group name is name of web app slot is -// name of web app slot. If not specified then will default to production slot. -// hostName is name of host -func (client SitesClient) GetSiteHostNameBindingSlot(resourceGroupName string, name string, slot string, hostName string) (result HostNameBinding, err error) { - req, err := client.GetSiteHostNameBindingSlotPreparer(resourceGroupName, name, slot, hostName) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.SitesClient", "GetSiteHostNameBindingSlot", nil, "Failure preparing request") - } - - resp, err := client.GetSiteHostNameBindingSlotSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.SitesClient", "GetSiteHostNameBindingSlot", resp, "Failure sending request") - } - - result, err = client.GetSiteHostNameBindingSlotResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.SitesClient", "GetSiteHostNameBindingSlot", resp, "Failure responding to request") - } - - return -} - -// GetSiteHostNameBindingSlotPreparer prepares the GetSiteHostNameBindingSlot request. -func (client SitesClient) GetSiteHostNameBindingSlotPreparer(resourceGroupName string, name string, slot string, hostName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "hostName": autorest.Encode("path", hostName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "slot": autorest.Encode("path", slot), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/hostNameBindings/{hostName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSiteHostNameBindingSlotSender sends the GetSiteHostNameBindingSlot request. The method will close the -// http.Response Body if it receives an error. -func (client SitesClient) GetSiteHostNameBindingSlotSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetSiteHostNameBindingSlotResponder handles the response to the GetSiteHostNameBindingSlot request. The method always -// closes the http.Response Body. -func (client SitesClient) GetSiteHostNameBindingSlotResponder(resp *http.Response) (result HostNameBinding, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetSiteHostNameBindingsSlot sends the get site host name bindings slot -// request. -// -// resourceGroupName is name of resource group name is name of web app slot is -// name of web app slot. If not specified then will default to production slot. -func (client SitesClient) GetSiteHostNameBindingsSlot(resourceGroupName string, name string, slot string) (result HostNameBindingCollection, err error) { - req, err := client.GetSiteHostNameBindingsSlotPreparer(resourceGroupName, name, slot) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.SitesClient", "GetSiteHostNameBindingsSlot", nil, "Failure preparing request") - } - - resp, err := client.GetSiteHostNameBindingsSlotSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.SitesClient", "GetSiteHostNameBindingsSlot", resp, "Failure sending request") - } - - result, err = client.GetSiteHostNameBindingsSlotResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.SitesClient", "GetSiteHostNameBindingsSlot", resp, "Failure responding to request") - } - - return -} - -// GetSiteHostNameBindingsSlotPreparer prepares the GetSiteHostNameBindingsSlot request. -func (client SitesClient) GetSiteHostNameBindingsSlotPreparer(resourceGroupName string, name string, slot string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "slot": autorest.Encode("path", slot), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/hostNameBindings", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSiteHostNameBindingsSlotSender sends the GetSiteHostNameBindingsSlot request. The method will close the -// http.Response Body if it receives an error. -func (client SitesClient) GetSiteHostNameBindingsSlotSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetSiteHostNameBindingsSlotResponder handles the response to the GetSiteHostNameBindingsSlot request. The method always -// closes the http.Response Body. -func (client SitesClient) GetSiteHostNameBindingsSlotResponder(resp *http.Response) (result HostNameBindingCollection, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetSiteHostNameBindingsSlotNextResults retrieves the next set of results, if any. -func (client SitesClient) GetSiteHostNameBindingsSlotNextResults(lastResults HostNameBindingCollection) (result HostNameBindingCollection, err error) { - req, err := lastResults.HostNameBindingCollectionPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "web.SitesClient", "GetSiteHostNameBindingsSlot", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.GetSiteHostNameBindingsSlotSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.SitesClient", "GetSiteHostNameBindingsSlot", resp, "Failure sending next results request") - } - - result, err = client.GetSiteHostNameBindingsSlotResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.SitesClient", "GetSiteHostNameBindingsSlot", resp, "Failure responding to next results request") - } - - return -} - -// GetSiteInstanceIdentifiers sends the get site instance identifiers request. -// -// resourceGroupName is name of resource group name is name of web app -func (client SitesClient) GetSiteInstanceIdentifiers(resourceGroupName string, name string) (result SiteInstanceCollection, err error) { - req, err := client.GetSiteInstanceIdentifiersPreparer(resourceGroupName, name) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.SitesClient", "GetSiteInstanceIdentifiers", nil, "Failure preparing request") - } - - resp, err := client.GetSiteInstanceIdentifiersSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.SitesClient", "GetSiteInstanceIdentifiers", resp, "Failure sending request") - } - - result, err = client.GetSiteInstanceIdentifiersResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.SitesClient", "GetSiteInstanceIdentifiers", resp, "Failure responding to request") - } - - return -} - -// GetSiteInstanceIdentifiersPreparer prepares the GetSiteInstanceIdentifiers request. -func (client SitesClient) GetSiteInstanceIdentifiersPreparer(resourceGroupName string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/instances", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSiteInstanceIdentifiersSender sends the GetSiteInstanceIdentifiers request. The method will close the -// http.Response Body if it receives an error. -func (client SitesClient) GetSiteInstanceIdentifiersSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetSiteInstanceIdentifiersResponder handles the response to the GetSiteInstanceIdentifiers request. The method always -// closes the http.Response Body. -func (client SitesClient) GetSiteInstanceIdentifiersResponder(resp *http.Response) (result SiteInstanceCollection, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetSiteInstanceIdentifiersNextResults retrieves the next set of results, if any. -func (client SitesClient) GetSiteInstanceIdentifiersNextResults(lastResults SiteInstanceCollection) (result SiteInstanceCollection, err error) { - req, err := lastResults.SiteInstanceCollectionPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "web.SitesClient", "GetSiteInstanceIdentifiers", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.GetSiteInstanceIdentifiersSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.SitesClient", "GetSiteInstanceIdentifiers", resp, "Failure sending next results request") - } - - result, err = client.GetSiteInstanceIdentifiersResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.SitesClient", "GetSiteInstanceIdentifiers", resp, "Failure responding to next results request") - } - - return -} - -// GetSiteInstanceIdentifiersSlot sends the get site instance identifiers slot -// request. -// -// resourceGroupName is name of resource group name is name of web app slot is -// name of web app slot. If not specified then will default to production slot. -func (client SitesClient) GetSiteInstanceIdentifiersSlot(resourceGroupName string, name string, slot string) (result SiteInstanceCollection, err error) { - req, err := client.GetSiteInstanceIdentifiersSlotPreparer(resourceGroupName, name, slot) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.SitesClient", "GetSiteInstanceIdentifiersSlot", nil, "Failure preparing request") - } - - resp, err := client.GetSiteInstanceIdentifiersSlotSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.SitesClient", "GetSiteInstanceIdentifiersSlot", resp, "Failure sending request") - } - - result, err = client.GetSiteInstanceIdentifiersSlotResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.SitesClient", "GetSiteInstanceIdentifiersSlot", resp, "Failure responding to request") - } - - return -} - -// GetSiteInstanceIdentifiersSlotPreparer prepares the GetSiteInstanceIdentifiersSlot request. -func (client SitesClient) GetSiteInstanceIdentifiersSlotPreparer(resourceGroupName string, name string, slot string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "slot": autorest.Encode("path", slot), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/instances", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSiteInstanceIdentifiersSlotSender sends the GetSiteInstanceIdentifiersSlot request. The method will close the -// http.Response Body if it receives an error. -func (client SitesClient) GetSiteInstanceIdentifiersSlotSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetSiteInstanceIdentifiersSlotResponder handles the response to the GetSiteInstanceIdentifiersSlot request. The method always -// closes the http.Response Body. -func (client SitesClient) GetSiteInstanceIdentifiersSlotResponder(resp *http.Response) (result SiteInstanceCollection, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetSiteInstanceIdentifiersSlotNextResults retrieves the next set of results, if any. -func (client SitesClient) GetSiteInstanceIdentifiersSlotNextResults(lastResults SiteInstanceCollection) (result SiteInstanceCollection, err error) { - req, err := lastResults.SiteInstanceCollectionPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "web.SitesClient", "GetSiteInstanceIdentifiersSlot", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.GetSiteInstanceIdentifiersSlotSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.SitesClient", "GetSiteInstanceIdentifiersSlot", resp, "Failure sending next results request") - } - - result, err = client.GetSiteInstanceIdentifiersSlotResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.SitesClient", "GetSiteInstanceIdentifiersSlot", resp, "Failure responding to next results request") - } - - return -} - -// GetSiteLogsConfig sends the get site logs config request. -// -// resourceGroupName is name of resource group name is name of web app -func (client SitesClient) GetSiteLogsConfig(resourceGroupName string, name string) (result SiteLogsConfig, err error) { - req, err := client.GetSiteLogsConfigPreparer(resourceGroupName, name) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.SitesClient", "GetSiteLogsConfig", nil, "Failure preparing request") - } - - resp, err := client.GetSiteLogsConfigSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.SitesClient", "GetSiteLogsConfig", resp, "Failure sending request") - } - - result, err = client.GetSiteLogsConfigResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.SitesClient", "GetSiteLogsConfig", resp, "Failure responding to request") - } - - return -} - -// GetSiteLogsConfigPreparer prepares the GetSiteLogsConfig request. -func (client SitesClient) GetSiteLogsConfigPreparer(resourceGroupName string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/logs", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSiteLogsConfigSender sends the GetSiteLogsConfig request. The method will close the -// http.Response Body if it receives an error. -func (client SitesClient) GetSiteLogsConfigSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetSiteLogsConfigResponder handles the response to the GetSiteLogsConfig request. The method always -// closes the http.Response Body. -func (client SitesClient) GetSiteLogsConfigResponder(resp *http.Response) (result SiteLogsConfig, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetSiteLogsConfigSlot sends the get site logs config slot request. -// -// resourceGroupName is name of resource group name is name of web app slot is -// name of web app slot. If not specified then will default to production slot. -func (client SitesClient) GetSiteLogsConfigSlot(resourceGroupName string, name string, slot string) (result SiteLogsConfig, err error) { - req, err := client.GetSiteLogsConfigSlotPreparer(resourceGroupName, name, slot) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.SitesClient", "GetSiteLogsConfigSlot", nil, "Failure preparing request") - } - - resp, err := client.GetSiteLogsConfigSlotSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.SitesClient", "GetSiteLogsConfigSlot", resp, "Failure sending request") - } - - result, err = client.GetSiteLogsConfigSlotResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.SitesClient", "GetSiteLogsConfigSlot", resp, "Failure responding to request") - } - - return -} - -// GetSiteLogsConfigSlotPreparer prepares the GetSiteLogsConfigSlot request. -func (client SitesClient) GetSiteLogsConfigSlotPreparer(resourceGroupName string, name string, slot string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "slot": autorest.Encode("path", slot), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/logs", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSiteLogsConfigSlotSender sends the GetSiteLogsConfigSlot request. The method will close the -// http.Response Body if it receives an error. -func (client SitesClient) GetSiteLogsConfigSlotSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetSiteLogsConfigSlotResponder handles the response to the GetSiteLogsConfigSlot request. The method always -// closes the http.Response Body. -func (client SitesClient) GetSiteLogsConfigSlotResponder(resp *http.Response) (result SiteLogsConfig, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetSiteMetricDefinitions sends the get site metric definitions request. -// -// resourceGroupName is name of resource group name is name of web app -func (client SitesClient) GetSiteMetricDefinitions(resourceGroupName string, name string) (result MetricDefinitionCollection, err error) { - req, err := client.GetSiteMetricDefinitionsPreparer(resourceGroupName, name) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.SitesClient", "GetSiteMetricDefinitions", nil, "Failure preparing request") - } - - resp, err := client.GetSiteMetricDefinitionsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.SitesClient", "GetSiteMetricDefinitions", resp, "Failure sending request") - } - - result, err = client.GetSiteMetricDefinitionsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.SitesClient", "GetSiteMetricDefinitions", resp, "Failure responding to request") - } - - return -} - -// GetSiteMetricDefinitionsPreparer prepares the GetSiteMetricDefinitions request. -func (client SitesClient) GetSiteMetricDefinitionsPreparer(resourceGroupName string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/metricdefinitions", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSiteMetricDefinitionsSender sends the GetSiteMetricDefinitions request. The method will close the -// http.Response Body if it receives an error. -func (client SitesClient) GetSiteMetricDefinitionsSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetSiteMetricDefinitionsResponder handles the response to the GetSiteMetricDefinitions request. The method always -// closes the http.Response Body. -func (client SitesClient) GetSiteMetricDefinitionsResponder(resp *http.Response) (result MetricDefinitionCollection, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetSiteMetricDefinitionsNextResults retrieves the next set of results, if any. -func (client SitesClient) GetSiteMetricDefinitionsNextResults(lastResults MetricDefinitionCollection) (result MetricDefinitionCollection, err error) { - req, err := lastResults.MetricDefinitionCollectionPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "web.SitesClient", "GetSiteMetricDefinitions", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.GetSiteMetricDefinitionsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.SitesClient", "GetSiteMetricDefinitions", resp, "Failure sending next results request") - } - - result, err = client.GetSiteMetricDefinitionsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.SitesClient", "GetSiteMetricDefinitions", resp, "Failure responding to next results request") - } - - return -} - -// GetSiteMetricDefinitionsSlot sends the get site metric definitions slot -// request. -// -// resourceGroupName is name of resource group name is name of web app slot is -// name of web app slot. If not specified then will default to production slot. -func (client SitesClient) GetSiteMetricDefinitionsSlot(resourceGroupName string, name string, slot string) (result MetricDefinitionCollection, err error) { - req, err := client.GetSiteMetricDefinitionsSlotPreparer(resourceGroupName, name, slot) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.SitesClient", "GetSiteMetricDefinitionsSlot", nil, "Failure preparing request") - } - - resp, err := client.GetSiteMetricDefinitionsSlotSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.SitesClient", "GetSiteMetricDefinitionsSlot", resp, "Failure sending request") - } - - result, err = client.GetSiteMetricDefinitionsSlotResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.SitesClient", "GetSiteMetricDefinitionsSlot", resp, "Failure responding to request") - } - - return -} - -// GetSiteMetricDefinitionsSlotPreparer prepares the GetSiteMetricDefinitionsSlot request. -func (client SitesClient) GetSiteMetricDefinitionsSlotPreparer(resourceGroupName string, name string, slot string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "slot": autorest.Encode("path", slot), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/metricdefinitions", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSiteMetricDefinitionsSlotSender sends the GetSiteMetricDefinitionsSlot request. The method will close the -// http.Response Body if it receives an error. -func (client SitesClient) GetSiteMetricDefinitionsSlotSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetSiteMetricDefinitionsSlotResponder handles the response to the GetSiteMetricDefinitionsSlot request. The method always -// closes the http.Response Body. -func (client SitesClient) GetSiteMetricDefinitionsSlotResponder(resp *http.Response) (result MetricDefinitionCollection, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetSiteMetricDefinitionsSlotNextResults retrieves the next set of results, if any. -func (client SitesClient) GetSiteMetricDefinitionsSlotNextResults(lastResults MetricDefinitionCollection) (result MetricDefinitionCollection, err error) { - req, err := lastResults.MetricDefinitionCollectionPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "web.SitesClient", "GetSiteMetricDefinitionsSlot", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.GetSiteMetricDefinitionsSlotSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.SitesClient", "GetSiteMetricDefinitionsSlot", resp, "Failure sending next results request") - } - - result, err = client.GetSiteMetricDefinitionsSlotResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.SitesClient", "GetSiteMetricDefinitionsSlot", resp, "Failure responding to next results request") - } - - return -} - -// GetSiteMetrics sends the get site metrics request. -// -// resourceGroupName is name of resource group name is name of web app details -// is if true, metric details are included in response filter is return only -// usages/metrics specified in the filter. Filter conforms to odata syntax. -// Example: $filter=(name.value eq 'Metric1' or name.value eq 'Metric2') and -// startTime eq '2014-01-01T00:00:00Z' and endTime eq '2014-12-31T23:59:59Z' -// and timeGrain eq duration'[Hour|Minute|Day]'. -func (client SitesClient) GetSiteMetrics(resourceGroupName string, name string, details *bool, filter string) (result ResourceMetricCollection, err error) { - req, err := client.GetSiteMetricsPreparer(resourceGroupName, name, details, filter) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.SitesClient", "GetSiteMetrics", nil, "Failure preparing request") - } - - resp, err := client.GetSiteMetricsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.SitesClient", "GetSiteMetrics", resp, "Failure sending request") - } - - result, err = client.GetSiteMetricsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.SitesClient", "GetSiteMetrics", resp, "Failure responding to request") - } - - return -} - -// GetSiteMetricsPreparer prepares the GetSiteMetrics request. -func (client SitesClient) GetSiteMetricsPreparer(resourceGroupName string, name string, details *bool, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - if details != nil { - queryParameters["details"] = autorest.Encode("query", *details) - } - if len(filter) > 0 { - queryParameters["$filter"] = filter - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/metrics", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSiteMetricsSender sends the GetSiteMetrics request. The method will close the -// http.Response Body if it receives an error. -func (client SitesClient) GetSiteMetricsSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetSiteMetricsResponder handles the response to the GetSiteMetrics request. The method always -// closes the http.Response Body. -func (client SitesClient) GetSiteMetricsResponder(resp *http.Response) (result ResourceMetricCollection, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetSiteMetricsNextResults retrieves the next set of results, if any. -func (client SitesClient) GetSiteMetricsNextResults(lastResults ResourceMetricCollection) (result ResourceMetricCollection, err error) { - req, err := lastResults.ResourceMetricCollectionPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "web.SitesClient", "GetSiteMetrics", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.GetSiteMetricsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.SitesClient", "GetSiteMetrics", resp, "Failure sending next results request") - } - - result, err = client.GetSiteMetricsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.SitesClient", "GetSiteMetrics", resp, "Failure responding to next results request") - } - - return -} - -// GetSiteMetricsSlot sends the get site metrics slot request. -// -// resourceGroupName is name of resource group name is name of web app slot is -// name of web app slot. If not specified then will default to production slot. -// details is if true, metric details are included in response filter is return -// only usages/metrics specified in the filter. Filter conforms to odata -// syntax. Example: $filter=(name.value eq 'Metric1' or name.value eq -// 'Metric2') and startTime eq '2014-01-01T00:00:00Z' and endTime eq -// '2014-12-31T23:59:59Z' and timeGrain eq duration'[Hour|Minute|Day]'. -func (client SitesClient) GetSiteMetricsSlot(resourceGroupName string, name string, slot string, details *bool, filter string) (result ResourceMetricCollection, err error) { - req, err := client.GetSiteMetricsSlotPreparer(resourceGroupName, name, slot, details, filter) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.SitesClient", "GetSiteMetricsSlot", nil, "Failure preparing request") - } - - resp, err := client.GetSiteMetricsSlotSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.SitesClient", "GetSiteMetricsSlot", resp, "Failure sending request") - } - - result, err = client.GetSiteMetricsSlotResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.SitesClient", "GetSiteMetricsSlot", resp, "Failure responding to request") - } - - return -} - -// GetSiteMetricsSlotPreparer prepares the GetSiteMetricsSlot request. -func (client SitesClient) GetSiteMetricsSlotPreparer(resourceGroupName string, name string, slot string, details *bool, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "slot": autorest.Encode("path", slot), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - if details != nil { - queryParameters["details"] = autorest.Encode("query", *details) - } - if len(filter) > 0 { - queryParameters["$filter"] = filter - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/metrics", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSiteMetricsSlotSender sends the GetSiteMetricsSlot request. The method will close the -// http.Response Body if it receives an error. -func (client SitesClient) GetSiteMetricsSlotSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetSiteMetricsSlotResponder handles the response to the GetSiteMetricsSlot request. The method always -// closes the http.Response Body. -func (client SitesClient) GetSiteMetricsSlotResponder(resp *http.Response) (result ResourceMetricCollection, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetSiteMetricsSlotNextResults retrieves the next set of results, if any. -func (client SitesClient) GetSiteMetricsSlotNextResults(lastResults ResourceMetricCollection) (result ResourceMetricCollection, err error) { - req, err := lastResults.ResourceMetricCollectionPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "web.SitesClient", "GetSiteMetricsSlot", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.GetSiteMetricsSlotSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.SitesClient", "GetSiteMetricsSlot", resp, "Failure sending next results request") - } - - result, err = client.GetSiteMetricsSlotResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.SitesClient", "GetSiteMetricsSlot", resp, "Failure responding to next results request") - } - - return -} - -// GetSiteNetworkFeatures sends the get site network features request. -// -// resourceGroupName is the resource group name name is the name of the web app -// view is the type of view. This can either be "summary" or "detailed". -func (client SitesClient) GetSiteNetworkFeatures(resourceGroupName string, name string, view string) (result NetworkFeatures, err error) { - req, err := client.GetSiteNetworkFeaturesPreparer(resourceGroupName, name, view) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.SitesClient", "GetSiteNetworkFeatures", nil, "Failure preparing request") - } - - resp, err := client.GetSiteNetworkFeaturesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.SitesClient", "GetSiteNetworkFeatures", resp, "Failure sending request") - } - - result, err = client.GetSiteNetworkFeaturesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.SitesClient", "GetSiteNetworkFeatures", resp, "Failure responding to request") - } - - return -} - -// GetSiteNetworkFeaturesPreparer prepares the GetSiteNetworkFeatures request. -func (client SitesClient) GetSiteNetworkFeaturesPreparer(resourceGroupName string, name string, view string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "view": autorest.Encode("path", view), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/networkFeatures/{view}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSiteNetworkFeaturesSender sends the GetSiteNetworkFeatures request. The method will close the -// http.Response Body if it receives an error. -func (client SitesClient) GetSiteNetworkFeaturesSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetSiteNetworkFeaturesResponder handles the response to the GetSiteNetworkFeatures request. The method always -// closes the http.Response Body. -func (client SitesClient) GetSiteNetworkFeaturesResponder(resp *http.Response) (result NetworkFeatures, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNotFound), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetSiteNetworkFeaturesSlot sends the get site network features slot request. -// -// resourceGroupName is the resource group name name is the name of the web app -// view is the type of view. This can either be "summary" or "detailed". slot -// is the name of the slot for this web app. -func (client SitesClient) GetSiteNetworkFeaturesSlot(resourceGroupName string, name string, view string, slot string) (result NetworkFeatures, err error) { - req, err := client.GetSiteNetworkFeaturesSlotPreparer(resourceGroupName, name, view, slot) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.SitesClient", "GetSiteNetworkFeaturesSlot", nil, "Failure preparing request") - } - - resp, err := client.GetSiteNetworkFeaturesSlotSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.SitesClient", "GetSiteNetworkFeaturesSlot", resp, "Failure sending request") - } - - result, err = client.GetSiteNetworkFeaturesSlotResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.SitesClient", "GetSiteNetworkFeaturesSlot", resp, "Failure responding to request") - } - - return -} - -// GetSiteNetworkFeaturesSlotPreparer prepares the GetSiteNetworkFeaturesSlot request. -func (client SitesClient) GetSiteNetworkFeaturesSlotPreparer(resourceGroupName string, name string, view string, slot string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "slot": autorest.Encode("path", slot), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "view": autorest.Encode("path", view), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/networkFeatures/{view}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSiteNetworkFeaturesSlotSender sends the GetSiteNetworkFeaturesSlot request. The method will close the -// http.Response Body if it receives an error. -func (client SitesClient) GetSiteNetworkFeaturesSlotSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetSiteNetworkFeaturesSlotResponder handles the response to the GetSiteNetworkFeaturesSlot request. The method always -// closes the http.Response Body. -func (client SitesClient) GetSiteNetworkFeaturesSlotResponder(resp *http.Response) (result NetworkFeatures, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNotFound), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetSiteOperation sends the get site operation request. -// -// resourceGroupName is name of resource group name is name of web app -// operationID is id of an operation -func (client SitesClient) GetSiteOperation(resourceGroupName string, name string, operationID string) (result SetObject, err error) { - req, err := client.GetSiteOperationPreparer(resourceGroupName, name, operationID) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.SitesClient", "GetSiteOperation", nil, "Failure preparing request") - } - - resp, err := client.GetSiteOperationSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.SitesClient", "GetSiteOperation", resp, "Failure sending request") - } - - result, err = client.GetSiteOperationResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.SitesClient", "GetSiteOperation", resp, "Failure responding to request") - } - - return -} - -// GetSiteOperationPreparer prepares the GetSiteOperation request. -func (client SitesClient) GetSiteOperationPreparer(resourceGroupName string, name string, operationID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "operationId": autorest.Encode("path", operationID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/operationresults/{operationId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSiteOperationSender sends the GetSiteOperation request. The method will close the -// http.Response Body if it receives an error. -func (client SitesClient) GetSiteOperationSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetSiteOperationResponder handles the response to the GetSiteOperation request. The method always -// closes the http.Response Body. -func (client SitesClient) GetSiteOperationResponder(resp *http.Response) (result SetObject, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Value), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetSiteOperationSlot sends the get site operation slot request. -// -// resourceGroupName is name of resource group name is name of web app -// operationID is id of an operation slot is name of web app slot. If not -// specified then will default to production slot. -func (client SitesClient) GetSiteOperationSlot(resourceGroupName string, name string, operationID string, slot string) (result SetObject, err error) { - req, err := client.GetSiteOperationSlotPreparer(resourceGroupName, name, operationID, slot) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.SitesClient", "GetSiteOperationSlot", nil, "Failure preparing request") - } - - resp, err := client.GetSiteOperationSlotSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.SitesClient", "GetSiteOperationSlot", resp, "Failure sending request") - } - - result, err = client.GetSiteOperationSlotResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.SitesClient", "GetSiteOperationSlot", resp, "Failure responding to request") - } - - return -} - -// GetSiteOperationSlotPreparer prepares the GetSiteOperationSlot request. -func (client SitesClient) GetSiteOperationSlotPreparer(resourceGroupName string, name string, operationID string, slot string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "operationId": autorest.Encode("path", operationID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "slot": autorest.Encode("path", slot), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/operationresults/{operationId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSiteOperationSlotSender sends the GetSiteOperationSlot request. The method will close the -// http.Response Body if it receives an error. -func (client SitesClient) GetSiteOperationSlotSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetSiteOperationSlotResponder handles the response to the GetSiteOperationSlot request. The method always -// closes the http.Response Body. -func (client SitesClient) GetSiteOperationSlotResponder(resp *http.Response) (result SetObject, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Value), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetSitePremierAddOn sends the get site premier add on request. -// -func (client SitesClient) GetSitePremierAddOn(resourceGroupName string, name string, premierAddOnName string) (result SetObject, err error) { - req, err := client.GetSitePremierAddOnPreparer(resourceGroupName, name, premierAddOnName) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.SitesClient", "GetSitePremierAddOn", nil, "Failure preparing request") - } - - resp, err := client.GetSitePremierAddOnSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.SitesClient", "GetSitePremierAddOn", resp, "Failure sending request") - } - - result, err = client.GetSitePremierAddOnResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.SitesClient", "GetSitePremierAddOn", resp, "Failure responding to request") - } - - return -} - -// GetSitePremierAddOnPreparer prepares the GetSitePremierAddOn request. -func (client SitesClient) GetSitePremierAddOnPreparer(resourceGroupName string, name string, premierAddOnName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "premierAddOnName": autorest.Encode("path", premierAddOnName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/premieraddons/{premierAddOnName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSitePremierAddOnSender sends the GetSitePremierAddOn request. The method will close the -// http.Response Body if it receives an error. -func (client SitesClient) GetSitePremierAddOnSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetSitePremierAddOnResponder handles the response to the GetSitePremierAddOn request. The method always -// closes the http.Response Body. -func (client SitesClient) GetSitePremierAddOnResponder(resp *http.Response) (result SetObject, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Value), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetSitePremierAddOnSlot sends the get site premier add on slot request. -// -func (client SitesClient) GetSitePremierAddOnSlot(resourceGroupName string, name string, premierAddOnName string, slot string) (result SetObject, err error) { - req, err := client.GetSitePremierAddOnSlotPreparer(resourceGroupName, name, premierAddOnName, slot) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.SitesClient", "GetSitePremierAddOnSlot", nil, "Failure preparing request") - } - - resp, err := client.GetSitePremierAddOnSlotSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.SitesClient", "GetSitePremierAddOnSlot", resp, "Failure sending request") - } - - result, err = client.GetSitePremierAddOnSlotResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.SitesClient", "GetSitePremierAddOnSlot", resp, "Failure responding to request") - } - - return -} - -// GetSitePremierAddOnSlotPreparer prepares the GetSitePremierAddOnSlot request. -func (client SitesClient) GetSitePremierAddOnSlotPreparer(resourceGroupName string, name string, premierAddOnName string, slot string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "premierAddOnName": autorest.Encode("path", premierAddOnName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "slot": autorest.Encode("path", slot), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/premieraddons/{premierAddOnName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSitePremierAddOnSlotSender sends the GetSitePremierAddOnSlot request. The method will close the -// http.Response Body if it receives an error. -func (client SitesClient) GetSitePremierAddOnSlotSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetSitePremierAddOnSlotResponder handles the response to the GetSitePremierAddOnSlot request. The method always -// closes the http.Response Body. -func (client SitesClient) GetSitePremierAddOnSlotResponder(resp *http.Response) (result SetObject, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Value), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetSiteRelayServiceConnection sends the get site relay service connection -// request. -// -// resourceGroupName is the resource group name name is the name of the web app -// entityName is the name by which the Hybrid Connection is identified -func (client SitesClient) GetSiteRelayServiceConnection(resourceGroupName string, name string, entityName string) (result RelayServiceConnectionEntity, err error) { - req, err := client.GetSiteRelayServiceConnectionPreparer(resourceGroupName, name, entityName) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.SitesClient", "GetSiteRelayServiceConnection", nil, "Failure preparing request") - } - - resp, err := client.GetSiteRelayServiceConnectionSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.SitesClient", "GetSiteRelayServiceConnection", resp, "Failure sending request") - } - - result, err = client.GetSiteRelayServiceConnectionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.SitesClient", "GetSiteRelayServiceConnection", resp, "Failure responding to request") - } - - return -} - -// GetSiteRelayServiceConnectionPreparer prepares the GetSiteRelayServiceConnection request. -func (client SitesClient) GetSiteRelayServiceConnectionPreparer(resourceGroupName string, name string, entityName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "entityName": autorest.Encode("path", entityName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/hybridconnection/{entityName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSiteRelayServiceConnectionSender sends the GetSiteRelayServiceConnection request. The method will close the -// http.Response Body if it receives an error. -func (client SitesClient) GetSiteRelayServiceConnectionSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetSiteRelayServiceConnectionResponder handles the response to the GetSiteRelayServiceConnection request. The method always -// closes the http.Response Body. -func (client SitesClient) GetSiteRelayServiceConnectionResponder(resp *http.Response) (result RelayServiceConnectionEntity, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetSiteRelayServiceConnectionSlot sends the get site relay service -// connection slot request. -// -// resourceGroupName is the resource group name name is the name of the web app -// entityName is the name by which the Hybrid Connection is identified slot is -// the name of the slot for the web app. -func (client SitesClient) GetSiteRelayServiceConnectionSlot(resourceGroupName string, name string, entityName string, slot string) (result RelayServiceConnectionEntity, err error) { - req, err := client.GetSiteRelayServiceConnectionSlotPreparer(resourceGroupName, name, entityName, slot) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.SitesClient", "GetSiteRelayServiceConnectionSlot", nil, "Failure preparing request") - } - - resp, err := client.GetSiteRelayServiceConnectionSlotSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.SitesClient", "GetSiteRelayServiceConnectionSlot", resp, "Failure sending request") - } - - result, err = client.GetSiteRelayServiceConnectionSlotResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.SitesClient", "GetSiteRelayServiceConnectionSlot", resp, "Failure responding to request") - } - - return -} - -// GetSiteRelayServiceConnectionSlotPreparer prepares the GetSiteRelayServiceConnectionSlot request. -func (client SitesClient) GetSiteRelayServiceConnectionSlotPreparer(resourceGroupName string, name string, entityName string, slot string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "entityName": autorest.Encode("path", entityName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "slot": autorest.Encode("path", slot), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/hybridconnection/{entityName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSiteRelayServiceConnectionSlotSender sends the GetSiteRelayServiceConnectionSlot request. The method will close the -// http.Response Body if it receives an error. -func (client SitesClient) GetSiteRelayServiceConnectionSlotSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetSiteRelayServiceConnectionSlotResponder handles the response to the GetSiteRelayServiceConnectionSlot request. The method always -// closes the http.Response Body. -func (client SitesClient) GetSiteRelayServiceConnectionSlotResponder(resp *http.Response) (result RelayServiceConnectionEntity, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetSites sends the get sites request. -// -// resourceGroupName is name of resource group propertiesToInclude is -// additional web app properties included in the response includeSiteTypes is -// types of apps included in the response includeSlots is whether or not to -// include deployments slots in results -func (client SitesClient) GetSites(resourceGroupName string, propertiesToInclude string, includeSiteTypes string, includeSlots *bool) (result SiteCollection, err error) { - req, err := client.GetSitesPreparer(resourceGroupName, propertiesToInclude, includeSiteTypes, includeSlots) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.SitesClient", "GetSites", nil, "Failure preparing request") - } - - resp, err := client.GetSitesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.SitesClient", "GetSites", resp, "Failure sending request") - } - - result, err = client.GetSitesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.SitesClient", "GetSites", resp, "Failure responding to request") - } - - return -} - -// GetSitesPreparer prepares the GetSites request. -func (client SitesClient) GetSitesPreparer(resourceGroupName string, propertiesToInclude string, includeSiteTypes string, includeSlots *bool) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - if len(propertiesToInclude) > 0 { - queryParameters["propertiesToInclude"] = autorest.Encode("query", propertiesToInclude) - } - if len(includeSiteTypes) > 0 { - queryParameters["includeSiteTypes"] = autorest.Encode("query", includeSiteTypes) - } - if includeSlots != nil { - queryParameters["includeSlots"] = autorest.Encode("query", *includeSlots) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSitesSender sends the GetSites request. The method will close the -// http.Response Body if it receives an error. -func (client SitesClient) GetSitesSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetSitesResponder handles the response to the GetSites request. The method always -// closes the http.Response Body. -func (client SitesClient) GetSitesResponder(resp *http.Response) (result SiteCollection, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetSitesNextResults retrieves the next set of results, if any. -func (client SitesClient) GetSitesNextResults(lastResults SiteCollection) (result SiteCollection, err error) { - req, err := lastResults.SiteCollectionPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "web.SitesClient", "GetSites", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.GetSitesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.SitesClient", "GetSites", resp, "Failure sending next results request") - } - - result, err = client.GetSitesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.SitesClient", "GetSites", resp, "Failure responding to next results request") - } - - return -} - -// GetSiteSlot sends the get site slot request. -// -// resourceGroupName is name of resource group name is name of web app slot is -// name of web app slot. If not specified then will default to production slot. -// propertiesToInclude is additional web app properties included in the -// response -func (client SitesClient) GetSiteSlot(resourceGroupName string, name string, slot string, propertiesToInclude string) (result Site, err error) { - req, err := client.GetSiteSlotPreparer(resourceGroupName, name, slot, propertiesToInclude) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.SitesClient", "GetSiteSlot", nil, "Failure preparing request") - } - - resp, err := client.GetSiteSlotSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.SitesClient", "GetSiteSlot", resp, "Failure sending request") - } - - result, err = client.GetSiteSlotResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.SitesClient", "GetSiteSlot", resp, "Failure responding to request") - } - - return -} - -// GetSiteSlotPreparer prepares the GetSiteSlot request. -func (client SitesClient) GetSiteSlotPreparer(resourceGroupName string, name string, slot string, propertiesToInclude string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "slot": autorest.Encode("path", slot), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - if len(propertiesToInclude) > 0 { - queryParameters["propertiesToInclude"] = autorest.Encode("query", propertiesToInclude) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSiteSlotSender sends the GetSiteSlot request. The method will close the -// http.Response Body if it receives an error. -func (client SitesClient) GetSiteSlotSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetSiteSlotResponder handles the response to the GetSiteSlot request. The method always -// closes the http.Response Body. -func (client SitesClient) GetSiteSlotResponder(resp *http.Response) (result Site, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetSiteSlots sends the get site slots request. -// -// resourceGroupName is name of resource group name is name of web app -// propertiesToInclude is list of app properties to include in the response -func (client SitesClient) GetSiteSlots(resourceGroupName string, name string, propertiesToInclude string) (result SiteCollection, err error) { - req, err := client.GetSiteSlotsPreparer(resourceGroupName, name, propertiesToInclude) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.SitesClient", "GetSiteSlots", nil, "Failure preparing request") - } - - resp, err := client.GetSiteSlotsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.SitesClient", "GetSiteSlots", resp, "Failure sending request") - } - - result, err = client.GetSiteSlotsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.SitesClient", "GetSiteSlots", resp, "Failure responding to request") - } - - return -} - -// GetSiteSlotsPreparer prepares the GetSiteSlots request. -func (client SitesClient) GetSiteSlotsPreparer(resourceGroupName string, name string, propertiesToInclude string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - if len(propertiesToInclude) > 0 { - queryParameters["propertiesToInclude"] = autorest.Encode("query", propertiesToInclude) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSiteSlotsSender sends the GetSiteSlots request. The method will close the -// http.Response Body if it receives an error. -func (client SitesClient) GetSiteSlotsSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetSiteSlotsResponder handles the response to the GetSiteSlots request. The method always -// closes the http.Response Body. -func (client SitesClient) GetSiteSlotsResponder(resp *http.Response) (result SiteCollection, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetSiteSlotsNextResults retrieves the next set of results, if any. -func (client SitesClient) GetSiteSlotsNextResults(lastResults SiteCollection) (result SiteCollection, err error) { - req, err := lastResults.SiteCollectionPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "web.SitesClient", "GetSiteSlots", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.GetSiteSlotsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.SitesClient", "GetSiteSlots", resp, "Failure sending next results request") - } - - result, err = client.GetSiteSlotsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.SitesClient", "GetSiteSlots", resp, "Failure responding to next results request") - } - - return -} - -// GetSiteSnapshots sends the get site snapshots request. -// -// resourceGroupName is webspace name is website Name -func (client SitesClient) GetSiteSnapshots(resourceGroupName string, name string) (result SetObject, err error) { - req, err := client.GetSiteSnapshotsPreparer(resourceGroupName, name) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.SitesClient", "GetSiteSnapshots", nil, "Failure preparing request") - } - - resp, err := client.GetSiteSnapshotsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.SitesClient", "GetSiteSnapshots", resp, "Failure sending request") - } - - result, err = client.GetSiteSnapshotsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.SitesClient", "GetSiteSnapshots", resp, "Failure responding to request") - } - - return -} - -// GetSiteSnapshotsPreparer prepares the GetSiteSnapshots request. -func (client SitesClient) GetSiteSnapshotsPreparer(resourceGroupName string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/snapshots", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSiteSnapshotsSender sends the GetSiteSnapshots request. The method will close the -// http.Response Body if it receives an error. -func (client SitesClient) GetSiteSnapshotsSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetSiteSnapshotsResponder handles the response to the GetSiteSnapshots request. The method always -// closes the http.Response Body. -func (client SitesClient) GetSiteSnapshotsResponder(resp *http.Response) (result SetObject, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Value), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetSiteSnapshotsSlot sends the get site snapshots slot request. -// -// resourceGroupName is webspace name is website Name slot is website Slot -func (client SitesClient) GetSiteSnapshotsSlot(resourceGroupName string, name string, slot string) (result SetObject, err error) { - req, err := client.GetSiteSnapshotsSlotPreparer(resourceGroupName, name, slot) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.SitesClient", "GetSiteSnapshotsSlot", nil, "Failure preparing request") - } - - resp, err := client.GetSiteSnapshotsSlotSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.SitesClient", "GetSiteSnapshotsSlot", resp, "Failure sending request") - } - - result, err = client.GetSiteSnapshotsSlotResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.SitesClient", "GetSiteSnapshotsSlot", resp, "Failure responding to request") - } - - return -} - -// GetSiteSnapshotsSlotPreparer prepares the GetSiteSnapshotsSlot request. -func (client SitesClient) GetSiteSnapshotsSlotPreparer(resourceGroupName string, name string, slot string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "slot": autorest.Encode("path", slot), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/snapshots", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSiteSnapshotsSlotSender sends the GetSiteSnapshotsSlot request. The method will close the -// http.Response Body if it receives an error. -func (client SitesClient) GetSiteSnapshotsSlotSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetSiteSnapshotsSlotResponder handles the response to the GetSiteSnapshotsSlot request. The method always -// closes the http.Response Body. -func (client SitesClient) GetSiteSnapshotsSlotResponder(resp *http.Response) (result SetObject, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Value), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetSiteSourceControl sends the get site source control request. -// -// resourceGroupName is name of resource group name is name of web app -func (client SitesClient) GetSiteSourceControl(resourceGroupName string, name string) (result SiteSourceControl, err error) { - req, err := client.GetSiteSourceControlPreparer(resourceGroupName, name) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.SitesClient", "GetSiteSourceControl", nil, "Failure preparing request") - } - - resp, err := client.GetSiteSourceControlSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.SitesClient", "GetSiteSourceControl", resp, "Failure sending request") - } - - result, err = client.GetSiteSourceControlResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.SitesClient", "GetSiteSourceControl", resp, "Failure responding to request") - } - - return -} - -// GetSiteSourceControlPreparer prepares the GetSiteSourceControl request. -func (client SitesClient) GetSiteSourceControlPreparer(resourceGroupName string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/sourcecontrols/web", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSiteSourceControlSender sends the GetSiteSourceControl request. The method will close the -// http.Response Body if it receives an error. -func (client SitesClient) GetSiteSourceControlSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetSiteSourceControlResponder handles the response to the GetSiteSourceControl request. The method always -// closes the http.Response Body. -func (client SitesClient) GetSiteSourceControlResponder(resp *http.Response) (result SiteSourceControl, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetSiteSourceControlSlot sends the get site source control slot request. -// -// resourceGroupName is name of resource group name is name of web app slot is -// name of web app slot. If not specified then will default to production slot. -func (client SitesClient) GetSiteSourceControlSlot(resourceGroupName string, name string, slot string) (result SiteSourceControl, err error) { - req, err := client.GetSiteSourceControlSlotPreparer(resourceGroupName, name, slot) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.SitesClient", "GetSiteSourceControlSlot", nil, "Failure preparing request") - } - - resp, err := client.GetSiteSourceControlSlotSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.SitesClient", "GetSiteSourceControlSlot", resp, "Failure sending request") - } - - result, err = client.GetSiteSourceControlSlotResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.SitesClient", "GetSiteSourceControlSlot", resp, "Failure responding to request") - } - - return -} - -// GetSiteSourceControlSlotPreparer prepares the GetSiteSourceControlSlot request. -func (client SitesClient) GetSiteSourceControlSlotPreparer(resourceGroupName string, name string, slot string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "slot": autorest.Encode("path", slot), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/sourcecontrols/web", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSiteSourceControlSlotSender sends the GetSiteSourceControlSlot request. The method will close the -// http.Response Body if it receives an error. -func (client SitesClient) GetSiteSourceControlSlotSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetSiteSourceControlSlotResponder handles the response to the GetSiteSourceControlSlot request. The method always -// closes the http.Response Body. -func (client SitesClient) GetSiteSourceControlSlotResponder(resp *http.Response) (result SiteSourceControl, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetSiteUsages sends the get site usages request. -// -// resourceGroupName is name of resource group name is name of web app filter -// is return only usages specified in the filter. Filter is specified by using -// OData syntax. Example: $filter=(name.value eq 'Metric1' or name.value eq -// 'Metric2') and startTime eq '2014-01-01T00:00:00Z' and endTime eq -// '2014-12-31T23:59:59Z' and timeGrain eq duration'[Hour|Minute|Day]'. -func (client SitesClient) GetSiteUsages(resourceGroupName string, name string, filter string) (result CsmUsageQuotaCollection, err error) { - req, err := client.GetSiteUsagesPreparer(resourceGroupName, name, filter) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.SitesClient", "GetSiteUsages", nil, "Failure preparing request") - } - - resp, err := client.GetSiteUsagesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.SitesClient", "GetSiteUsages", resp, "Failure sending request") - } - - result, err = client.GetSiteUsagesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.SitesClient", "GetSiteUsages", resp, "Failure responding to request") - } - - return -} - -// GetSiteUsagesPreparer prepares the GetSiteUsages request. -func (client SitesClient) GetSiteUsagesPreparer(resourceGroupName string, name string, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.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.Web/sites/{name}/usages", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSiteUsagesSender sends the GetSiteUsages request. The method will close the -// http.Response Body if it receives an error. -func (client SitesClient) GetSiteUsagesSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetSiteUsagesResponder handles the response to the GetSiteUsages request. The method always -// closes the http.Response Body. -func (client SitesClient) GetSiteUsagesResponder(resp *http.Response) (result CsmUsageQuotaCollection, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetSiteUsagesNextResults retrieves the next set of results, if any. -func (client SitesClient) GetSiteUsagesNextResults(lastResults CsmUsageQuotaCollection) (result CsmUsageQuotaCollection, err error) { - req, err := lastResults.CsmUsageQuotaCollectionPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "web.SitesClient", "GetSiteUsages", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.GetSiteUsagesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.SitesClient", "GetSiteUsages", resp, "Failure sending next results request") - } - - result, err = client.GetSiteUsagesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.SitesClient", "GetSiteUsages", resp, "Failure responding to next results request") - } - - return -} - -// GetSiteUsagesSlot sends the get site usages slot request. -// -// resourceGroupName is name of resource group name is name of web app slot is -// name of web app slot. If not specified then will default to production slot. -// filter is return only usages specified in the filter. Filter is specified by -// using OData syntax. Example: $filter=(name.value eq 'Metric1' or name.value -// eq 'Metric2') and startTime eq '2014-01-01T00:00:00Z' and endTime eq -// '2014-12-31T23:59:59Z' and timeGrain eq duration'[Hour|Minute|Day]'. -func (client SitesClient) GetSiteUsagesSlot(resourceGroupName string, name string, slot string, filter string) (result CsmUsageQuotaCollection, err error) { - req, err := client.GetSiteUsagesSlotPreparer(resourceGroupName, name, slot, filter) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.SitesClient", "GetSiteUsagesSlot", nil, "Failure preparing request") - } - - resp, err := client.GetSiteUsagesSlotSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.SitesClient", "GetSiteUsagesSlot", resp, "Failure sending request") - } - - result, err = client.GetSiteUsagesSlotResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.SitesClient", "GetSiteUsagesSlot", resp, "Failure responding to request") - } - - return -} - -// GetSiteUsagesSlotPreparer prepares the GetSiteUsagesSlot request. -func (client SitesClient) GetSiteUsagesSlotPreparer(resourceGroupName string, name string, slot string, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "slot": autorest.Encode("path", slot), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.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.Web/sites/{name}/slots/{slot}/usages", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSiteUsagesSlotSender sends the GetSiteUsagesSlot request. The method will close the -// http.Response Body if it receives an error. -func (client SitesClient) GetSiteUsagesSlotSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetSiteUsagesSlotResponder handles the response to the GetSiteUsagesSlot request. The method always -// closes the http.Response Body. -func (client SitesClient) GetSiteUsagesSlotResponder(resp *http.Response) (result CsmUsageQuotaCollection, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetSiteUsagesSlotNextResults retrieves the next set of results, if any. -func (client SitesClient) GetSiteUsagesSlotNextResults(lastResults CsmUsageQuotaCollection) (result CsmUsageQuotaCollection, err error) { - req, err := lastResults.CsmUsageQuotaCollectionPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "web.SitesClient", "GetSiteUsagesSlot", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.GetSiteUsagesSlotSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.SitesClient", "GetSiteUsagesSlot", resp, "Failure sending next results request") - } - - result, err = client.GetSiteUsagesSlotResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.SitesClient", "GetSiteUsagesSlot", resp, "Failure responding to next results request") - } - - return -} - -// GetSiteVNETConnection sends the get site vnet connection request. -// -// resourceGroupName is the resource group name name is the name of the web app -// vnetName is the name of the Virtual Network -func (client SitesClient) GetSiteVNETConnection(resourceGroupName string, name string, vnetName string) (result VnetInfo, err error) { - req, err := client.GetSiteVNETConnectionPreparer(resourceGroupName, name, vnetName) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.SitesClient", "GetSiteVNETConnection", nil, "Failure preparing request") - } - - resp, err := client.GetSiteVNETConnectionSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.SitesClient", "GetSiteVNETConnection", resp, "Failure sending request") - } - - result, err = client.GetSiteVNETConnectionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.SitesClient", "GetSiteVNETConnection", resp, "Failure responding to request") - } - - return -} - -// GetSiteVNETConnectionPreparer prepares the GetSiteVNETConnection request. -func (client SitesClient) GetSiteVNETConnectionPreparer(resourceGroupName string, name string, vnetName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vnetName": autorest.Encode("path", vnetName), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/virtualNetworkConnections/{vnetName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSiteVNETConnectionSender sends the GetSiteVNETConnection request. The method will close the -// http.Response Body if it receives an error. -func (client SitesClient) GetSiteVNETConnectionSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetSiteVNETConnectionResponder handles the response to the GetSiteVNETConnection request. The method always -// closes the http.Response Body. -func (client SitesClient) GetSiteVNETConnectionResponder(resp *http.Response) (result VnetInfo, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetSiteVNETConnections sends the get site vnet connections request. -// -// resourceGroupName is the resource group name name is the name of the web app -func (client SitesClient) GetSiteVNETConnections(resourceGroupName string, name string) (result ListVnetInfo, err error) { - req, err := client.GetSiteVNETConnectionsPreparer(resourceGroupName, name) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.SitesClient", "GetSiteVNETConnections", nil, "Failure preparing request") - } - - resp, err := client.GetSiteVNETConnectionsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.SitesClient", "GetSiteVNETConnections", resp, "Failure sending request") - } - - result, err = client.GetSiteVNETConnectionsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.SitesClient", "GetSiteVNETConnections", resp, "Failure responding to request") - } - - return -} - -// GetSiteVNETConnectionsPreparer prepares the GetSiteVNETConnections request. -func (client SitesClient) GetSiteVNETConnectionsPreparer(resourceGroupName string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/virtualNetworkConnections", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSiteVNETConnectionsSender sends the GetSiteVNETConnections request. The method will close the -// http.Response Body if it receives an error. -func (client SitesClient) GetSiteVNETConnectionsSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetSiteVNETConnectionsResponder handles the response to the GetSiteVNETConnections request. The method always -// closes the http.Response Body. -func (client SitesClient) GetSiteVNETConnectionsResponder(resp *http.Response) (result ListVnetInfo, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Value), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetSiteVNETConnectionSlot sends the get site vnet connection slot request. -// -// resourceGroupName is the resource group name name is the name of the web app -// vnetName is the name of the Virtual Network slot is the name of the slot for -// this web app. -func (client SitesClient) GetSiteVNETConnectionSlot(resourceGroupName string, name string, vnetName string, slot string) (result VnetInfo, err error) { - req, err := client.GetSiteVNETConnectionSlotPreparer(resourceGroupName, name, vnetName, slot) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.SitesClient", "GetSiteVNETConnectionSlot", nil, "Failure preparing request") - } - - resp, err := client.GetSiteVNETConnectionSlotSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.SitesClient", "GetSiteVNETConnectionSlot", resp, "Failure sending request") - } - - result, err = client.GetSiteVNETConnectionSlotResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.SitesClient", "GetSiteVNETConnectionSlot", resp, "Failure responding to request") - } - - return -} - -// GetSiteVNETConnectionSlotPreparer prepares the GetSiteVNETConnectionSlot request. -func (client SitesClient) GetSiteVNETConnectionSlotPreparer(resourceGroupName string, name string, vnetName string, slot string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "slot": autorest.Encode("path", slot), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vnetName": autorest.Encode("path", vnetName), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/virtualNetworkConnections/{vnetName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSiteVNETConnectionSlotSender sends the GetSiteVNETConnectionSlot request. The method will close the -// http.Response Body if it receives an error. -func (client SitesClient) GetSiteVNETConnectionSlotSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetSiteVNETConnectionSlotResponder handles the response to the GetSiteVNETConnectionSlot request. The method always -// closes the http.Response Body. -func (client SitesClient) GetSiteVNETConnectionSlotResponder(resp *http.Response) (result VnetInfo, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetSiteVNETConnectionsSlot sends the get site vnet connections slot request. -// -// resourceGroupName is the resource group name name is the name of the web app -// slot is the name of the slot for this web app. -func (client SitesClient) GetSiteVNETConnectionsSlot(resourceGroupName string, name string, slot string) (result ListVnetInfo, err error) { - req, err := client.GetSiteVNETConnectionsSlotPreparer(resourceGroupName, name, slot) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.SitesClient", "GetSiteVNETConnectionsSlot", nil, "Failure preparing request") - } - - resp, err := client.GetSiteVNETConnectionsSlotSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.SitesClient", "GetSiteVNETConnectionsSlot", resp, "Failure sending request") - } - - result, err = client.GetSiteVNETConnectionsSlotResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.SitesClient", "GetSiteVNETConnectionsSlot", resp, "Failure responding to request") - } - - return -} - -// GetSiteVNETConnectionsSlotPreparer prepares the GetSiteVNETConnectionsSlot request. -func (client SitesClient) GetSiteVNETConnectionsSlotPreparer(resourceGroupName string, name string, slot string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "slot": autorest.Encode("path", slot), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/virtualNetworkConnections", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSiteVNETConnectionsSlotSender sends the GetSiteVNETConnectionsSlot request. The method will close the -// http.Response Body if it receives an error. -func (client SitesClient) GetSiteVNETConnectionsSlotSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetSiteVNETConnectionsSlotResponder handles the response to the GetSiteVNETConnectionsSlot request. The method always -// closes the http.Response Body. -func (client SitesClient) GetSiteVNETConnectionsSlotResponder(resp *http.Response) (result ListVnetInfo, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Value), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetSiteVnetGateway sends the get site vnet gateway request. -// -// resourceGroupName is the resource group name name is the name of the web app -// vnetName is the name of the Virtual Network gatewayName is the name of the -// gateway. The only gateway that exists presently is "primary" -func (client SitesClient) GetSiteVnetGateway(resourceGroupName string, name string, vnetName string, gatewayName string) (result SetObject, err error) { - req, err := client.GetSiteVnetGatewayPreparer(resourceGroupName, name, vnetName, gatewayName) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.SitesClient", "GetSiteVnetGateway", nil, "Failure preparing request") - } - - resp, err := client.GetSiteVnetGatewaySender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.SitesClient", "GetSiteVnetGateway", resp, "Failure sending request") - } - - result, err = client.GetSiteVnetGatewayResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.SitesClient", "GetSiteVnetGateway", resp, "Failure responding to request") - } - - return -} - -// GetSiteVnetGatewayPreparer prepares the GetSiteVnetGateway request. -func (client SitesClient) GetSiteVnetGatewayPreparer(resourceGroupName string, name string, vnetName string, gatewayName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "gatewayName": autorest.Encode("path", gatewayName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vnetName": autorest.Encode("path", vnetName), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/virtualNetworkConnections/{vnetName}/gateways/{gatewayName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSiteVnetGatewaySender sends the GetSiteVnetGateway request. The method will close the -// http.Response Body if it receives an error. -func (client SitesClient) GetSiteVnetGatewaySender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetSiteVnetGatewayResponder handles the response to the GetSiteVnetGateway request. The method always -// closes the http.Response Body. -func (client SitesClient) GetSiteVnetGatewayResponder(resp *http.Response) (result SetObject, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNotFound), - autorest.ByUnmarshallingJSON(&result.Value), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetSiteVnetGatewaySlot sends the get site vnet gateway slot request. -// -// resourceGroupName is the resource group name name is the name of the web app -// vnetName is the name of the Virtual Network gatewayName is the name of the -// gateway. The only gateway that exists presently is "primary" slot is the -// name of the slot for this web app. -func (client SitesClient) GetSiteVnetGatewaySlot(resourceGroupName string, name string, vnetName string, gatewayName string, slot string) (result SetObject, err error) { - req, err := client.GetSiteVnetGatewaySlotPreparer(resourceGroupName, name, vnetName, gatewayName, slot) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.SitesClient", "GetSiteVnetGatewaySlot", nil, "Failure preparing request") - } - - resp, err := client.GetSiteVnetGatewaySlotSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.SitesClient", "GetSiteVnetGatewaySlot", resp, "Failure sending request") - } - - result, err = client.GetSiteVnetGatewaySlotResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.SitesClient", "GetSiteVnetGatewaySlot", resp, "Failure responding to request") - } - - return -} - -// GetSiteVnetGatewaySlotPreparer prepares the GetSiteVnetGatewaySlot request. -func (client SitesClient) GetSiteVnetGatewaySlotPreparer(resourceGroupName string, name string, vnetName string, gatewayName string, slot string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "gatewayName": autorest.Encode("path", gatewayName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "slot": autorest.Encode("path", slot), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vnetName": autorest.Encode("path", vnetName), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/virtualNetworkConnections/{vnetName}/gateways/{gatewayName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSiteVnetGatewaySlotSender sends the GetSiteVnetGatewaySlot request. The method will close the -// http.Response Body if it receives an error. -func (client SitesClient) GetSiteVnetGatewaySlotSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetSiteVnetGatewaySlotResponder handles the response to the GetSiteVnetGatewaySlot request. The method always -// closes the http.Response Body. -func (client SitesClient) GetSiteVnetGatewaySlotResponder(resp *http.Response) (result SetObject, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNotFound), - autorest.ByUnmarshallingJSON(&result.Value), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetSlotConfigNames sends the get slot config names request. -// -// resourceGroupName is name of resource group name is name of web app -func (client SitesClient) GetSlotConfigNames(resourceGroupName string, name string) (result SlotConfigNamesResource, err error) { - req, err := client.GetSlotConfigNamesPreparer(resourceGroupName, name) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.SitesClient", "GetSlotConfigNames", nil, "Failure preparing request") - } - - resp, err := client.GetSlotConfigNamesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.SitesClient", "GetSlotConfigNames", resp, "Failure sending request") - } - - result, err = client.GetSlotConfigNamesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.SitesClient", "GetSlotConfigNames", resp, "Failure responding to request") - } - - return -} - -// GetSlotConfigNamesPreparer prepares the GetSlotConfigNames request. -func (client SitesClient) GetSlotConfigNamesPreparer(resourceGroupName string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/slotConfigNames", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSlotConfigNamesSender sends the GetSlotConfigNames request. The method will close the -// http.Response Body if it receives an error. -func (client SitesClient) GetSlotConfigNamesSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetSlotConfigNamesResponder handles the response to the GetSlotConfigNames request. The method always -// closes the http.Response Body. -func (client SitesClient) GetSlotConfigNamesResponder(resp *http.Response) (result SlotConfigNamesResource, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetSlotsDifferencesFromProduction sends the get slots differences from -// production request. -// -// resourceGroupName is name of resource group name is name of web app -// slotSwapEntity is request body that contains the target slot name -func (client SitesClient) GetSlotsDifferencesFromProduction(resourceGroupName string, name string, slotSwapEntity CsmSlotEntity) (result SlotDifferenceCollection, err error) { - req, err := client.GetSlotsDifferencesFromProductionPreparer(resourceGroupName, name, slotSwapEntity) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.SitesClient", "GetSlotsDifferencesFromProduction", nil, "Failure preparing request") - } - - resp, err := client.GetSlotsDifferencesFromProductionSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.SitesClient", "GetSlotsDifferencesFromProduction", resp, "Failure sending request") - } - - result, err = client.GetSlotsDifferencesFromProductionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.SitesClient", "GetSlotsDifferencesFromProduction", resp, "Failure responding to request") - } - - return -} - -// GetSlotsDifferencesFromProductionPreparer prepares the GetSlotsDifferencesFromProduction request. -func (client SitesClient) GetSlotsDifferencesFromProductionPreparer(resourceGroupName string, name string, slotSwapEntity CsmSlotEntity) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slotsdiffs", pathParameters), - autorest.WithJSON(slotSwapEntity), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSlotsDifferencesFromProductionSender sends the GetSlotsDifferencesFromProduction request. The method will close the -// http.Response Body if it receives an error. -func (client SitesClient) GetSlotsDifferencesFromProductionSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetSlotsDifferencesFromProductionResponder handles the response to the GetSlotsDifferencesFromProduction request. The method always -// closes the http.Response Body. -func (client SitesClient) GetSlotsDifferencesFromProductionResponder(resp *http.Response) (result SlotDifferenceCollection, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetSlotsDifferencesFromProductionNextResults retrieves the next set of results, if any. -func (client SitesClient) GetSlotsDifferencesFromProductionNextResults(lastResults SlotDifferenceCollection) (result SlotDifferenceCollection, err error) { - req, err := lastResults.SlotDifferenceCollectionPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "web.SitesClient", "GetSlotsDifferencesFromProduction", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.GetSlotsDifferencesFromProductionSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.SitesClient", "GetSlotsDifferencesFromProduction", resp, "Failure sending next results request") - } - - result, err = client.GetSlotsDifferencesFromProductionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.SitesClient", "GetSlotsDifferencesFromProduction", resp, "Failure responding to next results request") - } - - return -} - -// GetSlotsDifferencesSlot sends the get slots differences slot request. -// -// resourceGroupName is name of resource group name is name of web app -// slotSwapEntity is request body that contains the target slot name slot is -// name of the source slot -func (client SitesClient) GetSlotsDifferencesSlot(resourceGroupName string, name string, slotSwapEntity CsmSlotEntity, slot string) (result SlotDifferenceCollection, err error) { - req, err := client.GetSlotsDifferencesSlotPreparer(resourceGroupName, name, slotSwapEntity, slot) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.SitesClient", "GetSlotsDifferencesSlot", nil, "Failure preparing request") - } - - resp, err := client.GetSlotsDifferencesSlotSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.SitesClient", "GetSlotsDifferencesSlot", resp, "Failure sending request") - } - - result, err = client.GetSlotsDifferencesSlotResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.SitesClient", "GetSlotsDifferencesSlot", resp, "Failure responding to request") - } - - return -} - -// GetSlotsDifferencesSlotPreparer prepares the GetSlotsDifferencesSlot request. -func (client SitesClient) GetSlotsDifferencesSlotPreparer(resourceGroupName string, name string, slotSwapEntity CsmSlotEntity, slot string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "slot": autorest.Encode("path", slot), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/slotsdiffs", pathParameters), - autorest.WithJSON(slotSwapEntity), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSlotsDifferencesSlotSender sends the GetSlotsDifferencesSlot request. The method will close the -// http.Response Body if it receives an error. -func (client SitesClient) GetSlotsDifferencesSlotSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetSlotsDifferencesSlotResponder handles the response to the GetSlotsDifferencesSlot request. The method always -// closes the http.Response Body. -func (client SitesClient) GetSlotsDifferencesSlotResponder(resp *http.Response) (result SlotDifferenceCollection, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetSlotsDifferencesSlotNextResults retrieves the next set of results, if any. -func (client SitesClient) GetSlotsDifferencesSlotNextResults(lastResults SlotDifferenceCollection) (result SlotDifferenceCollection, err error) { - req, err := lastResults.SlotDifferenceCollectionPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "web.SitesClient", "GetSlotsDifferencesSlot", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.GetSlotsDifferencesSlotSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.SitesClient", "GetSlotsDifferencesSlot", resp, "Failure sending next results request") - } - - result, err = client.GetSlotsDifferencesSlotResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.SitesClient", "GetSlotsDifferencesSlot", resp, "Failure responding to next results request") - } - - return -} - -// IsSiteCloneable sends the is site cloneable request. -// -// resourceGroupName is name of the resource group name is name of the web app -func (client SitesClient) IsSiteCloneable(resourceGroupName string, name string) (result SiteCloneability, err error) { - req, err := client.IsSiteCloneablePreparer(resourceGroupName, name) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.SitesClient", "IsSiteCloneable", nil, "Failure preparing request") - } - - resp, err := client.IsSiteCloneableSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.SitesClient", "IsSiteCloneable", resp, "Failure sending request") - } - - result, err = client.IsSiteCloneableResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.SitesClient", "IsSiteCloneable", resp, "Failure responding to request") - } - - return -} - -// IsSiteCloneablePreparer prepares the IsSiteCloneable request. -func (client SitesClient) IsSiteCloneablePreparer(resourceGroupName string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/iscloneable", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// IsSiteCloneableSender sends the IsSiteCloneable request. The method will close the -// http.Response Body if it receives an error. -func (client SitesClient) IsSiteCloneableSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// IsSiteCloneableResponder handles the response to the IsSiteCloneable request. The method always -// closes the http.Response Body. -func (client SitesClient) IsSiteCloneableResponder(resp *http.Response) (result SiteCloneability, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// IsSiteCloneableSlot sends the is site cloneable slot request. -// -// resourceGroupName is name of the resource group name is name of the web app -// slot is name of web app slot. If not specified then will default to -// production slot. -func (client SitesClient) IsSiteCloneableSlot(resourceGroupName string, name string, slot string) (result SiteCloneability, err error) { - req, err := client.IsSiteCloneableSlotPreparer(resourceGroupName, name, slot) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.SitesClient", "IsSiteCloneableSlot", nil, "Failure preparing request") - } - - resp, err := client.IsSiteCloneableSlotSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.SitesClient", "IsSiteCloneableSlot", resp, "Failure sending request") - } - - result, err = client.IsSiteCloneableSlotResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.SitesClient", "IsSiteCloneableSlot", resp, "Failure responding to request") - } - - return -} - -// IsSiteCloneableSlotPreparer prepares the IsSiteCloneableSlot request. -func (client SitesClient) IsSiteCloneableSlotPreparer(resourceGroupName string, name string, slot string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "slot": autorest.Encode("path", slot), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/iscloneable", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// IsSiteCloneableSlotSender sends the IsSiteCloneableSlot request. The method will close the -// http.Response Body if it receives an error. -func (client SitesClient) IsSiteCloneableSlotSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// IsSiteCloneableSlotResponder handles the response to the IsSiteCloneableSlot request. The method always -// closes the http.Response Body. -func (client SitesClient) IsSiteCloneableSlotResponder(resp *http.Response) (result SiteCloneability, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListSiteAppSettings sends the list site app settings request. -// -// resourceGroupName is name of resource group name is name of web app -func (client SitesClient) ListSiteAppSettings(resourceGroupName string, name string) (result StringDictionary, err error) { - req, err := client.ListSiteAppSettingsPreparer(resourceGroupName, name) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.SitesClient", "ListSiteAppSettings", nil, "Failure preparing request") - } - - resp, err := client.ListSiteAppSettingsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.SitesClient", "ListSiteAppSettings", resp, "Failure sending request") - } - - result, err = client.ListSiteAppSettingsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.SitesClient", "ListSiteAppSettings", resp, "Failure responding to request") - } - - return -} - -// ListSiteAppSettingsPreparer prepares the ListSiteAppSettings request. -func (client SitesClient) ListSiteAppSettingsPreparer(resourceGroupName string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/appsettings/list", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListSiteAppSettingsSender sends the ListSiteAppSettings request. The method will close the -// http.Response Body if it receives an error. -func (client SitesClient) ListSiteAppSettingsSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListSiteAppSettingsResponder handles the response to the ListSiteAppSettings request. The method always -// closes the http.Response Body. -func (client SitesClient) ListSiteAppSettingsResponder(resp *http.Response) (result StringDictionary, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListSiteAppSettingsSlot sends the list site app settings slot request. -// -// resourceGroupName is name of resource group name is name of web app slot is -// name of web app slot. If not specified then will default to production slot. -func (client SitesClient) ListSiteAppSettingsSlot(resourceGroupName string, name string, slot string) (result StringDictionary, err error) { - req, err := client.ListSiteAppSettingsSlotPreparer(resourceGroupName, name, slot) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.SitesClient", "ListSiteAppSettingsSlot", nil, "Failure preparing request") - } - - resp, err := client.ListSiteAppSettingsSlotSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.SitesClient", "ListSiteAppSettingsSlot", resp, "Failure sending request") - } - - result, err = client.ListSiteAppSettingsSlotResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.SitesClient", "ListSiteAppSettingsSlot", resp, "Failure responding to request") - } - - return -} - -// ListSiteAppSettingsSlotPreparer prepares the ListSiteAppSettingsSlot request. -func (client SitesClient) ListSiteAppSettingsSlotPreparer(resourceGroupName string, name string, slot string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "slot": autorest.Encode("path", slot), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/appsettings/list", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListSiteAppSettingsSlotSender sends the ListSiteAppSettingsSlot request. The method will close the -// http.Response Body if it receives an error. -func (client SitesClient) ListSiteAppSettingsSlotSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListSiteAppSettingsSlotResponder handles the response to the ListSiteAppSettingsSlot request. The method always -// closes the http.Response Body. -func (client SitesClient) ListSiteAppSettingsSlotResponder(resp *http.Response) (result StringDictionary, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListSiteAuthSettings sends the list site auth settings request. -// -// resourceGroupName is name of resource group name is name of web app -func (client SitesClient) ListSiteAuthSettings(resourceGroupName string, name string) (result SiteAuthSettings, err error) { - req, err := client.ListSiteAuthSettingsPreparer(resourceGroupName, name) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.SitesClient", "ListSiteAuthSettings", nil, "Failure preparing request") - } - - resp, err := client.ListSiteAuthSettingsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.SitesClient", "ListSiteAuthSettings", resp, "Failure sending request") - } - - result, err = client.ListSiteAuthSettingsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.SitesClient", "ListSiteAuthSettings", resp, "Failure responding to request") - } - - return -} - -// ListSiteAuthSettingsPreparer prepares the ListSiteAuthSettings request. -func (client SitesClient) ListSiteAuthSettingsPreparer(resourceGroupName string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/authsettings/list", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListSiteAuthSettingsSender sends the ListSiteAuthSettings request. The method will close the -// http.Response Body if it receives an error. -func (client SitesClient) ListSiteAuthSettingsSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListSiteAuthSettingsResponder handles the response to the ListSiteAuthSettings request. The method always -// closes the http.Response Body. -func (client SitesClient) ListSiteAuthSettingsResponder(resp *http.Response) (result SiteAuthSettings, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListSiteAuthSettingsSlot sends the list site auth settings slot request. -// -// resourceGroupName is name of resource group name is name of web app slot is -// name of web app slot. If not specified then will default to production slot. -func (client SitesClient) ListSiteAuthSettingsSlot(resourceGroupName string, name string, slot string) (result SiteAuthSettings, err error) { - req, err := client.ListSiteAuthSettingsSlotPreparer(resourceGroupName, name, slot) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.SitesClient", "ListSiteAuthSettingsSlot", nil, "Failure preparing request") - } - - resp, err := client.ListSiteAuthSettingsSlotSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.SitesClient", "ListSiteAuthSettingsSlot", resp, "Failure sending request") - } - - result, err = client.ListSiteAuthSettingsSlotResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.SitesClient", "ListSiteAuthSettingsSlot", resp, "Failure responding to request") - } - - return -} - -// ListSiteAuthSettingsSlotPreparer prepares the ListSiteAuthSettingsSlot request. -func (client SitesClient) ListSiteAuthSettingsSlotPreparer(resourceGroupName string, name string, slot string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "slot": autorest.Encode("path", slot), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/authsettings/list", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListSiteAuthSettingsSlotSender sends the ListSiteAuthSettingsSlot request. The method will close the -// http.Response Body if it receives an error. -func (client SitesClient) ListSiteAuthSettingsSlotSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListSiteAuthSettingsSlotResponder handles the response to the ListSiteAuthSettingsSlot request. The method always -// closes the http.Response Body. -func (client SitesClient) ListSiteAuthSettingsSlotResponder(resp *http.Response) (result SiteAuthSettings, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListSiteBackups sends the list site backups request. -// -// resourceGroupName is name of resource group name is name of web app -func (client SitesClient) ListSiteBackups(resourceGroupName string, name string) (result BackupItemCollection, err error) { - req, err := client.ListSiteBackupsPreparer(resourceGroupName, name) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.SitesClient", "ListSiteBackups", nil, "Failure preparing request") - } - - resp, err := client.ListSiteBackupsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.SitesClient", "ListSiteBackups", resp, "Failure sending request") - } - - result, err = client.ListSiteBackupsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.SitesClient", "ListSiteBackups", resp, "Failure responding to request") - } - - return -} - -// ListSiteBackupsPreparer prepares the ListSiteBackups request. -func (client SitesClient) ListSiteBackupsPreparer(resourceGroupName string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/backups", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListSiteBackupsSender sends the ListSiteBackups request. The method will close the -// http.Response Body if it receives an error. -func (client SitesClient) ListSiteBackupsSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListSiteBackupsResponder handles the response to the ListSiteBackups request. The method always -// closes the http.Response Body. -func (client SitesClient) ListSiteBackupsResponder(resp *http.Response) (result BackupItemCollection, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListSiteBackupsNextResults retrieves the next set of results, if any. -func (client SitesClient) ListSiteBackupsNextResults(lastResults BackupItemCollection) (result BackupItemCollection, err error) { - req, err := lastResults.BackupItemCollectionPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "web.SitesClient", "ListSiteBackups", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListSiteBackupsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.SitesClient", "ListSiteBackups", resp, "Failure sending next results request") - } - - result, err = client.ListSiteBackupsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.SitesClient", "ListSiteBackups", resp, "Failure responding to next results request") - } - - return -} - -// ListSiteBackupsSlot sends the list site backups slot request. -// -// resourceGroupName is name of resource group name is name of web app slot is -// name of web app slot. If not specified then will default to production slot. -func (client SitesClient) ListSiteBackupsSlot(resourceGroupName string, name string, slot string) (result BackupItemCollection, err error) { - req, err := client.ListSiteBackupsSlotPreparer(resourceGroupName, name, slot) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.SitesClient", "ListSiteBackupsSlot", nil, "Failure preparing request") - } - - resp, err := client.ListSiteBackupsSlotSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.SitesClient", "ListSiteBackupsSlot", resp, "Failure sending request") - } - - result, err = client.ListSiteBackupsSlotResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.SitesClient", "ListSiteBackupsSlot", resp, "Failure responding to request") - } - - return -} - -// ListSiteBackupsSlotPreparer prepares the ListSiteBackupsSlot request. -func (client SitesClient) ListSiteBackupsSlotPreparer(resourceGroupName string, name string, slot string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "slot": autorest.Encode("path", slot), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/backups", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListSiteBackupsSlotSender sends the ListSiteBackupsSlot request. The method will close the -// http.Response Body if it receives an error. -func (client SitesClient) ListSiteBackupsSlotSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListSiteBackupsSlotResponder handles the response to the ListSiteBackupsSlot request. The method always -// closes the http.Response Body. -func (client SitesClient) ListSiteBackupsSlotResponder(resp *http.Response) (result BackupItemCollection, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListSiteBackupsSlotNextResults retrieves the next set of results, if any. -func (client SitesClient) ListSiteBackupsSlotNextResults(lastResults BackupItemCollection) (result BackupItemCollection, err error) { - req, err := lastResults.BackupItemCollectionPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "web.SitesClient", "ListSiteBackupsSlot", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListSiteBackupsSlotSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.SitesClient", "ListSiteBackupsSlot", resp, "Failure sending next results request") - } - - result, err = client.ListSiteBackupsSlotResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.SitesClient", "ListSiteBackupsSlot", resp, "Failure responding to next results request") - } - - return -} - -// ListSiteConnectionStrings sends the list site connection strings request. -// -// resourceGroupName is name of resource group name is name of web app -func (client SitesClient) ListSiteConnectionStrings(resourceGroupName string, name string) (result ConnectionStringDictionary, err error) { - req, err := client.ListSiteConnectionStringsPreparer(resourceGroupName, name) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.SitesClient", "ListSiteConnectionStrings", nil, "Failure preparing request") - } - - resp, err := client.ListSiteConnectionStringsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.SitesClient", "ListSiteConnectionStrings", resp, "Failure sending request") - } - - result, err = client.ListSiteConnectionStringsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.SitesClient", "ListSiteConnectionStrings", resp, "Failure responding to request") - } - - return -} - -// ListSiteConnectionStringsPreparer prepares the ListSiteConnectionStrings request. -func (client SitesClient) ListSiteConnectionStringsPreparer(resourceGroupName string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/connectionstrings/list", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListSiteConnectionStringsSender sends the ListSiteConnectionStrings request. The method will close the -// http.Response Body if it receives an error. -func (client SitesClient) ListSiteConnectionStringsSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListSiteConnectionStringsResponder handles the response to the ListSiteConnectionStrings request. The method always -// closes the http.Response Body. -func (client SitesClient) ListSiteConnectionStringsResponder(resp *http.Response) (result ConnectionStringDictionary, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListSiteConnectionStringsSlot sends the list site connection strings slot -// request. -// -// resourceGroupName is name of resource group name is name of web app slot is -// name of web app slot. If not specified then will default to production slot. -func (client SitesClient) ListSiteConnectionStringsSlot(resourceGroupName string, name string, slot string) (result ConnectionStringDictionary, err error) { - req, err := client.ListSiteConnectionStringsSlotPreparer(resourceGroupName, name, slot) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.SitesClient", "ListSiteConnectionStringsSlot", nil, "Failure preparing request") - } - - resp, err := client.ListSiteConnectionStringsSlotSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.SitesClient", "ListSiteConnectionStringsSlot", resp, "Failure sending request") - } - - result, err = client.ListSiteConnectionStringsSlotResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.SitesClient", "ListSiteConnectionStringsSlot", resp, "Failure responding to request") - } - - return -} - -// ListSiteConnectionStringsSlotPreparer prepares the ListSiteConnectionStringsSlot request. -func (client SitesClient) ListSiteConnectionStringsSlotPreparer(resourceGroupName string, name string, slot string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "slot": autorest.Encode("path", slot), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/connectionstrings/list", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListSiteConnectionStringsSlotSender sends the ListSiteConnectionStringsSlot request. The method will close the -// http.Response Body if it receives an error. -func (client SitesClient) ListSiteConnectionStringsSlotSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListSiteConnectionStringsSlotResponder handles the response to the ListSiteConnectionStringsSlot request. The method always -// closes the http.Response Body. -func (client SitesClient) ListSiteConnectionStringsSlotResponder(resp *http.Response) (result ConnectionStringDictionary, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListSiteMetadata sends the list site metadata request. -// -// resourceGroupName is name of resource group name is name of web app -func (client SitesClient) ListSiteMetadata(resourceGroupName string, name string) (result StringDictionary, err error) { - req, err := client.ListSiteMetadataPreparer(resourceGroupName, name) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.SitesClient", "ListSiteMetadata", nil, "Failure preparing request") - } - - resp, err := client.ListSiteMetadataSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.SitesClient", "ListSiteMetadata", resp, "Failure sending request") - } - - result, err = client.ListSiteMetadataResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.SitesClient", "ListSiteMetadata", resp, "Failure responding to request") - } - - return -} - -// ListSiteMetadataPreparer prepares the ListSiteMetadata request. -func (client SitesClient) ListSiteMetadataPreparer(resourceGroupName string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/metadata/list", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListSiteMetadataSender sends the ListSiteMetadata request. The method will close the -// http.Response Body if it receives an error. -func (client SitesClient) ListSiteMetadataSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListSiteMetadataResponder handles the response to the ListSiteMetadata request. The method always -// closes the http.Response Body. -func (client SitesClient) ListSiteMetadataResponder(resp *http.Response) (result StringDictionary, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListSiteMetadataSlot sends the list site metadata slot request. -// -// resourceGroupName is name of resource group name is name of web app slot is -// name of web app slot. If not specified then will default to production slot. -func (client SitesClient) ListSiteMetadataSlot(resourceGroupName string, name string, slot string) (result StringDictionary, err error) { - req, err := client.ListSiteMetadataSlotPreparer(resourceGroupName, name, slot) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.SitesClient", "ListSiteMetadataSlot", nil, "Failure preparing request") - } - - resp, err := client.ListSiteMetadataSlotSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.SitesClient", "ListSiteMetadataSlot", resp, "Failure sending request") - } - - result, err = client.ListSiteMetadataSlotResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.SitesClient", "ListSiteMetadataSlot", resp, "Failure responding to request") - } - - return -} - -// ListSiteMetadataSlotPreparer prepares the ListSiteMetadataSlot request. -func (client SitesClient) ListSiteMetadataSlotPreparer(resourceGroupName string, name string, slot string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "slot": autorest.Encode("path", slot), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/metadata/list", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListSiteMetadataSlotSender sends the ListSiteMetadataSlot request. The method will close the -// http.Response Body if it receives an error. -func (client SitesClient) ListSiteMetadataSlotSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListSiteMetadataSlotResponder handles the response to the ListSiteMetadataSlot request. The method always -// closes the http.Response Body. -func (client SitesClient) ListSiteMetadataSlotResponder(resp *http.Response) (result StringDictionary, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListSitePremierAddOns sends the list site premier add ons request. -// -func (client SitesClient) ListSitePremierAddOns(resourceGroupName string, name string) (result SetObject, err error) { - req, err := client.ListSitePremierAddOnsPreparer(resourceGroupName, name) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.SitesClient", "ListSitePremierAddOns", nil, "Failure preparing request") - } - - resp, err := client.ListSitePremierAddOnsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.SitesClient", "ListSitePremierAddOns", resp, "Failure sending request") - } - - result, err = client.ListSitePremierAddOnsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.SitesClient", "ListSitePremierAddOns", resp, "Failure responding to request") - } - - return -} - -// ListSitePremierAddOnsPreparer prepares the ListSitePremierAddOns request. -func (client SitesClient) ListSitePremierAddOnsPreparer(resourceGroupName string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/premieraddons", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListSitePremierAddOnsSender sends the ListSitePremierAddOns request. The method will close the -// http.Response Body if it receives an error. -func (client SitesClient) ListSitePremierAddOnsSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListSitePremierAddOnsResponder handles the response to the ListSitePremierAddOns request. The method always -// closes the http.Response Body. -func (client SitesClient) ListSitePremierAddOnsResponder(resp *http.Response) (result SetObject, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Value), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListSitePremierAddOnsSlot sends the list site premier add ons slot request. -// -func (client SitesClient) ListSitePremierAddOnsSlot(resourceGroupName string, name string, slot string) (result SetObject, err error) { - req, err := client.ListSitePremierAddOnsSlotPreparer(resourceGroupName, name, slot) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.SitesClient", "ListSitePremierAddOnsSlot", nil, "Failure preparing request") - } - - resp, err := client.ListSitePremierAddOnsSlotSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.SitesClient", "ListSitePremierAddOnsSlot", resp, "Failure sending request") - } - - result, err = client.ListSitePremierAddOnsSlotResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.SitesClient", "ListSitePremierAddOnsSlot", resp, "Failure responding to request") - } - - return -} - -// ListSitePremierAddOnsSlotPreparer prepares the ListSitePremierAddOnsSlot request. -func (client SitesClient) ListSitePremierAddOnsSlotPreparer(resourceGroupName string, name string, slot string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "slot": autorest.Encode("path", slot), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/premieraddons", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListSitePremierAddOnsSlotSender sends the ListSitePremierAddOnsSlot request. The method will close the -// http.Response Body if it receives an error. -func (client SitesClient) ListSitePremierAddOnsSlotSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListSitePremierAddOnsSlotResponder handles the response to the ListSitePremierAddOnsSlot request. The method always -// closes the http.Response Body. -func (client SitesClient) ListSitePremierAddOnsSlotResponder(resp *http.Response) (result SetObject, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Value), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListSitePublishingCredentials sends the list site publishing credentials -// request. This method may poll for completion. Polling can be canceled by -// passing the cancel channel argument. The channel will be used to cancel -// polling and any outstanding HTTP requests. -// -// resourceGroupName is name of resource group name is name of web app -func (client SitesClient) ListSitePublishingCredentials(resourceGroupName string, name string, cancel <-chan struct{}) (result autorest.Response, err error) { - req, err := client.ListSitePublishingCredentialsPreparer(resourceGroupName, name, cancel) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.SitesClient", "ListSitePublishingCredentials", nil, "Failure preparing request") - } - - resp, err := client.ListSitePublishingCredentialsSender(req) - if err != nil { - result.Response = resp - return result, autorest.NewErrorWithError(err, "web.SitesClient", "ListSitePublishingCredentials", resp, "Failure sending request") - } - - result, err = client.ListSitePublishingCredentialsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.SitesClient", "ListSitePublishingCredentials", resp, "Failure responding to request") - } - - return -} - -// ListSitePublishingCredentialsPreparer prepares the ListSitePublishingCredentials request. -func (client SitesClient) ListSitePublishingCredentialsPreparer(resourceGroupName string, name string, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/publishingcredentials/list", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// ListSitePublishingCredentialsSender sends the ListSitePublishingCredentials request. The method will close the -// http.Response Body if it receives an error. -func (client SitesClient) ListSitePublishingCredentialsSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// ListSitePublishingCredentialsResponder handles the response to the ListSitePublishingCredentials request. The method always -// closes the http.Response Body. -func (client SitesClient) ListSitePublishingCredentialsResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// ListSitePublishingCredentialsSlot sends the list site publishing credentials -// slot request. This method may poll for completion. Polling can be canceled -// by passing the cancel channel argument. The channel will be used to cancel -// polling and any outstanding HTTP requests. -// -// resourceGroupName is name of resource group name is name of web app slot is -// name of web app slot. If not specified then will default to production slot. -func (client SitesClient) ListSitePublishingCredentialsSlot(resourceGroupName string, name string, slot string, cancel <-chan struct{}) (result autorest.Response, err error) { - req, err := client.ListSitePublishingCredentialsSlotPreparer(resourceGroupName, name, slot, cancel) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.SitesClient", "ListSitePublishingCredentialsSlot", nil, "Failure preparing request") - } - - resp, err := client.ListSitePublishingCredentialsSlotSender(req) - if err != nil { - result.Response = resp - return result, autorest.NewErrorWithError(err, "web.SitesClient", "ListSitePublishingCredentialsSlot", resp, "Failure sending request") - } - - result, err = client.ListSitePublishingCredentialsSlotResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.SitesClient", "ListSitePublishingCredentialsSlot", resp, "Failure responding to request") - } - - return -} - -// ListSitePublishingCredentialsSlotPreparer prepares the ListSitePublishingCredentialsSlot request. -func (client SitesClient) ListSitePublishingCredentialsSlotPreparer(resourceGroupName string, name string, slot string, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "slot": autorest.Encode("path", slot), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/publishingcredentials/list", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// ListSitePublishingCredentialsSlotSender sends the ListSitePublishingCredentialsSlot request. The method will close the -// http.Response Body if it receives an error. -func (client SitesClient) ListSitePublishingCredentialsSlotSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// ListSitePublishingCredentialsSlotResponder handles the response to the ListSitePublishingCredentialsSlot request. The method always -// closes the http.Response Body. -func (client SitesClient) ListSitePublishingCredentialsSlotResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// ListSitePublishingProfileXML sends the list site publishing profile xml -// request. -// -// resourceGroupName is name of resource group name is name of web app options -// is specifies options for publishing profile. Pass -// CsmPublishingProfileOptions.Format=FileZilla3 for FileZilla FTP format. -func (client SitesClient) ListSitePublishingProfileXML(resourceGroupName string, name string, options CsmPublishingProfileOptions) (result ReadCloser, err error) { - req, err := client.ListSitePublishingProfileXMLPreparer(resourceGroupName, name, options) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.SitesClient", "ListSitePublishingProfileXML", nil, "Failure preparing request") - } - - resp, err := client.ListSitePublishingProfileXMLSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.SitesClient", "ListSitePublishingProfileXML", resp, "Failure sending request") - } - - result, err = client.ListSitePublishingProfileXMLResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.SitesClient", "ListSitePublishingProfileXML", resp, "Failure responding to request") - } - - return -} - -// ListSitePublishingProfileXMLPreparer prepares the ListSitePublishingProfileXML request. -func (client SitesClient) ListSitePublishingProfileXMLPreparer(resourceGroupName string, name string, options CsmPublishingProfileOptions) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/publishxml", pathParameters), - autorest.WithJSON(options), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListSitePublishingProfileXMLSender sends the ListSitePublishingProfileXML request. The method will close the -// http.Response Body if it receives an error. -func (client SitesClient) ListSitePublishingProfileXMLSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListSitePublishingProfileXMLResponder handles the response to the ListSitePublishingProfileXML request. The method always -// closes the http.Response Body. -func (client SitesClient) ListSitePublishingProfileXMLResponder(resp *http.Response) (result ReadCloser, err error) { - result.Value = &resp.Body - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK)) - result.Response = autorest.Response{Response: resp} - return -} - -// ListSitePublishingProfileXMLSlot sends the list site publishing profile xml -// slot request. -// -// resourceGroupName is name of resource group name is name of web app options -// is specifies options for publishing profile. Pass -// CsmPublishingProfileOptions.Format=FileZilla3 for FileZilla FTP format. slot -// is name of web app slot. If not specified then will default to production -// slot. -func (client SitesClient) ListSitePublishingProfileXMLSlot(resourceGroupName string, name string, options CsmPublishingProfileOptions, slot string) (result ReadCloser, err error) { - req, err := client.ListSitePublishingProfileXMLSlotPreparer(resourceGroupName, name, options, slot) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.SitesClient", "ListSitePublishingProfileXMLSlot", nil, "Failure preparing request") - } - - resp, err := client.ListSitePublishingProfileXMLSlotSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.SitesClient", "ListSitePublishingProfileXMLSlot", resp, "Failure sending request") - } - - result, err = client.ListSitePublishingProfileXMLSlotResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.SitesClient", "ListSitePublishingProfileXMLSlot", resp, "Failure responding to request") - } - - return -} - -// ListSitePublishingProfileXMLSlotPreparer prepares the ListSitePublishingProfileXMLSlot request. -func (client SitesClient) ListSitePublishingProfileXMLSlotPreparer(resourceGroupName string, name string, options CsmPublishingProfileOptions, slot string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "slot": autorest.Encode("path", slot), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/publishxml", pathParameters), - autorest.WithJSON(options), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListSitePublishingProfileXMLSlotSender sends the ListSitePublishingProfileXMLSlot request. The method will close the -// http.Response Body if it receives an error. -func (client SitesClient) ListSitePublishingProfileXMLSlotSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListSitePublishingProfileXMLSlotResponder handles the response to the ListSitePublishingProfileXMLSlot request. The method always -// closes the http.Response Body. -func (client SitesClient) ListSitePublishingProfileXMLSlotResponder(resp *http.Response) (result ReadCloser, err error) { - result.Value = &resp.Body - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK)) - result.Response = autorest.Response{Response: resp} - return -} - -// ListSiteRelayServiceConnections sends the list site relay service -// connections request. -// -// resourceGroupName is the resource group name name is the name of the web app -func (client SitesClient) ListSiteRelayServiceConnections(resourceGroupName string, name string) (result RelayServiceConnectionEntity, err error) { - req, err := client.ListSiteRelayServiceConnectionsPreparer(resourceGroupName, name) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.SitesClient", "ListSiteRelayServiceConnections", nil, "Failure preparing request") - } - - resp, err := client.ListSiteRelayServiceConnectionsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.SitesClient", "ListSiteRelayServiceConnections", resp, "Failure sending request") - } - - result, err = client.ListSiteRelayServiceConnectionsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.SitesClient", "ListSiteRelayServiceConnections", resp, "Failure responding to request") - } - - return -} - -// ListSiteRelayServiceConnectionsPreparer prepares the ListSiteRelayServiceConnections request. -func (client SitesClient) ListSiteRelayServiceConnectionsPreparer(resourceGroupName string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/hybridconnection", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListSiteRelayServiceConnectionsSender sends the ListSiteRelayServiceConnections request. The method will close the -// http.Response Body if it receives an error. -func (client SitesClient) ListSiteRelayServiceConnectionsSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListSiteRelayServiceConnectionsResponder handles the response to the ListSiteRelayServiceConnections request. The method always -// closes the http.Response Body. -func (client SitesClient) ListSiteRelayServiceConnectionsResponder(resp *http.Response) (result RelayServiceConnectionEntity, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListSiteRelayServiceConnectionsSlot sends the list site relay service -// connections slot request. -// -// resourceGroupName is the resource group name name is the name of the web app -// slot is the name of the slot for the web app. -func (client SitesClient) ListSiteRelayServiceConnectionsSlot(resourceGroupName string, name string, slot string) (result RelayServiceConnectionEntity, err error) { - req, err := client.ListSiteRelayServiceConnectionsSlotPreparer(resourceGroupName, name, slot) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.SitesClient", "ListSiteRelayServiceConnectionsSlot", nil, "Failure preparing request") - } - - resp, err := client.ListSiteRelayServiceConnectionsSlotSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.SitesClient", "ListSiteRelayServiceConnectionsSlot", resp, "Failure sending request") - } - - result, err = client.ListSiteRelayServiceConnectionsSlotResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.SitesClient", "ListSiteRelayServiceConnectionsSlot", resp, "Failure responding to request") - } - - return -} - -// ListSiteRelayServiceConnectionsSlotPreparer prepares the ListSiteRelayServiceConnectionsSlot request. -func (client SitesClient) ListSiteRelayServiceConnectionsSlotPreparer(resourceGroupName string, name string, slot string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "slot": autorest.Encode("path", slot), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/hybridconnection", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListSiteRelayServiceConnectionsSlotSender sends the ListSiteRelayServiceConnectionsSlot request. The method will close the -// http.Response Body if it receives an error. -func (client SitesClient) ListSiteRelayServiceConnectionsSlotSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListSiteRelayServiceConnectionsSlotResponder handles the response to the ListSiteRelayServiceConnectionsSlot request. The method always -// closes the http.Response Body. -func (client SitesClient) ListSiteRelayServiceConnectionsSlotResponder(resp *http.Response) (result RelayServiceConnectionEntity, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// RecoverSite sends the recover site request. This method may poll for -// completion. Polling can be canceled by passing the cancel channel argument. -// The channel will be used to cancel polling and any outstanding HTTP -// requests. -// -// resourceGroupName is name of resource group name is name of web app -// recoveryEntity is snapshot data used for web app recovery. Snapshot -// information can be obtained by calling GetDeletedSites or GetSiteSnapshots -// API. -func (client SitesClient) RecoverSite(resourceGroupName string, name string, recoveryEntity CsmSiteRecoveryEntity, cancel <-chan struct{}) (result autorest.Response, err error) { - req, err := client.RecoverSitePreparer(resourceGroupName, name, recoveryEntity, cancel) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.SitesClient", "RecoverSite", nil, "Failure preparing request") - } - - resp, err := client.RecoverSiteSender(req) - if err != nil { - result.Response = resp - return result, autorest.NewErrorWithError(err, "web.SitesClient", "RecoverSite", resp, "Failure sending request") - } - - result, err = client.RecoverSiteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.SitesClient", "RecoverSite", resp, "Failure responding to request") - } - - return -} - -// RecoverSitePreparer prepares the RecoverSite request. -func (client SitesClient) RecoverSitePreparer(resourceGroupName string, name string, recoveryEntity CsmSiteRecoveryEntity, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/recover", pathParameters), - autorest.WithJSON(recoveryEntity), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// RecoverSiteSender sends the RecoverSite request. The method will close the -// http.Response Body if it receives an error. -func (client SitesClient) RecoverSiteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// RecoverSiteResponder handles the response to the RecoverSite request. The method always -// closes the http.Response Body. -func (client SitesClient) RecoverSiteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNotFound), - autorest.ByClosing()) - result.Response = resp - return -} - -// RecoverSiteSlot sends the recover site slot request. This method may poll -// for completion. Polling can be canceled by passing the cancel channel -// argument. The channel will be used to cancel polling and any outstanding -// HTTP requests. -// -// resourceGroupName is name of resource group name is name of web app -// recoveryEntity is snapshot data used for web app recovery. Snapshot -// information can be obtained by calling GetDeletedSites or GetSiteSnapshots -// API. slot is name of web app slot. If not specified then will default to -// production slot. -func (client SitesClient) RecoverSiteSlot(resourceGroupName string, name string, recoveryEntity CsmSiteRecoveryEntity, slot string, cancel <-chan struct{}) (result autorest.Response, err error) { - req, err := client.RecoverSiteSlotPreparer(resourceGroupName, name, recoveryEntity, slot, cancel) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.SitesClient", "RecoverSiteSlot", nil, "Failure preparing request") - } - - resp, err := client.RecoverSiteSlotSender(req) - if err != nil { - result.Response = resp - return result, autorest.NewErrorWithError(err, "web.SitesClient", "RecoverSiteSlot", resp, "Failure sending request") - } - - result, err = client.RecoverSiteSlotResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.SitesClient", "RecoverSiteSlot", resp, "Failure responding to request") - } - - return -} - -// RecoverSiteSlotPreparer prepares the RecoverSiteSlot request. -func (client SitesClient) RecoverSiteSlotPreparer(resourceGroupName string, name string, recoveryEntity CsmSiteRecoveryEntity, slot string, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "slot": autorest.Encode("path", slot), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/recover", pathParameters), - autorest.WithJSON(recoveryEntity), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// RecoverSiteSlotSender sends the RecoverSiteSlot request. The method will close the -// http.Response Body if it receives an error. -func (client SitesClient) RecoverSiteSlotSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// RecoverSiteSlotResponder handles the response to the RecoverSiteSlot request. The method always -// closes the http.Response Body. -func (client SitesClient) RecoverSiteSlotResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNotFound), - autorest.ByClosing()) - result.Response = resp - return -} - -// ResetProductionSlotConfig sends the reset production slot config request. -// -// resourceGroupName is name of resource group name is name of web app -func (client SitesClient) ResetProductionSlotConfig(resourceGroupName string, name string) (result SetObject, err error) { - req, err := client.ResetProductionSlotConfigPreparer(resourceGroupName, name) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.SitesClient", "ResetProductionSlotConfig", nil, "Failure preparing request") - } - - resp, err := client.ResetProductionSlotConfigSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.SitesClient", "ResetProductionSlotConfig", resp, "Failure sending request") - } - - result, err = client.ResetProductionSlotConfigResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.SitesClient", "ResetProductionSlotConfig", resp, "Failure responding to request") - } - - return -} - -// ResetProductionSlotConfigPreparer prepares the ResetProductionSlotConfig request. -func (client SitesClient) ResetProductionSlotConfigPreparer(resourceGroupName string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/resetSlotConfig", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ResetProductionSlotConfigSender sends the ResetProductionSlotConfig request. The method will close the -// http.Response Body if it receives an error. -func (client SitesClient) ResetProductionSlotConfigSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ResetProductionSlotConfigResponder handles the response to the ResetProductionSlotConfig request. The method always -// closes the http.Response Body. -func (client SitesClient) ResetProductionSlotConfigResponder(resp *http.Response) (result SetObject, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Value), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ResetSlotConfigSlot sends the reset slot config slot request. -// -// resourceGroupName is name of resource group name is name of web app slot is -// name of web app slot. If not specified then will default to production slot. -func (client SitesClient) ResetSlotConfigSlot(resourceGroupName string, name string, slot string) (result SetObject, err error) { - req, err := client.ResetSlotConfigSlotPreparer(resourceGroupName, name, slot) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.SitesClient", "ResetSlotConfigSlot", nil, "Failure preparing request") - } - - resp, err := client.ResetSlotConfigSlotSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.SitesClient", "ResetSlotConfigSlot", resp, "Failure sending request") - } - - result, err = client.ResetSlotConfigSlotResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.SitesClient", "ResetSlotConfigSlot", resp, "Failure responding to request") - } - - return -} - -// ResetSlotConfigSlotPreparer prepares the ResetSlotConfigSlot request. -func (client SitesClient) ResetSlotConfigSlotPreparer(resourceGroupName string, name string, slot string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "slot": autorest.Encode("path", slot), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/resetSlotConfig", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ResetSlotConfigSlotSender sends the ResetSlotConfigSlot request. The method will close the -// http.Response Body if it receives an error. -func (client SitesClient) ResetSlotConfigSlotSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ResetSlotConfigSlotResponder handles the response to the ResetSlotConfigSlot request. The method always -// closes the http.Response Body. -func (client SitesClient) ResetSlotConfigSlotResponder(resp *http.Response) (result SetObject, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Value), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// RestartSite sends the restart site request. -// -// resourceGroupName is name of resource group name is name of web app -// softRestart is soft restart applies the configuration settings and restarts -// the app if necessary. Hard restart always restarts and reprovisions the app -// synchronous is if true then the API will block until the app has been -// restarted -func (client SitesClient) RestartSite(resourceGroupName string, name string, softRestart *bool, synchronous *bool) (result SetObject, err error) { - req, err := client.RestartSitePreparer(resourceGroupName, name, softRestart, synchronous) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.SitesClient", "RestartSite", nil, "Failure preparing request") - } - - resp, err := client.RestartSiteSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.SitesClient", "RestartSite", resp, "Failure sending request") - } - - result, err = client.RestartSiteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.SitesClient", "RestartSite", resp, "Failure responding to request") - } - - return -} - -// RestartSitePreparer prepares the RestartSite request. -func (client SitesClient) RestartSitePreparer(resourceGroupName string, name string, softRestart *bool, synchronous *bool) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - if softRestart != nil { - queryParameters["softRestart"] = autorest.Encode("query", *softRestart) - } - if synchronous != nil { - queryParameters["synchronous"] = autorest.Encode("query", *synchronous) - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/restart", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// RestartSiteSender sends the RestartSite request. The method will close the -// http.Response Body if it receives an error. -func (client SitesClient) RestartSiteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// RestartSiteResponder handles the response to the RestartSite request. The method always -// closes the http.Response Body. -func (client SitesClient) RestartSiteResponder(resp *http.Response) (result SetObject, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Value), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// RestartSiteSlot sends the restart site slot request. -// -// resourceGroupName is name of resource group name is name of web app slot is -// name of web app slot. If not specified then will default to production slot. -// softRestart is soft restart applies the configuration settings and restarts -// the app if necessary. Hard restart always restarts and reprovisions the app -// synchronous is if true then the API will block until the app has been -// restarted -func (client SitesClient) RestartSiteSlot(resourceGroupName string, name string, slot string, softRestart *bool, synchronous *bool) (result SetObject, err error) { - req, err := client.RestartSiteSlotPreparer(resourceGroupName, name, slot, softRestart, synchronous) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.SitesClient", "RestartSiteSlot", nil, "Failure preparing request") - } - - resp, err := client.RestartSiteSlotSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.SitesClient", "RestartSiteSlot", resp, "Failure sending request") - } - - result, err = client.RestartSiteSlotResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.SitesClient", "RestartSiteSlot", resp, "Failure responding to request") - } - - return -} - -// RestartSiteSlotPreparer prepares the RestartSiteSlot request. -func (client SitesClient) RestartSiteSlotPreparer(resourceGroupName string, name string, slot string, softRestart *bool, synchronous *bool) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "slot": autorest.Encode("path", slot), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - if softRestart != nil { - queryParameters["softRestart"] = autorest.Encode("query", *softRestart) - } - if synchronous != nil { - queryParameters["synchronous"] = autorest.Encode("query", *synchronous) - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/restart", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// RestartSiteSlotSender sends the RestartSiteSlot request. The method will close the -// http.Response Body if it receives an error. -func (client SitesClient) RestartSiteSlotSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// RestartSiteSlotResponder handles the response to the RestartSiteSlot request. The method always -// closes the http.Response Body. -func (client SitesClient) RestartSiteSlotResponder(resp *http.Response) (result SetObject, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Value), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// RestoreSite sends the restore site request. This method may poll for -// completion. Polling can be canceled by passing the cancel channel argument. -// The channel will be used to cancel polling and any outstanding HTTP -// requests. -// -// resourceGroupName is name of resource group name is name of web app backupID -// is id of backup to restore request is information on restore request -func (client SitesClient) RestoreSite(resourceGroupName string, name string, backupID string, request RestoreRequest, cancel <-chan struct{}) (result autorest.Response, err error) { - req, err := client.RestoreSitePreparer(resourceGroupName, name, backupID, request, cancel) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.SitesClient", "RestoreSite", nil, "Failure preparing request") - } - - resp, err := client.RestoreSiteSender(req) - if err != nil { - result.Response = resp - return result, autorest.NewErrorWithError(err, "web.SitesClient", "RestoreSite", resp, "Failure sending request") - } - - result, err = client.RestoreSiteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.SitesClient", "RestoreSite", resp, "Failure responding to request") - } - - return -} - -// RestoreSitePreparer prepares the RestoreSite request. -func (client SitesClient) RestoreSitePreparer(resourceGroupName string, name string, backupID string, request RestoreRequest, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "backupId": autorest.Encode("path", backupID), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/backups/{backupId}/restore", pathParameters), - autorest.WithJSON(request), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// RestoreSiteSender sends the RestoreSite request. The method will close the -// http.Response Body if it receives an error. -func (client SitesClient) RestoreSiteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// RestoreSiteResponder handles the response to the RestoreSite request. The method always -// closes the http.Response Body. -func (client SitesClient) RestoreSiteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// RestoreSiteSlot sends the restore site slot request. This method may poll -// for completion. Polling can be canceled by passing the cancel channel -// argument. The channel will be used to cancel polling and any outstanding -// HTTP requests. -// -// resourceGroupName is name of resource group name is name of web app backupID -// is id of backup to restore request is information on restore request slot is -// name of web app slot. If not specified then will default to production slot. -func (client SitesClient) RestoreSiteSlot(resourceGroupName string, name string, backupID string, request RestoreRequest, slot string, cancel <-chan struct{}) (result autorest.Response, err error) { - req, err := client.RestoreSiteSlotPreparer(resourceGroupName, name, backupID, request, slot, cancel) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.SitesClient", "RestoreSiteSlot", nil, "Failure preparing request") - } - - resp, err := client.RestoreSiteSlotSender(req) - if err != nil { - result.Response = resp - return result, autorest.NewErrorWithError(err, "web.SitesClient", "RestoreSiteSlot", resp, "Failure sending request") - } - - result, err = client.RestoreSiteSlotResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.SitesClient", "RestoreSiteSlot", resp, "Failure responding to request") - } - - return -} - -// RestoreSiteSlotPreparer prepares the RestoreSiteSlot request. -func (client SitesClient) RestoreSiteSlotPreparer(resourceGroupName string, name string, backupID string, request RestoreRequest, slot string, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "backupId": autorest.Encode("path", backupID), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "slot": autorest.Encode("path", slot), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/backups/{backupId}/restore", pathParameters), - autorest.WithJSON(request), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// RestoreSiteSlotSender sends the RestoreSiteSlot request. The method will close the -// http.Response Body if it receives an error. -func (client SitesClient) RestoreSiteSlotSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// RestoreSiteSlotResponder handles the response to the RestoreSiteSlot request. The method always -// closes the http.Response Body. -func (client SitesClient) RestoreSiteSlotResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// StartSite sends the start site request. -// -// resourceGroupName is name of resource group name is name of web app -func (client SitesClient) StartSite(resourceGroupName string, name string) (result SetObject, err error) { - req, err := client.StartSitePreparer(resourceGroupName, name) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.SitesClient", "StartSite", nil, "Failure preparing request") - } - - resp, err := client.StartSiteSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.SitesClient", "StartSite", resp, "Failure sending request") - } - - result, err = client.StartSiteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.SitesClient", "StartSite", resp, "Failure responding to request") - } - - return -} - -// StartSitePreparer prepares the StartSite request. -func (client SitesClient) StartSitePreparer(resourceGroupName string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/start", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// StartSiteSender sends the StartSite request. The method will close the -// http.Response Body if it receives an error. -func (client SitesClient) StartSiteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// StartSiteResponder handles the response to the StartSite request. The method always -// closes the http.Response Body. -func (client SitesClient) StartSiteResponder(resp *http.Response) (result SetObject, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Value), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// StartSiteSlot sends the start site slot request. -// -// resourceGroupName is name of resource group name is name of web app slot is -// name of web app slot. If not specified then will default to production slot. -func (client SitesClient) StartSiteSlot(resourceGroupName string, name string, slot string) (result SetObject, err error) { - req, err := client.StartSiteSlotPreparer(resourceGroupName, name, slot) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.SitesClient", "StartSiteSlot", nil, "Failure preparing request") - } - - resp, err := client.StartSiteSlotSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.SitesClient", "StartSiteSlot", resp, "Failure sending request") - } - - result, err = client.StartSiteSlotResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.SitesClient", "StartSiteSlot", resp, "Failure responding to request") - } - - return -} - -// StartSiteSlotPreparer prepares the StartSiteSlot request. -func (client SitesClient) StartSiteSlotPreparer(resourceGroupName string, name string, slot string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "slot": autorest.Encode("path", slot), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/start", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// StartSiteSlotSender sends the StartSiteSlot request. The method will close the -// http.Response Body if it receives an error. -func (client SitesClient) StartSiteSlotSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// StartSiteSlotResponder handles the response to the StartSiteSlot request. The method always -// closes the http.Response Body. -func (client SitesClient) StartSiteSlotResponder(resp *http.Response) (result SetObject, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Value), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// StopSite sends the stop site request. -// -// resourceGroupName is name of resource group name is name of web app -func (client SitesClient) StopSite(resourceGroupName string, name string) (result SetObject, err error) { - req, err := client.StopSitePreparer(resourceGroupName, name) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.SitesClient", "StopSite", nil, "Failure preparing request") - } - - resp, err := client.StopSiteSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.SitesClient", "StopSite", resp, "Failure sending request") - } - - result, err = client.StopSiteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.SitesClient", "StopSite", resp, "Failure responding to request") - } - - return -} - -// StopSitePreparer prepares the StopSite request. -func (client SitesClient) StopSitePreparer(resourceGroupName string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/stop", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// StopSiteSender sends the StopSite request. The method will close the -// http.Response Body if it receives an error. -func (client SitesClient) StopSiteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// StopSiteResponder handles the response to the StopSite request. The method always -// closes the http.Response Body. -func (client SitesClient) StopSiteResponder(resp *http.Response) (result SetObject, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Value), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// StopSiteSlot sends the stop site slot request. -// -// resourceGroupName is name of resource group name is name of web app slot is -// name of web app slot. If not specified then will default to production slot. -func (client SitesClient) StopSiteSlot(resourceGroupName string, name string, slot string) (result SetObject, err error) { - req, err := client.StopSiteSlotPreparer(resourceGroupName, name, slot) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.SitesClient", "StopSiteSlot", nil, "Failure preparing request") - } - - resp, err := client.StopSiteSlotSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.SitesClient", "StopSiteSlot", resp, "Failure sending request") - } - - result, err = client.StopSiteSlotResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.SitesClient", "StopSiteSlot", resp, "Failure responding to request") - } - - return -} - -// StopSiteSlotPreparer prepares the StopSiteSlot request. -func (client SitesClient) StopSiteSlotPreparer(resourceGroupName string, name string, slot string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "slot": autorest.Encode("path", slot), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/stop", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// StopSiteSlotSender sends the StopSiteSlot request. The method will close the -// http.Response Body if it receives an error. -func (client SitesClient) StopSiteSlotSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// StopSiteSlotResponder handles the response to the StopSiteSlot request. The method always -// closes the http.Response Body. -func (client SitesClient) StopSiteSlotResponder(resp *http.Response) (result SetObject, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Value), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// SwapSlotsSlot sends the swap slots slot request. This method may poll for -// completion. Polling can be canceled by passing the cancel channel argument. -// The channel will be used to cancel polling and any outstanding HTTP -// requests. -// -// resourceGroupName is name of resource group name is name of web app -// slotSwapEntity is request body that contains the target slot name slot is -// name of source slot for the swap -func (client SitesClient) SwapSlotsSlot(resourceGroupName string, name string, slotSwapEntity CsmSlotEntity, slot string, cancel <-chan struct{}) (result autorest.Response, err error) { - req, err := client.SwapSlotsSlotPreparer(resourceGroupName, name, slotSwapEntity, slot, cancel) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.SitesClient", "SwapSlotsSlot", nil, "Failure preparing request") - } - - resp, err := client.SwapSlotsSlotSender(req) - if err != nil { - result.Response = resp - return result, autorest.NewErrorWithError(err, "web.SitesClient", "SwapSlotsSlot", resp, "Failure sending request") - } - - result, err = client.SwapSlotsSlotResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.SitesClient", "SwapSlotsSlot", resp, "Failure responding to request") - } - - return -} - -// SwapSlotsSlotPreparer prepares the SwapSlotsSlot request. -func (client SitesClient) SwapSlotsSlotPreparer(resourceGroupName string, name string, slotSwapEntity CsmSlotEntity, slot string, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "slot": autorest.Encode("path", slot), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/slotsswap", pathParameters), - autorest.WithJSON(slotSwapEntity), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// SwapSlotsSlotSender sends the SwapSlotsSlot request. The method will close the -// http.Response Body if it receives an error. -func (client SitesClient) SwapSlotsSlotSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// SwapSlotsSlotResponder handles the response to the SwapSlotsSlot request. The method always -// closes the http.Response Body. -func (client SitesClient) SwapSlotsSlotResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} - -// SwapSlotWithProduction sends the swap slot with production request. This -// method may poll for completion. Polling can be canceled by passing the -// cancel channel argument. The channel will be used to cancel polling and any -// outstanding HTTP requests. -// -// resourceGroupName is name of resource group name is name of web app -// slotSwapEntity is request body that contains the target slot name -func (client SitesClient) SwapSlotWithProduction(resourceGroupName string, name string, slotSwapEntity CsmSlotEntity, cancel <-chan struct{}) (result autorest.Response, err error) { - req, err := client.SwapSlotWithProductionPreparer(resourceGroupName, name, slotSwapEntity, cancel) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.SitesClient", "SwapSlotWithProduction", nil, "Failure preparing request") - } - - resp, err := client.SwapSlotWithProductionSender(req) - if err != nil { - result.Response = resp - return result, autorest.NewErrorWithError(err, "web.SitesClient", "SwapSlotWithProduction", resp, "Failure sending request") - } - - result, err = client.SwapSlotWithProductionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.SitesClient", "SwapSlotWithProduction", resp, "Failure responding to request") - } - - return -} - -// SwapSlotWithProductionPreparer prepares the SwapSlotWithProduction request. -func (client SitesClient) SwapSlotWithProductionPreparer(resourceGroupName string, name string, slotSwapEntity CsmSlotEntity, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slotsswap", pathParameters), - autorest.WithJSON(slotSwapEntity), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// SwapSlotWithProductionSender sends the SwapSlotWithProduction request. The method will close the -// http.Response Body if it receives an error. -func (client SitesClient) SwapSlotWithProductionSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// SwapSlotWithProductionResponder handles the response to the SwapSlotWithProduction request. The method always -// closes the http.Response Body. -func (client SitesClient) SwapSlotWithProductionResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} - -// SyncSiteRepository sends the sync site repository request. -// -func (client SitesClient) SyncSiteRepository(resourceGroupName string, name string) (result SetObject, err error) { - req, err := client.SyncSiteRepositoryPreparer(resourceGroupName, name) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.SitesClient", "SyncSiteRepository", nil, "Failure preparing request") - } - - resp, err := client.SyncSiteRepositorySender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.SitesClient", "SyncSiteRepository", resp, "Failure sending request") - } - - result, err = client.SyncSiteRepositoryResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.SitesClient", "SyncSiteRepository", resp, "Failure responding to request") - } - - return -} - -// SyncSiteRepositoryPreparer prepares the SyncSiteRepository request. -func (client SitesClient) SyncSiteRepositoryPreparer(resourceGroupName string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/sync", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// SyncSiteRepositorySender sends the SyncSiteRepository request. The method will close the -// http.Response Body if it receives an error. -func (client SitesClient) SyncSiteRepositorySender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// SyncSiteRepositoryResponder handles the response to the SyncSiteRepository request. The method always -// closes the http.Response Body. -func (client SitesClient) SyncSiteRepositoryResponder(resp *http.Response) (result SetObject, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Value), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// SyncSiteRepositorySlot sends the sync site repository slot request. -// -func (client SitesClient) SyncSiteRepositorySlot(resourceGroupName string, name string, slot string) (result SetObject, err error) { - req, err := client.SyncSiteRepositorySlotPreparer(resourceGroupName, name, slot) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.SitesClient", "SyncSiteRepositorySlot", nil, "Failure preparing request") - } - - resp, err := client.SyncSiteRepositorySlotSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.SitesClient", "SyncSiteRepositorySlot", resp, "Failure sending request") - } - - result, err = client.SyncSiteRepositorySlotResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.SitesClient", "SyncSiteRepositorySlot", resp, "Failure responding to request") - } - - return -} - -// SyncSiteRepositorySlotPreparer prepares the SyncSiteRepositorySlot request. -func (client SitesClient) SyncSiteRepositorySlotPreparer(resourceGroupName string, name string, slot string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "slot": autorest.Encode("path", slot), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/sync", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// SyncSiteRepositorySlotSender sends the SyncSiteRepositorySlot request. The method will close the -// http.Response Body if it receives an error. -func (client SitesClient) SyncSiteRepositorySlotSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// SyncSiteRepositorySlotResponder handles the response to the SyncSiteRepositorySlot request. The method always -// closes the http.Response Body. -func (client SitesClient) SyncSiteRepositorySlotResponder(resp *http.Response) (result SetObject, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Value), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// UpdateSiteAppSettings sends the update site app settings request. -// -// resourceGroupName is name of resource group name is name of web app -// appSettings is application settings of web app -func (client SitesClient) UpdateSiteAppSettings(resourceGroupName string, name string, appSettings StringDictionary) (result StringDictionary, err error) { - req, err := client.UpdateSiteAppSettingsPreparer(resourceGroupName, name, appSettings) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.SitesClient", "UpdateSiteAppSettings", nil, "Failure preparing request") - } - - resp, err := client.UpdateSiteAppSettingsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.SitesClient", "UpdateSiteAppSettings", resp, "Failure sending request") - } - - result, err = client.UpdateSiteAppSettingsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.SitesClient", "UpdateSiteAppSettings", resp, "Failure responding to request") - } - - return -} - -// UpdateSiteAppSettingsPreparer prepares the UpdateSiteAppSettings request. -func (client SitesClient) UpdateSiteAppSettingsPreparer(resourceGroupName string, name string, appSettings StringDictionary) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/appsettings", pathParameters), - autorest.WithJSON(appSettings), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// UpdateSiteAppSettingsSender sends the UpdateSiteAppSettings request. The method will close the -// http.Response Body if it receives an error. -func (client SitesClient) UpdateSiteAppSettingsSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// UpdateSiteAppSettingsResponder handles the response to the UpdateSiteAppSettings request. The method always -// closes the http.Response Body. -func (client SitesClient) UpdateSiteAppSettingsResponder(resp *http.Response) (result StringDictionary, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// UpdateSiteAppSettingsSlot sends the update site app settings slot request. -// -// resourceGroupName is name of resource group name is name of web app -// appSettings is application settings of web app slot is name of web app slot. -// If not specified then will default to production slot. -func (client SitesClient) UpdateSiteAppSettingsSlot(resourceGroupName string, name string, appSettings StringDictionary, slot string) (result StringDictionary, err error) { - req, err := client.UpdateSiteAppSettingsSlotPreparer(resourceGroupName, name, appSettings, slot) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.SitesClient", "UpdateSiteAppSettingsSlot", nil, "Failure preparing request") - } - - resp, err := client.UpdateSiteAppSettingsSlotSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.SitesClient", "UpdateSiteAppSettingsSlot", resp, "Failure sending request") - } - - result, err = client.UpdateSiteAppSettingsSlotResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.SitesClient", "UpdateSiteAppSettingsSlot", resp, "Failure responding to request") - } - - return -} - -// UpdateSiteAppSettingsSlotPreparer prepares the UpdateSiteAppSettingsSlot request. -func (client SitesClient) UpdateSiteAppSettingsSlotPreparer(resourceGroupName string, name string, appSettings StringDictionary, slot string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "slot": autorest.Encode("path", slot), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/appsettings", pathParameters), - autorest.WithJSON(appSettings), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// UpdateSiteAppSettingsSlotSender sends the UpdateSiteAppSettingsSlot request. The method will close the -// http.Response Body if it receives an error. -func (client SitesClient) UpdateSiteAppSettingsSlotSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// UpdateSiteAppSettingsSlotResponder handles the response to the UpdateSiteAppSettingsSlot request. The method always -// closes the http.Response Body. -func (client SitesClient) UpdateSiteAppSettingsSlotResponder(resp *http.Response) (result StringDictionary, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// UpdateSiteAuthSettings sends the update site auth settings request. -// -// resourceGroupName is name of resource group name is name of web app -// siteAuthSettings is auth settings associated with web app -func (client SitesClient) UpdateSiteAuthSettings(resourceGroupName string, name string, siteAuthSettings SiteAuthSettings) (result SiteAuthSettings, err error) { - req, err := client.UpdateSiteAuthSettingsPreparer(resourceGroupName, name, siteAuthSettings) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.SitesClient", "UpdateSiteAuthSettings", nil, "Failure preparing request") - } - - resp, err := client.UpdateSiteAuthSettingsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.SitesClient", "UpdateSiteAuthSettings", resp, "Failure sending request") - } - - result, err = client.UpdateSiteAuthSettingsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.SitesClient", "UpdateSiteAuthSettings", resp, "Failure responding to request") - } - - return -} - -// UpdateSiteAuthSettingsPreparer prepares the UpdateSiteAuthSettings request. -func (client SitesClient) UpdateSiteAuthSettingsPreparer(resourceGroupName string, name string, siteAuthSettings SiteAuthSettings) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/authsettings", pathParameters), - autorest.WithJSON(siteAuthSettings), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// UpdateSiteAuthSettingsSender sends the UpdateSiteAuthSettings request. The method will close the -// http.Response Body if it receives an error. -func (client SitesClient) UpdateSiteAuthSettingsSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// UpdateSiteAuthSettingsResponder handles the response to the UpdateSiteAuthSettings request. The method always -// closes the http.Response Body. -func (client SitesClient) UpdateSiteAuthSettingsResponder(resp *http.Response) (result SiteAuthSettings, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// UpdateSiteAuthSettingsSlot sends the update site auth settings slot request. -// -// resourceGroupName is name of resource group name is name of web app -// siteAuthSettings is auth settings associated with web app slot is name of -// web app slot. If not specified then will default to production slot. -func (client SitesClient) UpdateSiteAuthSettingsSlot(resourceGroupName string, name string, siteAuthSettings SiteAuthSettings, slot string) (result SiteAuthSettings, err error) { - req, err := client.UpdateSiteAuthSettingsSlotPreparer(resourceGroupName, name, siteAuthSettings, slot) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.SitesClient", "UpdateSiteAuthSettingsSlot", nil, "Failure preparing request") - } - - resp, err := client.UpdateSiteAuthSettingsSlotSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.SitesClient", "UpdateSiteAuthSettingsSlot", resp, "Failure sending request") - } - - result, err = client.UpdateSiteAuthSettingsSlotResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.SitesClient", "UpdateSiteAuthSettingsSlot", resp, "Failure responding to request") - } - - return -} - -// UpdateSiteAuthSettingsSlotPreparer prepares the UpdateSiteAuthSettingsSlot request. -func (client SitesClient) UpdateSiteAuthSettingsSlotPreparer(resourceGroupName string, name string, siteAuthSettings SiteAuthSettings, slot string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "slot": autorest.Encode("path", slot), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/authsettings", pathParameters), - autorest.WithJSON(siteAuthSettings), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// UpdateSiteAuthSettingsSlotSender sends the UpdateSiteAuthSettingsSlot request. The method will close the -// http.Response Body if it receives an error. -func (client SitesClient) UpdateSiteAuthSettingsSlotSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// UpdateSiteAuthSettingsSlotResponder handles the response to the UpdateSiteAuthSettingsSlot request. The method always -// closes the http.Response Body. -func (client SitesClient) UpdateSiteAuthSettingsSlotResponder(resp *http.Response) (result SiteAuthSettings, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// UpdateSiteBackupConfiguration sends the update site backup configuration -// request. -// -// resourceGroupName is name of resource group name is name of web app request -// is information on backup request -func (client SitesClient) UpdateSiteBackupConfiguration(resourceGroupName string, name string, request BackupRequest) (result BackupRequest, err error) { - req, err := client.UpdateSiteBackupConfigurationPreparer(resourceGroupName, name, request) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.SitesClient", "UpdateSiteBackupConfiguration", nil, "Failure preparing request") - } - - resp, err := client.UpdateSiteBackupConfigurationSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.SitesClient", "UpdateSiteBackupConfiguration", resp, "Failure sending request") - } - - result, err = client.UpdateSiteBackupConfigurationResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.SitesClient", "UpdateSiteBackupConfiguration", resp, "Failure responding to request") - } - - return -} - -// UpdateSiteBackupConfigurationPreparer prepares the UpdateSiteBackupConfiguration request. -func (client SitesClient) UpdateSiteBackupConfigurationPreparer(resourceGroupName string, name string, request BackupRequest) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/backup", pathParameters), - autorest.WithJSON(request), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// UpdateSiteBackupConfigurationSender sends the UpdateSiteBackupConfiguration request. The method will close the -// http.Response Body if it receives an error. -func (client SitesClient) UpdateSiteBackupConfigurationSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// UpdateSiteBackupConfigurationResponder handles the response to the UpdateSiteBackupConfiguration request. The method always -// closes the http.Response Body. -func (client SitesClient) UpdateSiteBackupConfigurationResponder(resp *http.Response) (result BackupRequest, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// UpdateSiteBackupConfigurationSlot sends the update site backup configuration -// slot request. -// -// resourceGroupName is name of resource group name is name of web app request -// is information on backup request slot is name of web app slot. If not -// specified then will default to production slot. -func (client SitesClient) UpdateSiteBackupConfigurationSlot(resourceGroupName string, name string, request BackupRequest, slot string) (result BackupRequest, err error) { - req, err := client.UpdateSiteBackupConfigurationSlotPreparer(resourceGroupName, name, request, slot) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.SitesClient", "UpdateSiteBackupConfigurationSlot", nil, "Failure preparing request") - } - - resp, err := client.UpdateSiteBackupConfigurationSlotSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.SitesClient", "UpdateSiteBackupConfigurationSlot", resp, "Failure sending request") - } - - result, err = client.UpdateSiteBackupConfigurationSlotResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.SitesClient", "UpdateSiteBackupConfigurationSlot", resp, "Failure responding to request") - } - - return -} - -// UpdateSiteBackupConfigurationSlotPreparer prepares the UpdateSiteBackupConfigurationSlot request. -func (client SitesClient) UpdateSiteBackupConfigurationSlotPreparer(resourceGroupName string, name string, request BackupRequest, slot string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "slot": autorest.Encode("path", slot), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/backup", pathParameters), - autorest.WithJSON(request), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// UpdateSiteBackupConfigurationSlotSender sends the UpdateSiteBackupConfigurationSlot request. The method will close the -// http.Response Body if it receives an error. -func (client SitesClient) UpdateSiteBackupConfigurationSlotSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// UpdateSiteBackupConfigurationSlotResponder handles the response to the UpdateSiteBackupConfigurationSlot request. The method always -// closes the http.Response Body. -func (client SitesClient) UpdateSiteBackupConfigurationSlotResponder(resp *http.Response) (result BackupRequest, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// UpdateSiteConfig sends the update site config request. -// -// resourceGroupName is name of resource group name is name of web app -// siteConfig is request body that contains the configuraiton setting for the -// web app -func (client SitesClient) UpdateSiteConfig(resourceGroupName string, name string, siteConfig SiteConfig) (result SiteConfig, err error) { - req, err := client.UpdateSiteConfigPreparer(resourceGroupName, name, siteConfig) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.SitesClient", "UpdateSiteConfig", nil, "Failure preparing request") - } - - resp, err := client.UpdateSiteConfigSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.SitesClient", "UpdateSiteConfig", resp, "Failure sending request") - } - - result, err = client.UpdateSiteConfigResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.SitesClient", "UpdateSiteConfig", resp, "Failure responding to request") - } - - return -} - -// UpdateSiteConfigPreparer prepares the UpdateSiteConfig request. -func (client SitesClient) UpdateSiteConfigPreparer(resourceGroupName string, name string, siteConfig SiteConfig) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/web", pathParameters), - autorest.WithJSON(siteConfig), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// UpdateSiteConfigSender sends the UpdateSiteConfig request. The method will close the -// http.Response Body if it receives an error. -func (client SitesClient) UpdateSiteConfigSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// UpdateSiteConfigResponder handles the response to the UpdateSiteConfig request. The method always -// closes the http.Response Body. -func (client SitesClient) UpdateSiteConfigResponder(resp *http.Response) (result SiteConfig, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// UpdateSiteConfigSlot sends the update site config slot request. -// -// resourceGroupName is name of resource group name is name of web app -// siteConfig is request body that contains the configuraiton setting for the -// web app slot is name of web app slot. If not specified then will default to -// production slot. -func (client SitesClient) UpdateSiteConfigSlot(resourceGroupName string, name string, siteConfig SiteConfig, slot string) (result SiteConfig, err error) { - req, err := client.UpdateSiteConfigSlotPreparer(resourceGroupName, name, siteConfig, slot) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.SitesClient", "UpdateSiteConfigSlot", nil, "Failure preparing request") - } - - resp, err := client.UpdateSiteConfigSlotSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.SitesClient", "UpdateSiteConfigSlot", resp, "Failure sending request") - } - - result, err = client.UpdateSiteConfigSlotResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.SitesClient", "UpdateSiteConfigSlot", resp, "Failure responding to request") - } - - return -} - -// UpdateSiteConfigSlotPreparer prepares the UpdateSiteConfigSlot request. -func (client SitesClient) UpdateSiteConfigSlotPreparer(resourceGroupName string, name string, siteConfig SiteConfig, slot string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "slot": autorest.Encode("path", slot), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/web", pathParameters), - autorest.WithJSON(siteConfig), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// UpdateSiteConfigSlotSender sends the UpdateSiteConfigSlot request. The method will close the -// http.Response Body if it receives an error. -func (client SitesClient) UpdateSiteConfigSlotSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// UpdateSiteConfigSlotResponder handles the response to the UpdateSiteConfigSlot request. The method always -// closes the http.Response Body. -func (client SitesClient) UpdateSiteConfigSlotResponder(resp *http.Response) (result SiteConfig, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// UpdateSiteConnectionStrings sends the update site connection strings -// request. -// -// resourceGroupName is name of resource group name is name of web app -// connectionStrings is connection strings associated with web app -func (client SitesClient) UpdateSiteConnectionStrings(resourceGroupName string, name string, connectionStrings ConnectionStringDictionary) (result ConnectionStringDictionary, err error) { - req, err := client.UpdateSiteConnectionStringsPreparer(resourceGroupName, name, connectionStrings) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.SitesClient", "UpdateSiteConnectionStrings", nil, "Failure preparing request") - } - - resp, err := client.UpdateSiteConnectionStringsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.SitesClient", "UpdateSiteConnectionStrings", resp, "Failure sending request") - } - - result, err = client.UpdateSiteConnectionStringsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.SitesClient", "UpdateSiteConnectionStrings", resp, "Failure responding to request") - } - - return -} - -// UpdateSiteConnectionStringsPreparer prepares the UpdateSiteConnectionStrings request. -func (client SitesClient) UpdateSiteConnectionStringsPreparer(resourceGroupName string, name string, connectionStrings ConnectionStringDictionary) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/connectionstrings", pathParameters), - autorest.WithJSON(connectionStrings), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// UpdateSiteConnectionStringsSender sends the UpdateSiteConnectionStrings request. The method will close the -// http.Response Body if it receives an error. -func (client SitesClient) UpdateSiteConnectionStringsSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// UpdateSiteConnectionStringsResponder handles the response to the UpdateSiteConnectionStrings request. The method always -// closes the http.Response Body. -func (client SitesClient) UpdateSiteConnectionStringsResponder(resp *http.Response) (result ConnectionStringDictionary, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// UpdateSiteConnectionStringsSlot sends the update site connection strings -// slot request. -// -// resourceGroupName is name of resource group name is name of web app -// connectionStrings is connection strings associated with web app slot is name -// of web app slot. If not specified then will default to production slot. -func (client SitesClient) UpdateSiteConnectionStringsSlot(resourceGroupName string, name string, connectionStrings ConnectionStringDictionary, slot string) (result ConnectionStringDictionary, err error) { - req, err := client.UpdateSiteConnectionStringsSlotPreparer(resourceGroupName, name, connectionStrings, slot) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.SitesClient", "UpdateSiteConnectionStringsSlot", nil, "Failure preparing request") - } - - resp, err := client.UpdateSiteConnectionStringsSlotSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.SitesClient", "UpdateSiteConnectionStringsSlot", resp, "Failure sending request") - } - - result, err = client.UpdateSiteConnectionStringsSlotResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.SitesClient", "UpdateSiteConnectionStringsSlot", resp, "Failure responding to request") - } - - return -} - -// UpdateSiteConnectionStringsSlotPreparer prepares the UpdateSiteConnectionStringsSlot request. -func (client SitesClient) UpdateSiteConnectionStringsSlotPreparer(resourceGroupName string, name string, connectionStrings ConnectionStringDictionary, slot string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "slot": autorest.Encode("path", slot), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/connectionstrings", pathParameters), - autorest.WithJSON(connectionStrings), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// UpdateSiteConnectionStringsSlotSender sends the UpdateSiteConnectionStringsSlot request. The method will close the -// http.Response Body if it receives an error. -func (client SitesClient) UpdateSiteConnectionStringsSlotSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// UpdateSiteConnectionStringsSlotResponder handles the response to the UpdateSiteConnectionStringsSlot request. The method always -// closes the http.Response Body. -func (client SitesClient) UpdateSiteConnectionStringsSlotResponder(resp *http.Response) (result ConnectionStringDictionary, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// UpdateSiteLogsConfig sends the update site logs config request. -// -// resourceGroupName is name of resource group name is name of web app -// siteLogsConfig is site logs configuration -func (client SitesClient) UpdateSiteLogsConfig(resourceGroupName string, name string, siteLogsConfig SiteLogsConfig) (result SiteLogsConfig, err error) { - req, err := client.UpdateSiteLogsConfigPreparer(resourceGroupName, name, siteLogsConfig) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.SitesClient", "UpdateSiteLogsConfig", nil, "Failure preparing request") - } - - resp, err := client.UpdateSiteLogsConfigSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.SitesClient", "UpdateSiteLogsConfig", resp, "Failure sending request") - } - - result, err = client.UpdateSiteLogsConfigResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.SitesClient", "UpdateSiteLogsConfig", resp, "Failure responding to request") - } - - return -} - -// UpdateSiteLogsConfigPreparer prepares the UpdateSiteLogsConfig request. -func (client SitesClient) UpdateSiteLogsConfigPreparer(resourceGroupName string, name string, siteLogsConfig SiteLogsConfig) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/logs", pathParameters), - autorest.WithJSON(siteLogsConfig), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// UpdateSiteLogsConfigSender sends the UpdateSiteLogsConfig request. The method will close the -// http.Response Body if it receives an error. -func (client SitesClient) UpdateSiteLogsConfigSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// UpdateSiteLogsConfigResponder handles the response to the UpdateSiteLogsConfig request. The method always -// closes the http.Response Body. -func (client SitesClient) UpdateSiteLogsConfigResponder(resp *http.Response) (result SiteLogsConfig, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// UpdateSiteLogsConfigSlot sends the update site logs config slot request. -// -// resourceGroupName is name of resource group name is name of web app -// siteLogsConfig is site logs configuration slot is name of web app slot. If -// not specified then will default to production slot. -func (client SitesClient) UpdateSiteLogsConfigSlot(resourceGroupName string, name string, siteLogsConfig SiteLogsConfig, slot string) (result SiteLogsConfig, err error) { - req, err := client.UpdateSiteLogsConfigSlotPreparer(resourceGroupName, name, siteLogsConfig, slot) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.SitesClient", "UpdateSiteLogsConfigSlot", nil, "Failure preparing request") - } - - resp, err := client.UpdateSiteLogsConfigSlotSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.SitesClient", "UpdateSiteLogsConfigSlot", resp, "Failure sending request") - } - - result, err = client.UpdateSiteLogsConfigSlotResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.SitesClient", "UpdateSiteLogsConfigSlot", resp, "Failure responding to request") - } - - return -} - -// UpdateSiteLogsConfigSlotPreparer prepares the UpdateSiteLogsConfigSlot request. -func (client SitesClient) UpdateSiteLogsConfigSlotPreparer(resourceGroupName string, name string, siteLogsConfig SiteLogsConfig, slot string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "slot": autorest.Encode("path", slot), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/logs", pathParameters), - autorest.WithJSON(siteLogsConfig), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// UpdateSiteLogsConfigSlotSender sends the UpdateSiteLogsConfigSlot request. The method will close the -// http.Response Body if it receives an error. -func (client SitesClient) UpdateSiteLogsConfigSlotSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// UpdateSiteLogsConfigSlotResponder handles the response to the UpdateSiteLogsConfigSlot request. The method always -// closes the http.Response Body. -func (client SitesClient) UpdateSiteLogsConfigSlotResponder(resp *http.Response) (result SiteLogsConfig, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// UpdateSiteMetadata sends the update site metadata request. -// -// resourceGroupName is name of resource group name is name of web app metadata -// is meta data of web app -func (client SitesClient) UpdateSiteMetadata(resourceGroupName string, name string, metadata StringDictionary) (result StringDictionary, err error) { - req, err := client.UpdateSiteMetadataPreparer(resourceGroupName, name, metadata) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.SitesClient", "UpdateSiteMetadata", nil, "Failure preparing request") - } - - resp, err := client.UpdateSiteMetadataSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.SitesClient", "UpdateSiteMetadata", resp, "Failure sending request") - } - - result, err = client.UpdateSiteMetadataResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.SitesClient", "UpdateSiteMetadata", resp, "Failure responding to request") - } - - return -} - -// UpdateSiteMetadataPreparer prepares the UpdateSiteMetadata request. -func (client SitesClient) UpdateSiteMetadataPreparer(resourceGroupName string, name string, metadata StringDictionary) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/metadata", pathParameters), - autorest.WithJSON(metadata), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// UpdateSiteMetadataSender sends the UpdateSiteMetadata request. The method will close the -// http.Response Body if it receives an error. -func (client SitesClient) UpdateSiteMetadataSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// UpdateSiteMetadataResponder handles the response to the UpdateSiteMetadata request. The method always -// closes the http.Response Body. -func (client SitesClient) UpdateSiteMetadataResponder(resp *http.Response) (result StringDictionary, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// UpdateSiteMetadataSlot sends the update site metadata slot request. -// -// resourceGroupName is name of resource group name is name of web app metadata -// is meta data of web app slot is name of web app slot. If not specified then -// will default to production slot. -func (client SitesClient) UpdateSiteMetadataSlot(resourceGroupName string, name string, metadata StringDictionary, slot string) (result StringDictionary, err error) { - req, err := client.UpdateSiteMetadataSlotPreparer(resourceGroupName, name, metadata, slot) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.SitesClient", "UpdateSiteMetadataSlot", nil, "Failure preparing request") - } - - resp, err := client.UpdateSiteMetadataSlotSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.SitesClient", "UpdateSiteMetadataSlot", resp, "Failure sending request") - } - - result, err = client.UpdateSiteMetadataSlotResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.SitesClient", "UpdateSiteMetadataSlot", resp, "Failure responding to request") - } - - return -} - -// UpdateSiteMetadataSlotPreparer prepares the UpdateSiteMetadataSlot request. -func (client SitesClient) UpdateSiteMetadataSlotPreparer(resourceGroupName string, name string, metadata StringDictionary, slot string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "slot": autorest.Encode("path", slot), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/metadata", pathParameters), - autorest.WithJSON(metadata), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// UpdateSiteMetadataSlotSender sends the UpdateSiteMetadataSlot request. The method will close the -// http.Response Body if it receives an error. -func (client SitesClient) UpdateSiteMetadataSlotSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// UpdateSiteMetadataSlotResponder handles the response to the UpdateSiteMetadataSlot request. The method always -// closes the http.Response Body. -func (client SitesClient) UpdateSiteMetadataSlotResponder(resp *http.Response) (result StringDictionary, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// UpdateSiteRelayServiceConnection sends the update site relay service -// connection request. -// -// resourceGroupName is the resource group name name is the name of the web app -// entityName is the name by which the Hybrid Connection is identified -// connectionEnvelope is the details of the Hybrid Connection -func (client SitesClient) UpdateSiteRelayServiceConnection(resourceGroupName string, name string, entityName string, connectionEnvelope RelayServiceConnectionEntity) (result RelayServiceConnectionEntity, err error) { - req, err := client.UpdateSiteRelayServiceConnectionPreparer(resourceGroupName, name, entityName, connectionEnvelope) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.SitesClient", "UpdateSiteRelayServiceConnection", nil, "Failure preparing request") - } - - resp, err := client.UpdateSiteRelayServiceConnectionSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.SitesClient", "UpdateSiteRelayServiceConnection", resp, "Failure sending request") - } - - result, err = client.UpdateSiteRelayServiceConnectionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.SitesClient", "UpdateSiteRelayServiceConnection", resp, "Failure responding to request") - } - - return -} - -// UpdateSiteRelayServiceConnectionPreparer prepares the UpdateSiteRelayServiceConnection request. -func (client SitesClient) UpdateSiteRelayServiceConnectionPreparer(resourceGroupName string, name string, entityName string, connectionEnvelope RelayServiceConnectionEntity) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "entityName": autorest.Encode("path", entityName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/hybridconnection/{entityName}", pathParameters), - autorest.WithJSON(connectionEnvelope), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// UpdateSiteRelayServiceConnectionSender sends the UpdateSiteRelayServiceConnection request. The method will close the -// http.Response Body if it receives an error. -func (client SitesClient) UpdateSiteRelayServiceConnectionSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// UpdateSiteRelayServiceConnectionResponder handles the response to the UpdateSiteRelayServiceConnection request. The method always -// closes the http.Response Body. -func (client SitesClient) UpdateSiteRelayServiceConnectionResponder(resp *http.Response) (result RelayServiceConnectionEntity, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// UpdateSiteRelayServiceConnectionSlot sends the update site relay service -// connection slot request. -// -// resourceGroupName is the resource group name name is the name of the web app -// entityName is the name by which the Hybrid Connection is identified -// connectionEnvelope is the details of the Hybrid Connection slot is the name -// of the slot for the web app. -func (client SitesClient) UpdateSiteRelayServiceConnectionSlot(resourceGroupName string, name string, entityName string, connectionEnvelope RelayServiceConnectionEntity, slot string) (result RelayServiceConnectionEntity, err error) { - req, err := client.UpdateSiteRelayServiceConnectionSlotPreparer(resourceGroupName, name, entityName, connectionEnvelope, slot) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.SitesClient", "UpdateSiteRelayServiceConnectionSlot", nil, "Failure preparing request") - } - - resp, err := client.UpdateSiteRelayServiceConnectionSlotSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.SitesClient", "UpdateSiteRelayServiceConnectionSlot", resp, "Failure sending request") - } - - result, err = client.UpdateSiteRelayServiceConnectionSlotResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.SitesClient", "UpdateSiteRelayServiceConnectionSlot", resp, "Failure responding to request") - } - - return -} - -// UpdateSiteRelayServiceConnectionSlotPreparer prepares the UpdateSiteRelayServiceConnectionSlot request. -func (client SitesClient) UpdateSiteRelayServiceConnectionSlotPreparer(resourceGroupName string, name string, entityName string, connectionEnvelope RelayServiceConnectionEntity, slot string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "entityName": autorest.Encode("path", entityName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "slot": autorest.Encode("path", slot), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/hybridconnection/{entityName}", pathParameters), - autorest.WithJSON(connectionEnvelope), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// UpdateSiteRelayServiceConnectionSlotSender sends the UpdateSiteRelayServiceConnectionSlot request. The method will close the -// http.Response Body if it receives an error. -func (client SitesClient) UpdateSiteRelayServiceConnectionSlotSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// UpdateSiteRelayServiceConnectionSlotResponder handles the response to the UpdateSiteRelayServiceConnectionSlot request. The method always -// closes the http.Response Body. -func (client SitesClient) UpdateSiteRelayServiceConnectionSlotResponder(resp *http.Response) (result RelayServiceConnectionEntity, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// UpdateSiteSourceControl sends the update site source control request. -// -// resourceGroupName is name of resource group name is name of web app -// siteSourceControl is request body that contains the source control -// parameters -func (client SitesClient) UpdateSiteSourceControl(resourceGroupName string, name string, siteSourceControl SiteSourceControl) (result SiteSourceControl, err error) { - req, err := client.UpdateSiteSourceControlPreparer(resourceGroupName, name, siteSourceControl) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.SitesClient", "UpdateSiteSourceControl", nil, "Failure preparing request") - } - - resp, err := client.UpdateSiteSourceControlSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.SitesClient", "UpdateSiteSourceControl", resp, "Failure sending request") - } - - result, err = client.UpdateSiteSourceControlResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.SitesClient", "UpdateSiteSourceControl", resp, "Failure responding to request") - } - - return -} - -// UpdateSiteSourceControlPreparer prepares the UpdateSiteSourceControl request. -func (client SitesClient) UpdateSiteSourceControlPreparer(resourceGroupName string, name string, siteSourceControl SiteSourceControl) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/sourcecontrols/web", pathParameters), - autorest.WithJSON(siteSourceControl), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// UpdateSiteSourceControlSender sends the UpdateSiteSourceControl request. The method will close the -// http.Response Body if it receives an error. -func (client SitesClient) UpdateSiteSourceControlSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// UpdateSiteSourceControlResponder handles the response to the UpdateSiteSourceControl request. The method always -// closes the http.Response Body. -func (client SitesClient) UpdateSiteSourceControlResponder(resp *http.Response) (result SiteSourceControl, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// UpdateSiteSourceControlSlot sends the update site source control slot -// request. -// -// resourceGroupName is name of resource group name is name of web app -// siteSourceControl is request body that contains the source control -// parameters slot is name of web app slot. If not specified then will default -// to production slot. -func (client SitesClient) UpdateSiteSourceControlSlot(resourceGroupName string, name string, siteSourceControl SiteSourceControl, slot string) (result SiteSourceControl, err error) { - req, err := client.UpdateSiteSourceControlSlotPreparer(resourceGroupName, name, siteSourceControl, slot) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.SitesClient", "UpdateSiteSourceControlSlot", nil, "Failure preparing request") - } - - resp, err := client.UpdateSiteSourceControlSlotSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.SitesClient", "UpdateSiteSourceControlSlot", resp, "Failure sending request") - } - - result, err = client.UpdateSiteSourceControlSlotResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.SitesClient", "UpdateSiteSourceControlSlot", resp, "Failure responding to request") - } - - return -} - -// UpdateSiteSourceControlSlotPreparer prepares the UpdateSiteSourceControlSlot request. -func (client SitesClient) UpdateSiteSourceControlSlotPreparer(resourceGroupName string, name string, siteSourceControl SiteSourceControl, slot string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "slot": autorest.Encode("path", slot), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/sourcecontrols/web", pathParameters), - autorest.WithJSON(siteSourceControl), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// UpdateSiteSourceControlSlotSender sends the UpdateSiteSourceControlSlot request. The method will close the -// http.Response Body if it receives an error. -func (client SitesClient) UpdateSiteSourceControlSlotSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// UpdateSiteSourceControlSlotResponder handles the response to the UpdateSiteSourceControlSlot request. The method always -// closes the http.Response Body. -func (client SitesClient) UpdateSiteSourceControlSlotResponder(resp *http.Response) (result SiteSourceControl, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// UpdateSiteVNETConnection sends the update site vnet connection request. -// -// resourceGroupName is the resource group name name is the name of the web app -// vnetName is the name of the Virtual Network connectionEnvelope is the -// properties of this Virtual Network Connection -func (client SitesClient) UpdateSiteVNETConnection(resourceGroupName string, name string, vnetName string, connectionEnvelope VnetInfo) (result VnetInfo, err error) { - req, err := client.UpdateSiteVNETConnectionPreparer(resourceGroupName, name, vnetName, connectionEnvelope) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.SitesClient", "UpdateSiteVNETConnection", nil, "Failure preparing request") - } - - resp, err := client.UpdateSiteVNETConnectionSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.SitesClient", "UpdateSiteVNETConnection", resp, "Failure sending request") - } - - result, err = client.UpdateSiteVNETConnectionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.SitesClient", "UpdateSiteVNETConnection", resp, "Failure responding to request") - } - - return -} - -// UpdateSiteVNETConnectionPreparer prepares the UpdateSiteVNETConnection request. -func (client SitesClient) UpdateSiteVNETConnectionPreparer(resourceGroupName string, name string, vnetName string, connectionEnvelope VnetInfo) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vnetName": autorest.Encode("path", vnetName), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/virtualNetworkConnections/{vnetName}", pathParameters), - autorest.WithJSON(connectionEnvelope), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// UpdateSiteVNETConnectionSender sends the UpdateSiteVNETConnection request. The method will close the -// http.Response Body if it receives an error. -func (client SitesClient) UpdateSiteVNETConnectionSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// UpdateSiteVNETConnectionResponder handles the response to the UpdateSiteVNETConnection request. The method always -// closes the http.Response Body. -func (client SitesClient) UpdateSiteVNETConnectionResponder(resp *http.Response) (result VnetInfo, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// UpdateSiteVNETConnectionGateway sends the update site vnet connection -// gateway request. -// -// resourceGroupName is the resource group name name is the name of the web app -// vnetName is the name of the Virtual Network gatewayName is the name of the -// gateway. The only gateway that exists presently is "primary" -// connectionEnvelope is the properties to update this gateway with. -func (client SitesClient) UpdateSiteVNETConnectionGateway(resourceGroupName string, name string, vnetName string, gatewayName string, connectionEnvelope VnetGateway) (result VnetGateway, err error) { - req, err := client.UpdateSiteVNETConnectionGatewayPreparer(resourceGroupName, name, vnetName, gatewayName, connectionEnvelope) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.SitesClient", "UpdateSiteVNETConnectionGateway", nil, "Failure preparing request") - } - - resp, err := client.UpdateSiteVNETConnectionGatewaySender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.SitesClient", "UpdateSiteVNETConnectionGateway", resp, "Failure sending request") - } - - result, err = client.UpdateSiteVNETConnectionGatewayResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.SitesClient", "UpdateSiteVNETConnectionGateway", resp, "Failure responding to request") - } - - return -} - -// UpdateSiteVNETConnectionGatewayPreparer prepares the UpdateSiteVNETConnectionGateway request. -func (client SitesClient) UpdateSiteVNETConnectionGatewayPreparer(resourceGroupName string, name string, vnetName string, gatewayName string, connectionEnvelope VnetGateway) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "gatewayName": autorest.Encode("path", gatewayName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vnetName": autorest.Encode("path", vnetName), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/virtualNetworkConnections/{vnetName}/gateways/{gatewayName}", pathParameters), - autorest.WithJSON(connectionEnvelope), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// UpdateSiteVNETConnectionGatewaySender sends the UpdateSiteVNETConnectionGateway request. The method will close the -// http.Response Body if it receives an error. -func (client SitesClient) UpdateSiteVNETConnectionGatewaySender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// UpdateSiteVNETConnectionGatewayResponder handles the response to the UpdateSiteVNETConnectionGateway request. The method always -// closes the http.Response Body. -func (client SitesClient) UpdateSiteVNETConnectionGatewayResponder(resp *http.Response) (result VnetGateway, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// UpdateSiteVNETConnectionGatewaySlot sends the update site vnet connection -// gateway slot request. -// -// resourceGroupName is the resource group name name is the name of the web app -// vnetName is the name of the Virtual Network gatewayName is the name of the -// gateway. The only gateway that exists presently is "primary" -// connectionEnvelope is the properties to update this gateway with. slot is -// the name of the slot for this web app. -func (client SitesClient) UpdateSiteVNETConnectionGatewaySlot(resourceGroupName string, name string, vnetName string, gatewayName string, connectionEnvelope VnetGateway, slot string) (result VnetGateway, err error) { - req, err := client.UpdateSiteVNETConnectionGatewaySlotPreparer(resourceGroupName, name, vnetName, gatewayName, connectionEnvelope, slot) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.SitesClient", "UpdateSiteVNETConnectionGatewaySlot", nil, "Failure preparing request") - } - - resp, err := client.UpdateSiteVNETConnectionGatewaySlotSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.SitesClient", "UpdateSiteVNETConnectionGatewaySlot", resp, "Failure sending request") - } - - result, err = client.UpdateSiteVNETConnectionGatewaySlotResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.SitesClient", "UpdateSiteVNETConnectionGatewaySlot", resp, "Failure responding to request") - } - - return -} - -// UpdateSiteVNETConnectionGatewaySlotPreparer prepares the UpdateSiteVNETConnectionGatewaySlot request. -func (client SitesClient) UpdateSiteVNETConnectionGatewaySlotPreparer(resourceGroupName string, name string, vnetName string, gatewayName string, connectionEnvelope VnetGateway, slot string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "gatewayName": autorest.Encode("path", gatewayName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "slot": autorest.Encode("path", slot), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vnetName": autorest.Encode("path", vnetName), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/virtualNetworkConnections/{vnetName}/gateways/{gatewayName}", pathParameters), - autorest.WithJSON(connectionEnvelope), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// UpdateSiteVNETConnectionGatewaySlotSender sends the UpdateSiteVNETConnectionGatewaySlot request. The method will close the -// http.Response Body if it receives an error. -func (client SitesClient) UpdateSiteVNETConnectionGatewaySlotSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// UpdateSiteVNETConnectionGatewaySlotResponder handles the response to the UpdateSiteVNETConnectionGatewaySlot request. The method always -// closes the http.Response Body. -func (client SitesClient) UpdateSiteVNETConnectionGatewaySlotResponder(resp *http.Response) (result VnetGateway, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// UpdateSiteVNETConnectionSlot sends the update site vnet connection slot -// request. -// -// resourceGroupName is the resource group name name is the name of the web app -// vnetName is the name of the Virtual Network connectionEnvelope is the -// properties of this Virtual Network Connection slot is the name of the slot -// for this web app. -func (client SitesClient) UpdateSiteVNETConnectionSlot(resourceGroupName string, name string, vnetName string, connectionEnvelope VnetInfo, slot string) (result VnetInfo, err error) { - req, err := client.UpdateSiteVNETConnectionSlotPreparer(resourceGroupName, name, vnetName, connectionEnvelope, slot) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.SitesClient", "UpdateSiteVNETConnectionSlot", nil, "Failure preparing request") - } - - resp, err := client.UpdateSiteVNETConnectionSlotSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.SitesClient", "UpdateSiteVNETConnectionSlot", resp, "Failure sending request") - } - - result, err = client.UpdateSiteVNETConnectionSlotResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.SitesClient", "UpdateSiteVNETConnectionSlot", resp, "Failure responding to request") - } - - return -} - -// UpdateSiteVNETConnectionSlotPreparer prepares the UpdateSiteVNETConnectionSlot request. -func (client SitesClient) UpdateSiteVNETConnectionSlotPreparer(resourceGroupName string, name string, vnetName string, connectionEnvelope VnetInfo, slot string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "slot": autorest.Encode("path", slot), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vnetName": autorest.Encode("path", vnetName), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/virtualNetworkConnections/{vnetName}", pathParameters), - autorest.WithJSON(connectionEnvelope), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// UpdateSiteVNETConnectionSlotSender sends the UpdateSiteVNETConnectionSlot request. The method will close the -// http.Response Body if it receives an error. -func (client SitesClient) UpdateSiteVNETConnectionSlotSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// UpdateSiteVNETConnectionSlotResponder handles the response to the UpdateSiteVNETConnectionSlot request. The method always -// closes the http.Response Body. -func (client SitesClient) UpdateSiteVNETConnectionSlotResponder(resp *http.Response) (result VnetInfo, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// UpdateSlotConfigNames sends the update slot config names request. -// -// resourceGroupName is name of resource group name is name of web app -// slotConfigNames is request body containing the names of application settings -// and connection strings -func (client SitesClient) UpdateSlotConfigNames(resourceGroupName string, name string, slotConfigNames SlotConfigNamesResource) (result SlotConfigNamesResource, err error) { - req, err := client.UpdateSlotConfigNamesPreparer(resourceGroupName, name, slotConfigNames) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.SitesClient", "UpdateSlotConfigNames", nil, "Failure preparing request") - } - - resp, err := client.UpdateSlotConfigNamesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.SitesClient", "UpdateSlotConfigNames", resp, "Failure sending request") - } - - result, err = client.UpdateSlotConfigNamesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.SitesClient", "UpdateSlotConfigNames", resp, "Failure responding to request") - } - - return -} - -// UpdateSlotConfigNamesPreparer prepares the UpdateSlotConfigNames request. -func (client SitesClient) UpdateSlotConfigNamesPreparer(resourceGroupName string, name string, slotConfigNames SlotConfigNamesResource) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/slotConfigNames", pathParameters), - autorest.WithJSON(slotConfigNames), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// UpdateSlotConfigNamesSender sends the UpdateSlotConfigNames request. The method will close the -// http.Response Body if it receives an error. -func (client SitesClient) UpdateSlotConfigNamesSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// UpdateSlotConfigNamesResponder handles the response to the UpdateSlotConfigNames request. The method always -// closes the http.Response Body. -func (client SitesClient) UpdateSlotConfigNamesResponder(resp *http.Response) (result SlotConfigNamesResource, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/arm/web/topleveldomains.go b/arm/web/topleveldomains.go old mode 100644 new mode 100755 index 812b119a86b7..61ad857bf9f8 --- a/arm/web/topleveldomains.go +++ b/arm/web/topleveldomains.go @@ -24,13 +24,7 @@ import ( "net/http" ) -// TopLevelDomainsClient is the use these APIs to manage Azure Websites -// resources through the Azure Resource Manager. All task operations conform to -// the HTTP/1.1 protocol specification and each operation returns an -// x-ms-request-id header that can be used to obtain information about the -// request. You must make sure that requests made to these resources are -// secure. For more information, see -// https://msdn.microsoft.com/en-us/library/azure/dn790557.aspx. +// TopLevelDomainsClient is the composite Swagger for WebSite Management Client type TopLevelDomainsClient struct { ManagementClient } @@ -47,54 +41,58 @@ func NewTopLevelDomainsClientWithBaseURI(baseURI string, subscriptionID string) return TopLevelDomainsClient{NewWithBaseURI(baseURI, subscriptionID)} } -// GetGetTopLevelDomains sends the get get top level domains request. -func (client TopLevelDomainsClient) GetGetTopLevelDomains() (result TopLevelDomainCollection, err error) { - req, err := client.GetGetTopLevelDomainsPreparer() +// Get get details of a top-level domain. +// +// name is name of the top-level domain. +func (client TopLevelDomainsClient) Get(name string) (result TopLevelDomain, err error) { + req, err := client.GetPreparer(name) if err != nil { - return result, autorest.NewErrorWithError(err, "web.TopLevelDomainsClient", "GetGetTopLevelDomains", nil, "Failure preparing request") + return result, autorest.NewErrorWithError(err, "web.TopLevelDomainsClient", "Get", nil, "Failure preparing request") } - resp, err := client.GetGetTopLevelDomainsSender(req) + resp, err := client.GetSender(req) if err != nil { result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.TopLevelDomainsClient", "GetGetTopLevelDomains", resp, "Failure sending request") + return result, autorest.NewErrorWithError(err, "web.TopLevelDomainsClient", "Get", resp, "Failure sending request") } - result, err = client.GetGetTopLevelDomainsResponder(resp) + result, err = client.GetResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "web.TopLevelDomainsClient", "GetGetTopLevelDomains", resp, "Failure responding to request") + err = autorest.NewErrorWithError(err, "web.TopLevelDomainsClient", "Get", resp, "Failure responding to request") } return } -// GetGetTopLevelDomainsPreparer prepares the GetGetTopLevelDomains request. -func (client TopLevelDomainsClient) GetGetTopLevelDomainsPreparer() (*http.Request, error) { +// GetPreparer prepares the Get request. +func (client TopLevelDomainsClient) GetPreparer(name string) (*http.Request, error) { pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2015-04-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.DomainRegistration/topLevelDomains", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.DomainRegistration/topLevelDomains/{name}", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare(&http.Request{}) } -// GetGetTopLevelDomainsSender sends the GetGetTopLevelDomains request. The method will close the +// GetSender sends the Get request. The method will close the // http.Response Body if it receives an error. -func (client TopLevelDomainsClient) GetGetTopLevelDomainsSender(req *http.Request) (*http.Response, error) { +func (client TopLevelDomainsClient) GetSender(req *http.Request) (*http.Response, error) { return autorest.SendWithSender(client, req) } -// GetGetTopLevelDomainsResponder handles the response to the GetGetTopLevelDomains request. The method always +// GetResponder handles the response to the Get request. The method always // closes the http.Response Body. -func (client TopLevelDomainsClient) GetGetTopLevelDomainsResponder(resp *http.Response) (result TopLevelDomainCollection, err error) { +func (client TopLevelDomainsClient) GetResponder(resp *http.Response) (result TopLevelDomain, err error) { err = autorest.Respond( resp, client.ByInspecting(), @@ -105,81 +103,55 @@ func (client TopLevelDomainsClient) GetGetTopLevelDomainsResponder(resp *http.Re return } -// GetGetTopLevelDomainsNextResults retrieves the next set of results, if any. -func (client TopLevelDomainsClient) GetGetTopLevelDomainsNextResults(lastResults TopLevelDomainCollection) (result TopLevelDomainCollection, err error) { - req, err := lastResults.TopLevelDomainCollectionPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "web.TopLevelDomainsClient", "GetGetTopLevelDomains", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.GetGetTopLevelDomainsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.TopLevelDomainsClient", "GetGetTopLevelDomains", resp, "Failure sending next results request") - } - - result, err = client.GetGetTopLevelDomainsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.TopLevelDomainsClient", "GetGetTopLevelDomains", resp, "Failure responding to next results request") - } - - return -} - -// GetTopLevelDomain sends the get top level domain request. -// -// name is name of the top level domain -func (client TopLevelDomainsClient) GetTopLevelDomain(name string) (result TopLevelDomain, err error) { - req, err := client.GetTopLevelDomainPreparer(name) +// List get all top-level domains supported for registration. +func (client TopLevelDomainsClient) List() (result TopLevelDomainCollection, err error) { + req, err := client.ListPreparer() if err != nil { - return result, autorest.NewErrorWithError(err, "web.TopLevelDomainsClient", "GetTopLevelDomain", nil, "Failure preparing request") + return result, autorest.NewErrorWithError(err, "web.TopLevelDomainsClient", "List", nil, "Failure preparing request") } - resp, err := client.GetTopLevelDomainSender(req) + resp, err := client.ListSender(req) if err != nil { result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.TopLevelDomainsClient", "GetTopLevelDomain", resp, "Failure sending request") + return result, autorest.NewErrorWithError(err, "web.TopLevelDomainsClient", "List", resp, "Failure sending request") } - result, err = client.GetTopLevelDomainResponder(resp) + result, err = client.ListResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "web.TopLevelDomainsClient", "GetTopLevelDomain", resp, "Failure responding to request") + err = autorest.NewErrorWithError(err, "web.TopLevelDomainsClient", "List", resp, "Failure responding to request") } return } -// GetTopLevelDomainPreparer prepares the GetTopLevelDomain request. -func (client TopLevelDomainsClient) GetTopLevelDomainPreparer(name string) (*http.Request, error) { +// ListPreparer prepares the List request. +func (client TopLevelDomainsClient) ListPreparer() (*http.Request, error) { pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2015-04-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.DomainRegistration/topLevelDomains/{name}", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.DomainRegistration/topLevelDomains", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare(&http.Request{}) } -// GetTopLevelDomainSender sends the GetTopLevelDomain request. The method will close the +// ListSender sends the List request. The method will close the // http.Response Body if it receives an error. -func (client TopLevelDomainsClient) GetTopLevelDomainSender(req *http.Request) (*http.Response, error) { +func (client TopLevelDomainsClient) ListSender(req *http.Request) (*http.Response, error) { return autorest.SendWithSender(client, req) } -// GetTopLevelDomainResponder handles the response to the GetTopLevelDomain request. The method always +// ListResponder handles the response to the List request. The method always // closes the http.Response Body. -func (client TopLevelDomainsClient) GetTopLevelDomainResponder(resp *http.Response) (result TopLevelDomain, err error) { +func (client TopLevelDomainsClient) ListResponder(resp *http.Response) (result TopLevelDomainCollection, err error) { err = autorest.Respond( resp, client.ByInspecting(), @@ -190,40 +162,65 @@ func (client TopLevelDomainsClient) GetTopLevelDomainResponder(resp *http.Respon return } -// ListTopLevelDomainAgreements sends the list top level domain agreements -// request. +// ListNextResults retrieves the next set of results, if any. +func (client TopLevelDomainsClient) ListNextResults(lastResults TopLevelDomainCollection) (result TopLevelDomainCollection, err error) { + req, err := lastResults.TopLevelDomainCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "web.TopLevelDomainsClient", "List", 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, "web.TopLevelDomainsClient", "List", resp, "Failure sending next results request") + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.TopLevelDomainsClient", "List", resp, "Failure responding to next results request") + } + + return +} + +// ListAgreements gets all legal agreements that user needs to accept before +// purchasing a domain. // -// name is name of the top level domain agreementOption is domain agreement -// options -func (client TopLevelDomainsClient) ListTopLevelDomainAgreements(name string, agreementOption TopLevelDomainAgreementOption) (result TldLegalAgreementCollection, err error) { - req, err := client.ListTopLevelDomainAgreementsPreparer(name, agreementOption) +// name is name of the top-level domain. agreementOption is domain agreement +// options. +func (client TopLevelDomainsClient) ListAgreements(name string, agreementOption TopLevelDomainAgreementOption) (result TldLegalAgreementCollection, err error) { + req, err := client.ListAgreementsPreparer(name, agreementOption) if err != nil { - return result, autorest.NewErrorWithError(err, "web.TopLevelDomainsClient", "ListTopLevelDomainAgreements", nil, "Failure preparing request") + return result, autorest.NewErrorWithError(err, "web.TopLevelDomainsClient", "ListAgreements", nil, "Failure preparing request") } - resp, err := client.ListTopLevelDomainAgreementsSender(req) + resp, err := client.ListAgreementsSender(req) if err != nil { result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.TopLevelDomainsClient", "ListTopLevelDomainAgreements", resp, "Failure sending request") + return result, autorest.NewErrorWithError(err, "web.TopLevelDomainsClient", "ListAgreements", resp, "Failure sending request") } - result, err = client.ListTopLevelDomainAgreementsResponder(resp) + result, err = client.ListAgreementsResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "web.TopLevelDomainsClient", "ListTopLevelDomainAgreements", resp, "Failure responding to request") + err = autorest.NewErrorWithError(err, "web.TopLevelDomainsClient", "ListAgreements", resp, "Failure responding to request") } return } -// ListTopLevelDomainAgreementsPreparer prepares the ListTopLevelDomainAgreements request. -func (client TopLevelDomainsClient) ListTopLevelDomainAgreementsPreparer(name string, agreementOption TopLevelDomainAgreementOption) (*http.Request, error) { +// ListAgreementsPreparer prepares the ListAgreements request. +func (client TopLevelDomainsClient) ListAgreementsPreparer(name string, agreementOption TopLevelDomainAgreementOption) (*http.Request, error) { pathParameters := map[string]interface{}{ "name": autorest.Encode("path", name), "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2015-04-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, } preparer := autorest.CreatePreparer( @@ -236,15 +233,15 @@ func (client TopLevelDomainsClient) ListTopLevelDomainAgreementsPreparer(name st return preparer.Prepare(&http.Request{}) } -// ListTopLevelDomainAgreementsSender sends the ListTopLevelDomainAgreements request. The method will close the +// ListAgreementsSender sends the ListAgreements request. The method will close the // http.Response Body if it receives an error. -func (client TopLevelDomainsClient) ListTopLevelDomainAgreementsSender(req *http.Request) (*http.Response, error) { +func (client TopLevelDomainsClient) ListAgreementsSender(req *http.Request) (*http.Response, error) { return autorest.SendWithSender(client, req) } -// ListTopLevelDomainAgreementsResponder handles the response to the ListTopLevelDomainAgreements request. The method always +// ListAgreementsResponder handles the response to the ListAgreements request. The method always // closes the http.Response Body. -func (client TopLevelDomainsClient) ListTopLevelDomainAgreementsResponder(resp *http.Response) (result TldLegalAgreementCollection, err error) { +func (client TopLevelDomainsClient) ListAgreementsResponder(resp *http.Response) (result TldLegalAgreementCollection, err error) { err = autorest.Respond( resp, client.ByInspecting(), @@ -255,25 +252,25 @@ func (client TopLevelDomainsClient) ListTopLevelDomainAgreementsResponder(resp * return } -// ListTopLevelDomainAgreementsNextResults retrieves the next set of results, if any. -func (client TopLevelDomainsClient) ListTopLevelDomainAgreementsNextResults(lastResults TldLegalAgreementCollection) (result TldLegalAgreementCollection, err error) { +// ListAgreementsNextResults retrieves the next set of results, if any. +func (client TopLevelDomainsClient) ListAgreementsNextResults(lastResults TldLegalAgreementCollection) (result TldLegalAgreementCollection, err error) { req, err := lastResults.TldLegalAgreementCollectionPreparer() if err != nil { - return result, autorest.NewErrorWithError(err, "web.TopLevelDomainsClient", "ListTopLevelDomainAgreements", nil, "Failure preparing next results request") + return result, autorest.NewErrorWithError(err, "web.TopLevelDomainsClient", "ListAgreements", nil, "Failure preparing next results request") } if req == nil { return } - resp, err := client.ListTopLevelDomainAgreementsSender(req) + resp, err := client.ListAgreementsSender(req) if err != nil { result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.TopLevelDomainsClient", "ListTopLevelDomainAgreements", resp, "Failure sending next results request") + return result, autorest.NewErrorWithError(err, "web.TopLevelDomainsClient", "ListAgreements", resp, "Failure sending next results request") } - result, err = client.ListTopLevelDomainAgreementsResponder(resp) + result, err = client.ListAgreementsResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "web.TopLevelDomainsClient", "ListTopLevelDomainAgreements", resp, "Failure responding to next results request") + err = autorest.NewErrorWithError(err, "web.TopLevelDomainsClient", "ListAgreements", resp, "Failure responding to next results request") } return diff --git a/arm/web/usage.go b/arm/web/usage.go deleted file mode 100644 index 12d97c87a945..000000000000 --- a/arm/web/usage.go +++ /dev/null @@ -1,111 +0,0 @@ -package web - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// -// See the License for the specific language governing permissions and -// limitations under the License. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// 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/azure" - "net/http" -) - -// UsageClient is the use these APIs to manage Azure Websites resources through -// the Azure Resource Manager. All task operations conform to the HTTP/1.1 -// protocol specification and each operation returns an x-ms-request-id header -// that can be used to obtain information about the request. You must make sure -// that requests made to these resources are secure. For more information, see -// https://msdn.microsoft.com/en-us/library/azure/dn790557.aspx. -type UsageClient struct { - ManagementClient -} - -// NewUsageClient creates an instance of the UsageClient client. -func NewUsageClient(subscriptionID string) UsageClient { - return NewUsageClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewUsageClientWithBaseURI creates an instance of the UsageClient client. -func NewUsageClientWithBaseURI(baseURI string, subscriptionID string) UsageClient { - return UsageClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// GetUsage sends the get usage request. -// -// resourceGroupName is name of resource group environmentName is environment -// name lastID is last marker that was returned from the batch batchSize is -// size of the batch to be returned. -func (client UsageClient) GetUsage(resourceGroupName string, environmentName string, lastID string, batchSize int32) (result SetObject, err error) { - req, err := client.GetUsagePreparer(resourceGroupName, environmentName, lastID, batchSize) - if err != nil { - return result, autorest.NewErrorWithError(err, "web.UsageClient", "GetUsage", nil, "Failure preparing request") - } - - resp, err := client.GetUsageSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.UsageClient", "GetUsage", resp, "Failure sending request") - } - - result, err = client.GetUsageResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.UsageClient", "GetUsage", resp, "Failure responding to request") - } - - return -} - -// GetUsagePreparer prepares the GetUsage request. -func (client UsageClient) GetUsagePreparer(resourceGroupName string, environmentName string, lastID string, batchSize int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "environmentName": autorest.Encode("path", environmentName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - "batchSize": autorest.Encode("query", batchSize), - "lastId": autorest.Encode("query", lastID), - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web.Admin/environments/{environmentName}/usage", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetUsageSender sends the GetUsage request. The method will close the -// http.Response Body if it receives an error. -func (client UsageClient) GetUsageSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetUsageResponder handles the response to the GetUsage request. The method always -// closes the http.Response Body. -func (client UsageClient) GetUsageResponder(resp *http.Response) (result SetObject, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Value), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/arm/web/version.go b/arm/web/version.go old mode 100644 new mode 100755 index 003a1f9fca7c..1bceae82374e --- a/arm/web/version.go +++ b/arm/web/version.go @@ -18,43 +18,12 @@ package web // Changes may cause incorrect behavior and will be lost if the code is // regenerated. -import ( - "bytes" - "fmt" - "strings" -) - -const ( - major = "8" - minor = "1" - patch = "0" - tag = "beta" - userAgentFormat = "Azure-SDK-For-Go/%s arm-%s/%s" -) - -// cached results of UserAgent and Version to prevent repeated operations. -var ( - userAgent string - version string -) - // UserAgent returns the UserAgent string to use when sending http.Requests. func UserAgent() string { - if userAgent == "" { - userAgent = fmt.Sprintf(userAgentFormat, Version(), "web", "2015-08-01") - } - return userAgent + return "Azure-SDK-For-Go/v9.0.0-beta arm-web/" } // Version returns the semantic version (see http://semver.org) of the client. func Version() string { - if version == "" { - versionBuilder := bytes.NewBufferString(fmt.Sprintf("%s.%s.%s", major, minor, patch)) - if tag != "" { - versionBuilder.WriteRune('-') - versionBuilder.WriteString(strings.TrimPrefix(tag, "-")) - } - version = string(versionBuilder.Bytes()) - } - return version + return "v9.0.0-beta" } diff --git a/datalake-store/filesystem/client.go b/datalake-store/filesystem/client.go old mode 100644 new mode 100755 index 90744e0b92c7..4648982f088b --- a/datalake-store/filesystem/client.go +++ b/datalake-store/filesystem/client.go @@ -18,7 +18,7 @@ package filesystem // See the License for the specific language governing permissions and // limitations under the License. // -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.0 +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 // Changes may cause incorrect behavior and will be lost if the code is // regenerated. @@ -27,32 +27,25 @@ import ( ) const ( - // APIVersion is the version of the Filesystem - APIVersion = "2016-11-01" - - // DefaultBaseURI is the default URI used for the service Filesystem - DefaultBaseURI = "https://localhost" + // DefaultAdlsFileSystemDNSSuffix is the default value for adls file system dns suffix + DefaultAdlsFileSystemDNSSuffix = "azuredatalakestore.net" ) // ManagementClient is the base client for Filesystem. type ManagementClient struct { autorest.Client - BaseURI string - APIVersion string AdlsFileSystemDNSSuffix string } // New creates an instance of the ManagementClient client. -func New(adlsFileSystemDNSSuffix string) ManagementClient { - return NewWithBaseURI(DefaultBaseURI, adlsFileSystemDNSSuffix) +func New() ManagementClient { + return NewWithoutDefaults(DefaultAdlsFileSystemDNSSuffix) } -// NewWithBaseURI creates an instance of the ManagementClient client. -func NewWithBaseURI(baseURI string, adlsFileSystemDNSSuffix string) ManagementClient { +// NewWithoutDefaults creates an instance of the ManagementClient client. +func NewWithoutDefaults(adlsFileSystemDNSSuffix string) ManagementClient { return ManagementClient{ Client: autorest.NewClientWithUserAgent(UserAgent()), - BaseURI: baseURI, - APIVersion: APIVersion, AdlsFileSystemDNSSuffix: adlsFileSystemDNSSuffix, } } diff --git a/datalake-store/filesystem/filesystemgroup.go b/datalake-store/filesystem/filesystemgroup.go old mode 100644 new mode 100755 index 8a1bf6413c87..36bd7d36991e --- a/datalake-store/filesystem/filesystemgroup.go +++ b/datalake-store/filesystem/filesystemgroup.go @@ -14,7 +14,7 @@ package filesystem // See the License for the specific language governing permissions and // limitations under the License. // -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.0 +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 // Changes may cause incorrect behavior and will be lost if the code is // regenerated. @@ -22,6 +22,7 @@ import ( "github.com/Azure/go-autorest/autorest" "github.com/Azure/go-autorest/autorest/azure" "github.com/Azure/go-autorest/autorest/validation" + "github.com/satori/uuid" "io" "net/http" ) @@ -32,34 +33,39 @@ type GroupClient struct { } // NewGroupClient creates an instance of the GroupClient client. -func NewGroupClient(adlsFileSystemDNSSuffix string) GroupClient { - return NewGroupClientWithBaseURI(DefaultBaseURI, adlsFileSystemDNSSuffix) +func NewGroupClient() GroupClient { + return GroupClient{New()} } -// NewGroupClientWithBaseURI creates an instance of the GroupClient client. -func NewGroupClientWithBaseURI(baseURI string, adlsFileSystemDNSSuffix string) GroupClient { - return GroupClient{NewWithBaseURI(baseURI, adlsFileSystemDNSSuffix)} -} - -// Append appends to the specified file. NOTE: The target must not contain data -// added by ConcurrentAppend. ConcurrentAppend and Append cannot be used -// interchangeably; once a target file has been modified using either of these -// append options, the other append option cannot be used on the target file. +// Append used for serial appends to the specified file. NOTE: The target must +// not contain data added by ConcurrentAppend. ConcurrentAppend and Append +// cannot be used interchangeably; once a target file has been modified using +// either of these append options, the other append option cannot be used on +// the target file. // -// directFilePath is the Data Lake Store path (starting with '/') of the file -// to which to append. streamContents is the file contents to include when -// appending to the file. streamContents will be closed upon successful return. -// Callers should ensure closure when receiving an error.op is the constant -// value for the operation. appendParameter is the constant value for the -// operation. offset is the optional offset in the stream to begin the append -// operation. Default is to append at the end of the stream. syncFlag is -// optionally indicates what to do after completion of the append. DATA -// indicates more data is coming so no sync takes place, METADATA indicates a -// sync should be done to refresh metadata of the file only. CLOSE indicates -// that both the stream and metadata should be refreshed upon append -// completion. -func (client GroupClient) Append(directFilePath string, streamContents io.ReadCloser, op string, appendParameter string, offset *int64, syncFlag SyncFlag) (result autorest.Response, err error) { - req, err := client.AppendPreparer(directFilePath, streamContents, op, appendParameter, offset, syncFlag) +// accountName is the Azure Data Lake Store account to execute filesystem +// operations on. directFilePath is the Data Lake Store path (starting with +// '/') of the file to which to append. streamContents is the file contents to +// include when appending to the file. streamContents will be closed upon +// successful return. Callers should ensure closure when receiving an error.op +// is the constant value for the operation. appendParameter is flag to skip +// redirection. When append=false or not specified, the request is redirected. +// Submit another HTTP PUT request using the URL in the Location header with +// the file data to be written. When append=true, this redirection is skipped. +// offset is the optional offset in the stream to begin the append operation. +// Default is to append at the end of the stream. syncFlag is optionally +// indicates what to do after completion of the append. DATA indicates more +// data is coming so no sync takes place, METADATA indicates a sync should be +// done to refresh metadata of the file only. CLOSE indicates that both the +// stream and metadata should be refreshed upon append completion. leaseID is +// optional unique GUID per file to ensure single writer semantics, meaning +// that only clients that append to the file with the same leaseId will be +// allowed to do so. fileSessionID is optional unique GUID per file indicating +// all the appends with the same fileSessionId are from the same client and +// same session. This will give a performance benefit when syncFlag is DATA or +// METADATA. +func (client GroupClient) Append(accountName string, directFilePath string, streamContents io.ReadCloser, op string, appendParameter string, offset *int64, syncFlag SyncFlag, leaseID *uuid.UUID, fileSessionID *uuid.UUID) (result autorest.Response, err error) { + req, err := client.AppendPreparer(accountName, directFilePath, streamContents, op, appendParameter, offset, syncFlag, leaseID, fileSessionID) if err != nil { return result, autorest.NewErrorWithError(err, "filesystem.GroupClient", "Append", nil, "Failure preparing request") } @@ -79,13 +85,19 @@ func (client GroupClient) Append(directFilePath string, streamContents io.ReadCl } // AppendPreparer prepares the Append request. -func (client GroupClient) AppendPreparer(directFilePath string, streamContents io.ReadCloser, op string, appendParameter string, offset *int64, syncFlag SyncFlag) (*http.Request, error) { +func (client GroupClient) AppendPreparer(accountName string, directFilePath string, streamContents io.ReadCloser, op string, appendParameter string, offset *int64, syncFlag SyncFlag, leaseID *uuid.UUID, fileSessionID *uuid.UUID) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "accountName": accountName, + "adlsFileSystemDnsSuffix": client.AdlsFileSystemDNSSuffix, + } + pathParameters := map[string]interface{}{ "directFilePath": autorest.Encode("path", directFilePath), } + const APIVersion = "2016-11-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, "append": autorest.Encode("query", appendParameter), "op": autorest.Encode("query", op), } @@ -95,10 +107,16 @@ func (client GroupClient) AppendPreparer(directFilePath string, streamContents i if len(string(syncFlag)) > 0 { queryParameters["syncFlag"] = autorest.Encode("query", syncFlag) } + if leaseID != nil { + queryParameters["leaseId"] = autorest.Encode("query", *leaseID) + } + if fileSessionID != nil { + queryParameters["fileSessionId"] = autorest.Encode("query", *fileSessionID) + } preparer := autorest.CreatePreparer( autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), + autorest.WithCustomBaseURL("https://{accountName}.{adlsFileSystemDnsSuffix}", urlParameters), autorest.WithPathParameters("/webhdfs/v1/{directFilePath}", pathParameters), autorest.WithFile(streamContents), autorest.WithQueryParameters(queryParameters)) @@ -125,12 +143,13 @@ func (client GroupClient) AppendResponder(resp *http.Response) (result autorest. // CheckAccess checks if the specified access is available at the given path. // -// pathParameter is the Data Lake Store path (starting with '/') of the file or -// directory for which to check access. op is the constant value for the -// operation. fsaction is file system operation read/write/execute in string -// form, matching regex pattern '[rwx-]{3}' -func (client GroupClient) CheckAccess(pathParameter string, op string, fsaction string) (result autorest.Response, err error) { - req, err := client.CheckAccessPreparer(pathParameter, op, fsaction) +// accountName is the Azure Data Lake Store account to execute filesystem +// operations on. pathParameter is the Data Lake Store path (starting with '/') +// of the file or directory for which to check access. fsaction is file system +// operation read/write/execute in string form, matching regex pattern +// '[rwx-]{3}' op is the constant value for the operation. +func (client GroupClient) CheckAccess(accountName string, pathParameter string, fsaction string, op string) (result autorest.Response, err error) { + req, err := client.CheckAccessPreparer(accountName, pathParameter, fsaction, op) if err != nil { return result, autorest.NewErrorWithError(err, "filesystem.GroupClient", "CheckAccess", nil, "Failure preparing request") } @@ -150,22 +169,26 @@ func (client GroupClient) CheckAccess(pathParameter string, op string, fsaction } // CheckAccessPreparer prepares the CheckAccess request. -func (client GroupClient) CheckAccessPreparer(pathParameter string, op string, fsaction string) (*http.Request, error) { +func (client GroupClient) CheckAccessPreparer(accountName string, pathParameter string, fsaction string, op string) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "accountName": accountName, + "adlsFileSystemDnsSuffix": client.AdlsFileSystemDNSSuffix, + } + pathParameters := map[string]interface{}{ "path": autorest.Encode("path", pathParameter), } + const APIVersion = "2016-11-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, + "fsaction": autorest.Encode("query", fsaction), "op": autorest.Encode("query", op), } - if len(fsaction) > 0 { - queryParameters["fsaction"] = autorest.Encode("query", fsaction) - } preparer := autorest.CreatePreparer( autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), + autorest.WithCustomBaseURL("https://{accountName}.{adlsFileSystemDnsSuffix}", urlParameters), autorest.WithPathParameters("/webhdfs/v1/{path}", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare(&http.Request{}) @@ -192,19 +215,20 @@ func (client GroupClient) CheckAccessResponder(resp *http.Response) (result auto // Concat concatenates the list of source files into the destination file, // removing all source files upon success. // -// destinationPath is the Data Lake Store path (starting with '/') of the -// destination file resulting from the concatenation. sources is a list of -// comma seperated Data Lake Store paths (starting with '/') of the files to -// concatenate, in the order in which they should be concatenated. op is the -// constant value for the operation. -func (client GroupClient) Concat(destinationPath string, sources []string, op string) (result autorest.Response, err error) { +// accountName is the Azure Data Lake Store account to execute filesystem +// operations on. destinationPath is the Data Lake Store path (starting with +// '/') of the destination file resulting from the concatenation. sources is a +// list of comma separated Data Lake Store paths (starting with '/') of the +// files to concatenate, in the order in which they should be concatenated. op +// is the constant value for the operation. +func (client GroupClient) Concat(accountName string, destinationPath string, sources []string, op string) (result autorest.Response, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: sources, Constraints: []validation.Constraint{{Target: "sources", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { return result, validation.NewErrorWithValidationError(err, "filesystem.GroupClient", "Concat") } - req, err := client.ConcatPreparer(destinationPath, sources, op) + req, err := client.ConcatPreparer(accountName, destinationPath, sources, op) if err != nil { return result, autorest.NewErrorWithError(err, "filesystem.GroupClient", "Concat", nil, "Failure preparing request") } @@ -224,20 +248,26 @@ func (client GroupClient) Concat(destinationPath string, sources []string, op st } // ConcatPreparer prepares the Concat request. -func (client GroupClient) ConcatPreparer(destinationPath string, sources []string, op string) (*http.Request, error) { +func (client GroupClient) ConcatPreparer(accountName string, destinationPath string, sources []string, op string) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "accountName": accountName, + "adlsFileSystemDnsSuffix": client.AdlsFileSystemDNSSuffix, + } + pathParameters := map[string]interface{}{ "destinationPath": autorest.Encode("path", destinationPath), } + const APIVersion = "2016-11-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, "op": autorest.Encode("query", op), "sources": autorest.Encode("query", sources, ","), } preparer := autorest.CreatePreparer( autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), + autorest.WithCustomBaseURL("https://{accountName}.{adlsFileSystemDnsSuffix}", urlParameters), autorest.WithPathParameters("/webhdfs/v1/{destinationPath}", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare(&http.Request{}) @@ -270,21 +300,22 @@ func (client GroupClient) ConcatResponder(resp *http.Response) (result autorest. // ConcurrentAppend does not guarantee order and can result in duplicated data // landing in the target file. // -// filePath is the Data Lake Store path (starting with '/') of the file to -// which to append using concurrent append. streamContents is the file contents -// to include when appending to the file. streamContents will be closed upon -// successful return. Callers should ensure closure when receiving an error.op -// is the constant value for the operation. transferEncoding is indicates the -// data being sent to the server is being streamed in chunks. appendMode is -// indicates the concurrent append call should create the file if it doesn't -// exist or just open the existing file for append syncFlag is optionally -// indicates what to do after completion of the concurrent append. DATA -// indicates more data is coming so no sync takes place, METADATA indicates a -// sync should be done to refresh metadata of the file only. CLOSE indicates -// that both the stream and metadata should be refreshed upon append +// accountName is the Azure Data Lake Store account to execute filesystem +// operations on. filePath is the Data Lake Store path (starting with '/') of +// the file to which to append using concurrent append. streamContents is the +// file contents to include when appending to the file. streamContents will be +// closed upon successful return. Callers should ensure closure when receiving +// an error.op is the constant value for the operation. transferEncoding is +// indicates the data being sent to the server is being streamed in chunks. +// appendMode is indicates the concurrent append call should create the file if +// it doesn't exist or just open the existing file for append syncFlag is +// optionally indicates what to do after completion of the concurrent append. +// DATA indicates more data is coming so no sync takes place, METADATA +// indicates a sync should be done to refresh metadata of the file only. CLOSE +// indicates that both the stream and metadata should be refreshed upon append // completion. -func (client GroupClient) ConcurrentAppend(filePath string, streamContents io.ReadCloser, op string, transferEncoding string, appendMode AppendModeType, syncFlag SyncFlag) (result autorest.Response, err error) { - req, err := client.ConcurrentAppendPreparer(filePath, streamContents, op, transferEncoding, appendMode, syncFlag) +func (client GroupClient) ConcurrentAppend(accountName string, filePath string, streamContents io.ReadCloser, op string, transferEncoding string, appendMode AppendModeType, syncFlag SyncFlag) (result autorest.Response, err error) { + req, err := client.ConcurrentAppendPreparer(accountName, filePath, streamContents, op, transferEncoding, appendMode, syncFlag) if err != nil { return result, autorest.NewErrorWithError(err, "filesystem.GroupClient", "ConcurrentAppend", nil, "Failure preparing request") } @@ -304,13 +335,19 @@ func (client GroupClient) ConcurrentAppend(filePath string, streamContents io.Re } // ConcurrentAppendPreparer prepares the ConcurrentAppend request. -func (client GroupClient) ConcurrentAppendPreparer(filePath string, streamContents io.ReadCloser, op string, transferEncoding string, appendMode AppendModeType, syncFlag SyncFlag) (*http.Request, error) { +func (client GroupClient) ConcurrentAppendPreparer(accountName string, filePath string, streamContents io.ReadCloser, op string, transferEncoding string, appendMode AppendModeType, syncFlag SyncFlag) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "accountName": accountName, + "adlsFileSystemDnsSuffix": client.AdlsFileSystemDNSSuffix, + } + pathParameters := map[string]interface{}{ "filePath": autorest.Encode("path", filePath), } + const APIVersion = "2016-11-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, "op": autorest.Encode("query", op), } if len(string(appendMode)) > 0 { @@ -322,7 +359,7 @@ func (client GroupClient) ConcurrentAppendPreparer(filePath string, streamConten preparer := autorest.CreatePreparer( autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), + autorest.WithCustomBaseURL("https://{accountName}.{adlsFileSystemDnsSuffix}", urlParameters), autorest.WithPathParameters("/WebHdfsExt/{filePath}", pathParameters), autorest.WithFile(streamContents), autorest.WithQueryParameters(queryParameters), @@ -351,9 +388,13 @@ func (client GroupClient) ConcurrentAppendResponder(resp *http.Response) (result // Create creates a file with optionally specified content. NOTE: If content is // provided, the resulting file cannot be modified using ConcurrentAppend. // -// directFilePath is the Data Lake Store path (starting with '/') of the file -// to create. op is the constant value for the operation. write is the constant -// value for the operation. streamContents is the file contents to include when +// accountName is the Azure Data Lake Store account to execute filesystem +// operations on. directFilePath is the Data Lake Store path (starting with +// '/') of the file to create. op is the constant value for the operation. +// write is flag to skip redirection. When write=false or not specified, the +// request is redirected. Submit another HTTP PUT request using the URL in the +// Location header with the file data to be written. When write=true, this +// redirection is skipped. streamContents is the file contents to include when // creating the file. This parameter is optional, resulting in an empty file if // not specified. streamContents will be closed upon successful return. Callers // should ensure closure when receiving an error.overwrite is the indication of @@ -361,9 +402,14 @@ func (client GroupClient) ConcurrentAppendResponder(resp *http.Response) (result // do after completion of the append. DATA indicates more data is coming so no // sync takes place, METADATA indicates a sync should be done to refresh // metadata of the file only. CLOSE indicates that both the stream and metadata -// should be refreshed upon append completion. -func (client GroupClient) Create(directFilePath string, op string, write string, streamContents io.ReadCloser, overwrite *bool, syncFlag SyncFlag) (result autorest.Response, err error) { - req, err := client.CreatePreparer(directFilePath, op, write, streamContents, overwrite, syncFlag) +// should be refreshed upon create completion. leaseID is optional unique GUID +// per file to ensure single writer semantics, meaning that only clients that +// append to the file with the same leaseId will be allowed to do so. +// permission is the octal representation of the unnamed user, mask and other +// permissions that should be set for the file when created. If not specified, +// it inherits these from the container. +func (client GroupClient) Create(accountName string, directFilePath string, op string, write string, streamContents io.ReadCloser, overwrite *bool, syncFlag SyncFlag, leaseID *uuid.UUID, permission *int32) (result autorest.Response, err error) { + req, err := client.CreatePreparer(accountName, directFilePath, op, write, streamContents, overwrite, syncFlag, leaseID, permission) if err != nil { return result, autorest.NewErrorWithError(err, "filesystem.GroupClient", "Create", nil, "Failure preparing request") } @@ -383,13 +429,19 @@ func (client GroupClient) Create(directFilePath string, op string, write string, } // CreatePreparer prepares the Create request. -func (client GroupClient) CreatePreparer(directFilePath string, op string, write string, streamContents io.ReadCloser, overwrite *bool, syncFlag SyncFlag) (*http.Request, error) { +func (client GroupClient) CreatePreparer(accountName string, directFilePath string, op string, write string, streamContents io.ReadCloser, overwrite *bool, syncFlag SyncFlag, leaseID *uuid.UUID, permission *int32) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "accountName": accountName, + "adlsFileSystemDnsSuffix": client.AdlsFileSystemDNSSuffix, + } + pathParameters := map[string]interface{}{ "directFilePath": autorest.Encode("path", directFilePath), } + const APIVersion = "2016-11-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, "op": autorest.Encode("query", op), "write": autorest.Encode("query", write), } @@ -399,10 +451,16 @@ func (client GroupClient) CreatePreparer(directFilePath string, op string, write if len(string(syncFlag)) > 0 { queryParameters["syncFlag"] = autorest.Encode("query", syncFlag) } + if leaseID != nil { + queryParameters["leaseId"] = autorest.Encode("query", *leaseID) + } + if permission != nil { + queryParameters["permission"] = autorest.Encode("query", *permission) + } preparer := autorest.CreatePreparer( autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), + autorest.WithCustomBaseURL("https://{accountName}.{adlsFileSystemDnsSuffix}", urlParameters), autorest.WithPathParameters("/webhdfs/v1/{directFilePath}", pathParameters), autorest.WithQueryParameters(queryParameters)) if streamContents != nil { @@ -432,11 +490,13 @@ func (client GroupClient) CreateResponder(resp *http.Response) (result autorest. // Delete deletes the requested file or directory, optionally recursively. // -// filePath is the Data Lake Store path (starting with '/') of the file or -// directory to delete. op is the constant value for the operation. recursive -// is the optional switch indicating if the delete should be recursive -func (client GroupClient) Delete(filePath string, op string, recursive *bool) (result FileOperationResult, err error) { - req, err := client.DeletePreparer(filePath, op, recursive) +// accountName is the Azure Data Lake Store account to execute filesystem +// operations on. filePath is the Data Lake Store path (starting with '/') of +// the file or directory to delete. op is the constant value for the operation. +// recursive is the optional switch indicating if the delete should be +// recursive +func (client GroupClient) Delete(accountName string, filePath string, op string, recursive *bool) (result FileOperationResult, err error) { + req, err := client.DeletePreparer(accountName, filePath, op, recursive) if err != nil { return result, autorest.NewErrorWithError(err, "filesystem.GroupClient", "Delete", nil, "Failure preparing request") } @@ -456,13 +516,19 @@ func (client GroupClient) Delete(filePath string, op string, recursive *bool) (r } // DeletePreparer prepares the Delete request. -func (client GroupClient) DeletePreparer(filePath string, op string, recursive *bool) (*http.Request, error) { +func (client GroupClient) DeletePreparer(accountName string, filePath string, op string, recursive *bool) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "accountName": accountName, + "adlsFileSystemDnsSuffix": client.AdlsFileSystemDNSSuffix, + } + pathParameters := map[string]interface{}{ "filePath": autorest.Encode("path", filePath), } + const APIVersion = "2016-11-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, "op": autorest.Encode("query", op), } if recursive != nil { @@ -471,7 +537,7 @@ func (client GroupClient) DeletePreparer(filePath string, op string, recursive * preparer := autorest.CreatePreparer( autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), + autorest.WithCustomBaseURL("https://{accountName}.{adlsFileSystemDnsSuffix}", urlParameters), autorest.WithPathParameters("/webhdfs/v1/{filePath}", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare(&http.Request{}) @@ -499,11 +565,15 @@ func (client GroupClient) DeleteResponder(resp *http.Response) (result FileOpera // GetACLStatus gets Access Control List (ACL) entries for the specified file // or directory. // -// aclFilePath is the Data Lake Store path (starting with '/') of the file or -// directory for which to get the ACL. op is the constant value for the -// operation. -func (client GroupClient) GetACLStatus(aclFilePath string, op string) (result ACLStatusResult, err error) { - req, err := client.GetACLStatusPreparer(aclFilePath, op) +// accountName is the Azure Data Lake Store account to execute filesystem +// operations on. aclFilePath is the Data Lake Store path (starting with '/') +// of the file or directory for which to get the ACL. op is the constant value +// for the operation. tooID is an optional switch to return friendly names in +// place of object ID for ACL entries. tooid=false returns friendly names +// instead of the AAD Object ID. Default value is true, returning AAD object +// IDs. +func (client GroupClient) GetACLStatus(accountName string, aclFilePath string, op string, tooID *bool) (result ACLStatusResult, err error) { + req, err := client.GetACLStatusPreparer(accountName, aclFilePath, op, tooID) if err != nil { return result, autorest.NewErrorWithError(err, "filesystem.GroupClient", "GetACLStatus", nil, "Failure preparing request") } @@ -523,19 +593,28 @@ func (client GroupClient) GetACLStatus(aclFilePath string, op string) (result AC } // GetACLStatusPreparer prepares the GetACLStatus request. -func (client GroupClient) GetACLStatusPreparer(aclFilePath string, op string) (*http.Request, error) { +func (client GroupClient) GetACLStatusPreparer(accountName string, aclFilePath string, op string, tooID *bool) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "accountName": accountName, + "adlsFileSystemDnsSuffix": client.AdlsFileSystemDNSSuffix, + } + pathParameters := map[string]interface{}{ "aclFilePath": autorest.Encode("path", aclFilePath), } + const APIVersion = "2016-11-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, "op": autorest.Encode("query", op), } + if tooID != nil { + queryParameters["tooId"] = autorest.Encode("query", *tooID) + } preparer := autorest.CreatePreparer( autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), + autorest.WithCustomBaseURL("https://{accountName}.{adlsFileSystemDnsSuffix}", urlParameters), autorest.WithPathParameters("/webhdfs/v1/{aclFilePath}", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare(&http.Request{}) @@ -563,11 +642,12 @@ func (client GroupClient) GetACLStatusResponder(resp *http.Response) (result ACL // GetContentSummary gets the file content summary object specified by the file // path. // -// getContentSummaryFilePath is the Data Lake Store path (starting with '/') of -// the file for which to retrieve the summary. op is the constant value for the -// operation. -func (client GroupClient) GetContentSummary(getContentSummaryFilePath string, op string) (result ContentSummaryResult, err error) { - req, err := client.GetContentSummaryPreparer(getContentSummaryFilePath, op) +// accountName is the Azure Data Lake Store account to execute filesystem +// operations on. getContentSummaryFilePath is the Data Lake Store path +// (starting with '/') of the file for which to retrieve the summary. op is the +// constant value for the operation. +func (client GroupClient) GetContentSummary(accountName string, getContentSummaryFilePath string, op string) (result ContentSummaryResult, err error) { + req, err := client.GetContentSummaryPreparer(accountName, getContentSummaryFilePath, op) if err != nil { return result, autorest.NewErrorWithError(err, "filesystem.GroupClient", "GetContentSummary", nil, "Failure preparing request") } @@ -587,20 +667,26 @@ func (client GroupClient) GetContentSummary(getContentSummaryFilePath string, op } // GetContentSummaryPreparer prepares the GetContentSummary request. -func (client GroupClient) GetContentSummaryPreparer(getContentSummaryFilePath string, op string) (*http.Request, error) { +func (client GroupClient) GetContentSummaryPreparer(accountName string, getContentSummaryFilePath string, op string) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "accountName": accountName, + "adlsFileSystemDnsSuffix": client.AdlsFileSystemDNSSuffix, + } + pathParameters := map[string]interface{}{ "getContentSummaryFilePath": autorest.Encode("path", getContentSummaryFilePath), } + const APIVersion = "2016-11-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, "op": autorest.Encode("query", op), } preparer := autorest.CreatePreparer( autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/webhdfs/va/{getContentSummaryFilePath}", pathParameters), + autorest.WithCustomBaseURL("https://{accountName}.{adlsFileSystemDnsSuffix}", urlParameters), + autorest.WithPathParameters("/webhdfs/v1/{getContentSummaryFilePath}", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare(&http.Request{}) } @@ -626,11 +712,15 @@ func (client GroupClient) GetContentSummaryResponder(resp *http.Response) (resul // GetFileStatus get the file status object specified by the file path. // -// getFilePath is the Data Lake Store path (starting with '/') of the file or -// directory for which to retrieve the status. op is the constant value for the -// operation. -func (client GroupClient) GetFileStatus(getFilePath string, op string) (result FileStatusResult, err error) { - req, err := client.GetFileStatusPreparer(getFilePath, op) +// accountName is the Azure Data Lake Store account to execute filesystem +// operations on. getFilePath is the Data Lake Store path (starting with '/') +// of the file or directory for which to retrieve the status. op is the +// constant value for the operation. tooID is an optional switch to return +// friendly names in place of owner and group. tooid=false returns friendly +// names instead of the AAD Object ID. Default value is true, returning AAD +// object IDs. +func (client GroupClient) GetFileStatus(accountName string, getFilePath string, op string, tooID *bool) (result FileStatusResult, err error) { + req, err := client.GetFileStatusPreparer(accountName, getFilePath, op, tooID) if err != nil { return result, autorest.NewErrorWithError(err, "filesystem.GroupClient", "GetFileStatus", nil, "Failure preparing request") } @@ -650,19 +740,28 @@ func (client GroupClient) GetFileStatus(getFilePath string, op string) (result F } // GetFileStatusPreparer prepares the GetFileStatus request. -func (client GroupClient) GetFileStatusPreparer(getFilePath string, op string) (*http.Request, error) { +func (client GroupClient) GetFileStatusPreparer(accountName string, getFilePath string, op string, tooID *bool) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "accountName": accountName, + "adlsFileSystemDnsSuffix": client.AdlsFileSystemDNSSuffix, + } + pathParameters := map[string]interface{}{ "getFilePath": autorest.Encode("path", getFilePath), } + const APIVersion = "2016-11-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, "op": autorest.Encode("query", op), } + if tooID != nil { + queryParameters["tooId"] = autorest.Encode("query", *tooID) + } preparer := autorest.CreatePreparer( autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), + autorest.WithCustomBaseURL("https://{accountName}.{adlsFileSystemDnsSuffix}", urlParameters), autorest.WithPathParameters("/webhdfs/v1/{getFilePath}", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare(&http.Request{}) @@ -690,17 +789,21 @@ func (client GroupClient) GetFileStatusResponder(resp *http.Response) (result Fi // ListFileStatus get the list of file status objects specified by the file // path, with optional pagination parameters // -// listFilePath is the Data Lake Store path (starting with '/') of the -// directory to list. op is the constant value for the operation. listSize is -// gets or sets the number of items to return. Optional. listAfter is gets or -// sets the item or lexographical index after which to begin returning results. -// For example, a file list of 'a','b','d' and listAfter='b' will return 'd', -// and a listAfter='c' will also return 'd'. Optional. listBefore is gets or -// sets the item or lexographical index before which to begin returning -// results. For example, a file list of 'a','b','d' and listBefore='d' will -// return 'a','b', and a listBefore='c' will also return 'a','b'. Optional. -func (client GroupClient) ListFileStatus(listFilePath string, op string, listSize *int32, listAfter string, listBefore string) (result FileStatusesResult, err error) { - req, err := client.ListFileStatusPreparer(listFilePath, op, listSize, listAfter, listBefore) +// accountName is the Azure Data Lake Store account to execute filesystem +// operations on. listFilePath is the Data Lake Store path (starting with '/') +// of the directory to list. op is the constant value for the operation. +// listSize is gets or sets the number of items to return. Optional. listAfter +// is gets or sets the item or lexographical index after which to begin +// returning results. For example, a file list of 'a','b','d' and listAfter='b' +// will return 'd', and a listAfter='c' will also return 'd'. Optional. +// listBefore is gets or sets the item or lexographical index before which to +// begin returning results. For example, a file list of 'a','b','d' and +// listBefore='d' will return 'a','b', and a listBefore='c' will also return +// 'a','b'. Optional. tooID is an optional switch to return friendly names in +// place of owner and group. tooid=false returns friendly names instead of the +// AAD Object ID. Default value is true, returning AAD object IDs. +func (client GroupClient) ListFileStatus(accountName string, listFilePath string, op string, listSize *int32, listAfter string, listBefore string, tooID *bool) (result FileStatusesResult, err error) { + req, err := client.ListFileStatusPreparer(accountName, listFilePath, op, listSize, listAfter, listBefore, tooID) if err != nil { return result, autorest.NewErrorWithError(err, "filesystem.GroupClient", "ListFileStatus", nil, "Failure preparing request") } @@ -720,13 +823,19 @@ func (client GroupClient) ListFileStatus(listFilePath string, op string, listSiz } // ListFileStatusPreparer prepares the ListFileStatus request. -func (client GroupClient) ListFileStatusPreparer(listFilePath string, op string, listSize *int32, listAfter string, listBefore string) (*http.Request, error) { +func (client GroupClient) ListFileStatusPreparer(accountName string, listFilePath string, op string, listSize *int32, listAfter string, listBefore string, tooID *bool) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "accountName": accountName, + "adlsFileSystemDnsSuffix": client.AdlsFileSystemDNSSuffix, + } + pathParameters := map[string]interface{}{ "listFilePath": autorest.Encode("path", listFilePath), } + const APIVersion = "2016-11-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, "op": autorest.Encode("query", op), } if listSize != nil { @@ -738,10 +847,13 @@ func (client GroupClient) ListFileStatusPreparer(listFilePath string, op string, if len(listBefore) > 0 { queryParameters["listBefore"] = autorest.Encode("query", listBefore) } + if tooID != nil { + queryParameters["tooId"] = autorest.Encode("query", *tooID) + } preparer := autorest.CreatePreparer( autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), + autorest.WithCustomBaseURL("https://{accountName}.{adlsFileSystemDnsSuffix}", urlParameters), autorest.WithPathParameters("/webhdfs/v1/{listFilePath}", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare(&http.Request{}) @@ -768,10 +880,13 @@ func (client GroupClient) ListFileStatusResponder(resp *http.Response) (result F // Mkdirs creates a directory. // -// pathParameter is the Data Lake Store path (starting with '/') of the -// directory to create. op is the constant value for the operation. -func (client GroupClient) Mkdirs(pathParameter string, op string) (result FileOperationResult, err error) { - req, err := client.MkdirsPreparer(pathParameter, op) +// accountName is the Azure Data Lake Store account to execute filesystem +// operations on. pathParameter is the Data Lake Store path (starting with '/') +// of the directory to create. op is the constant value for the operation. +// permission is optional octal permission with which the directory should be +// created. +func (client GroupClient) Mkdirs(accountName string, pathParameter string, op string, permission *int32) (result FileOperationResult, err error) { + req, err := client.MkdirsPreparer(accountName, pathParameter, op, permission) if err != nil { return result, autorest.NewErrorWithError(err, "filesystem.GroupClient", "Mkdirs", nil, "Failure preparing request") } @@ -791,19 +906,28 @@ func (client GroupClient) Mkdirs(pathParameter string, op string) (result FileOp } // MkdirsPreparer prepares the Mkdirs request. -func (client GroupClient) MkdirsPreparer(pathParameter string, op string) (*http.Request, error) { +func (client GroupClient) MkdirsPreparer(accountName string, pathParameter string, op string, permission *int32) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "accountName": accountName, + "adlsFileSystemDnsSuffix": client.AdlsFileSystemDNSSuffix, + } + pathParameters := map[string]interface{}{ "path": autorest.Encode("path", pathParameter), } + const APIVersion = "2016-11-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, "op": autorest.Encode("query", op), } + if permission != nil { + queryParameters["permission"] = autorest.Encode("query", *permission) + } preparer := autorest.CreatePreparer( autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), + autorest.WithCustomBaseURL("https://{accountName}.{adlsFileSystemDnsSuffix}", urlParameters), autorest.WithPathParameters("/webhdfs/v1/{path}", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare(&http.Request{}) @@ -831,13 +955,14 @@ func (client GroupClient) MkdirsResponder(resp *http.Response) (result FileOpera // ModifyACLEntries modifies existing Access Control List (ACL) entries on a // file or folder. // -// modifyACLFilePath is the Data Lake Store path (starting with '/') of the -// file or directory with the ACL being modified. aclspec is the ACL -// specification included in ACL modification operations in the format +// accountName is the Azure Data Lake Store account to execute filesystem +// operations on. modifyACLFilePath is the Data Lake Store path (starting with +// '/') of the file or directory with the ACL being modified. aclspec is the +// ACL specification included in ACL modification operations in the format // '[default:]user|group|other::r|-w|-x|-' op is the constant value for the // operation. -func (client GroupClient) ModifyACLEntries(modifyACLFilePath string, aclspec string, op string) (result autorest.Response, err error) { - req, err := client.ModifyACLEntriesPreparer(modifyACLFilePath, aclspec, op) +func (client GroupClient) ModifyACLEntries(accountName string, modifyACLFilePath string, aclspec string, op string) (result autorest.Response, err error) { + req, err := client.ModifyACLEntriesPreparer(accountName, modifyACLFilePath, aclspec, op) if err != nil { return result, autorest.NewErrorWithError(err, "filesystem.GroupClient", "ModifyACLEntries", nil, "Failure preparing request") } @@ -857,20 +982,26 @@ func (client GroupClient) ModifyACLEntries(modifyACLFilePath string, aclspec str } // ModifyACLEntriesPreparer prepares the ModifyACLEntries request. -func (client GroupClient) ModifyACLEntriesPreparer(modifyACLFilePath string, aclspec string, op string) (*http.Request, error) { +func (client GroupClient) ModifyACLEntriesPreparer(accountName string, modifyACLFilePath string, aclspec string, op string) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "accountName": accountName, + "adlsFileSystemDnsSuffix": client.AdlsFileSystemDNSSuffix, + } + pathParameters := map[string]interface{}{ "modifyAclFilePath": autorest.Encode("path", modifyACLFilePath), } + const APIVersion = "2016-11-01" queryParameters := map[string]interface{}{ "aclspec": autorest.Encode("query", aclspec), - "api-version": client.APIVersion, + "api-version": APIVersion, "op": autorest.Encode("query", op), } preparer := autorest.CreatePreparer( autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), + autorest.WithCustomBaseURL("https://{accountName}.{adlsFileSystemDnsSuffix}", urlParameters), autorest.WithPathParameters("/webhdfs/v1/{modifyAclFilePath}", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare(&http.Request{}) @@ -899,10 +1030,11 @@ func (client GroupClient) ModifyACLEntriesResponder(resp *http.Response) (result // paths than the Concat method. This method and the parameters it accepts are // subject to change for usability in an upcoming version. // -// msConcatDestinationPath is the Data Lake Store path (starting with '/') of -// the destination file resulting from the concatenation. streamContents is a -// list of Data Lake Store paths (starting with '/') of the source files. Must -// be a comma-separated path list in the format: +// accountName is the Azure Data Lake Store account to execute filesystem +// operations on. msConcatDestinationPath is the Data Lake Store path (starting +// with '/') of the destination file resulting from the concatenation. +// streamContents is a list of Data Lake Store paths (starting with '/') of the +// source files. Must be a comma-separated path list in the format: // sources=/file/path/1.txt,/file/path/2.txt,/file/path/lastfile.csv // streamContents will be closed upon successful return. Callers should ensure // closure when receiving an error.op is the constant value for the operation. @@ -913,8 +1045,8 @@ func (client GroupClient) ModifyACLEntriesResponder(resp *http.Response) (result // concatenation operation. WARNING: This includes the deletion of any other // files that are not source files. Only set this to true when source files are // the only files in the source directory. -func (client GroupClient) MsConcat(msConcatDestinationPath string, streamContents io.ReadCloser, op string, deleteSourceDirectory *bool) (result autorest.Response, err error) { - req, err := client.MsConcatPreparer(msConcatDestinationPath, streamContents, op, deleteSourceDirectory) +func (client GroupClient) MsConcat(accountName string, msConcatDestinationPath string, streamContents io.ReadCloser, op string, deleteSourceDirectory *bool) (result autorest.Response, err error) { + req, err := client.MsConcatPreparer(accountName, msConcatDestinationPath, streamContents, op, deleteSourceDirectory) if err != nil { return result, autorest.NewErrorWithError(err, "filesystem.GroupClient", "MsConcat", nil, "Failure preparing request") } @@ -934,13 +1066,19 @@ func (client GroupClient) MsConcat(msConcatDestinationPath string, streamContent } // MsConcatPreparer prepares the MsConcat request. -func (client GroupClient) MsConcatPreparer(msConcatDestinationPath string, streamContents io.ReadCloser, op string, deleteSourceDirectory *bool) (*http.Request, error) { +func (client GroupClient) MsConcatPreparer(accountName string, msConcatDestinationPath string, streamContents io.ReadCloser, op string, deleteSourceDirectory *bool) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "accountName": accountName, + "adlsFileSystemDnsSuffix": client.AdlsFileSystemDNSSuffix, + } + pathParameters := map[string]interface{}{ "msConcatDestinationPath": autorest.Encode("path", msConcatDestinationPath), } + const APIVersion = "2016-11-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, "op": autorest.Encode("query", op), } if deleteSourceDirectory != nil { @@ -949,7 +1087,7 @@ func (client GroupClient) MsConcatPreparer(msConcatDestinationPath string, strea preparer := autorest.CreatePreparer( autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), + autorest.WithCustomBaseURL("https://{accountName}.{adlsFileSystemDnsSuffix}", urlParameters), autorest.WithPathParameters("/webhdfs/v1/{msConcatDestinationPath}", pathParameters), autorest.WithFile(streamContents), autorest.WithQueryParameters(queryParameters)) @@ -976,13 +1114,19 @@ func (client GroupClient) MsConcatResponder(resp *http.Response) (result autores // Open opens and reads from the specified file. // -// directFilePath is the Data Lake Store path (starting with '/') of the file -// to open. op is the constant value for the operation. read is the constant -// value for the operation. length is the number of bytes that the server will -// attempt to retrieve. It will retrieve <= length bytes. offset is the byte -// offset to start reading data from. -func (client GroupClient) Open(directFilePath string, op string, read string, length *int64, offset *int64) (result ReadCloser, err error) { - req, err := client.OpenPreparer(directFilePath, op, read, length, offset) +// accountName is the Azure Data Lake Store account to execute filesystem +// operations on. directFilePath is the Data Lake Store path (starting with +// '/') of the file to open. op is the constant value for the operation. read +// is flag to skip redirection. When read=false or not specified, the request +// is redirected. Submit another HTTP PUT request using the URL in the Location +// header with the file data to be read. When read=true, this redirection is +// skipped. length is the number of bytes that the server will attempt to +// retrieve. It will retrieve <= length bytes. offset is the byte offset to +// start reading data from. fileSessionID is optional unique GUID per file +// indicating all the reads with the same fileSessionId are from the same +// client and same session. This will give a performance benefit. +func (client GroupClient) Open(accountName string, directFilePath string, op string, read string, length *int64, offset *int64, fileSessionID *uuid.UUID) (result ReadCloser, err error) { + req, err := client.OpenPreparer(accountName, directFilePath, op, read, length, offset, fileSessionID) if err != nil { return result, autorest.NewErrorWithError(err, "filesystem.GroupClient", "Open", nil, "Failure preparing request") } @@ -1002,13 +1146,19 @@ func (client GroupClient) Open(directFilePath string, op string, read string, le } // OpenPreparer prepares the Open request. -func (client GroupClient) OpenPreparer(directFilePath string, op string, read string, length *int64, offset *int64) (*http.Request, error) { +func (client GroupClient) OpenPreparer(accountName string, directFilePath string, op string, read string, length *int64, offset *int64, fileSessionID *uuid.UUID) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "accountName": accountName, + "adlsFileSystemDnsSuffix": client.AdlsFileSystemDNSSuffix, + } + pathParameters := map[string]interface{}{ "directFilePath": autorest.Encode("path", directFilePath), } + const APIVersion = "2016-11-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, "op": autorest.Encode("query", op), "read": autorest.Encode("query", read), } @@ -1018,10 +1168,13 @@ func (client GroupClient) OpenPreparer(directFilePath string, op string, read st if offset != nil { queryParameters["offset"] = autorest.Encode("query", *offset) } + if fileSessionID != nil { + queryParameters["fileSessionId"] = autorest.Encode("query", *fileSessionID) + } preparer := autorest.CreatePreparer( autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), + autorest.WithCustomBaseURL("https://{accountName}.{adlsFileSystemDnsSuffix}", urlParameters), autorest.WithPathParameters("/webhdfs/v1/{directFilePath}", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare(&http.Request{}) @@ -1048,11 +1201,12 @@ func (client GroupClient) OpenResponder(resp *http.Response) (result ReadCloser, // RemoveACL removes the existing Access Control List (ACL) of the specified // file or directory. // -// aclFilePath is the Data Lake Store path (starting with '/') of the file or -// directory with the ACL being removed. op is the constant value for the -// operation. -func (client GroupClient) RemoveACL(aclFilePath string, op string) (result autorest.Response, err error) { - req, err := client.RemoveACLPreparer(aclFilePath, op) +// accountName is the Azure Data Lake Store account to execute filesystem +// operations on. aclFilePath is the Data Lake Store path (starting with '/') +// of the file or directory with the ACL being removed. op is the constant +// value for the operation. +func (client GroupClient) RemoveACL(accountName string, aclFilePath string, op string) (result autorest.Response, err error) { + req, err := client.RemoveACLPreparer(accountName, aclFilePath, op) if err != nil { return result, autorest.NewErrorWithError(err, "filesystem.GroupClient", "RemoveACL", nil, "Failure preparing request") } @@ -1072,19 +1226,25 @@ func (client GroupClient) RemoveACL(aclFilePath string, op string) (result autor } // RemoveACLPreparer prepares the RemoveACL request. -func (client GroupClient) RemoveACLPreparer(aclFilePath string, op string) (*http.Request, error) { +func (client GroupClient) RemoveACLPreparer(accountName string, aclFilePath string, op string) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "accountName": accountName, + "adlsFileSystemDnsSuffix": client.AdlsFileSystemDNSSuffix, + } + pathParameters := map[string]interface{}{ "aclFilePath": autorest.Encode("path", aclFilePath), } + const APIVersion = "2016-11-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, "op": autorest.Encode("query", op), } preparer := autorest.CreatePreparer( autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), + autorest.WithCustomBaseURL("https://{accountName}.{adlsFileSystemDnsSuffix}", urlParameters), autorest.WithPathParameters("/webhdfs/v1/{aclFilePath}", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare(&http.Request{}) @@ -1111,12 +1271,13 @@ func (client GroupClient) RemoveACLResponder(resp *http.Response) (result autore // RemoveACLEntries removes existing Access Control List (ACL) entries for a // file or folder. // -// removeACLFilePath is the Data Lake Store path (starting with '/') of the -// file or directory with the ACL being removed. aclspec is the ACL spec -// included in ACL removal operations in the format +// accountName is the Azure Data Lake Store account to execute filesystem +// operations on. removeACLFilePath is the Data Lake Store path (starting with +// '/') of the file or directory with the ACL being removed. aclspec is the ACL +// spec included in ACL removal operations in the format // '[default:]user|group|other' op is the constant value for the operation. -func (client GroupClient) RemoveACLEntries(removeACLFilePath string, aclspec string, op string) (result autorest.Response, err error) { - req, err := client.RemoveACLEntriesPreparer(removeACLFilePath, aclspec, op) +func (client GroupClient) RemoveACLEntries(accountName string, removeACLFilePath string, aclspec string, op string) (result autorest.Response, err error) { + req, err := client.RemoveACLEntriesPreparer(accountName, removeACLFilePath, aclspec, op) if err != nil { return result, autorest.NewErrorWithError(err, "filesystem.GroupClient", "RemoveACLEntries", nil, "Failure preparing request") } @@ -1136,20 +1297,26 @@ func (client GroupClient) RemoveACLEntries(removeACLFilePath string, aclspec str } // RemoveACLEntriesPreparer prepares the RemoveACLEntries request. -func (client GroupClient) RemoveACLEntriesPreparer(removeACLFilePath string, aclspec string, op string) (*http.Request, error) { +func (client GroupClient) RemoveACLEntriesPreparer(accountName string, removeACLFilePath string, aclspec string, op string) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "accountName": accountName, + "adlsFileSystemDnsSuffix": client.AdlsFileSystemDNSSuffix, + } + pathParameters := map[string]interface{}{ "removeAclFilePath": autorest.Encode("path", removeACLFilePath), } + const APIVersion = "2016-11-01" queryParameters := map[string]interface{}{ "aclspec": autorest.Encode("query", aclspec), - "api-version": client.APIVersion, + "api-version": APIVersion, "op": autorest.Encode("query", op), } preparer := autorest.CreatePreparer( autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), + autorest.WithCustomBaseURL("https://{accountName}.{adlsFileSystemDnsSuffix}", urlParameters), autorest.WithPathParameters("/webhdfs/v1/{removeAclFilePath}", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare(&http.Request{}) @@ -1176,11 +1343,12 @@ func (client GroupClient) RemoveACLEntriesResponder(resp *http.Response) (result // RemoveDefaultACL removes the existing Default Access Control List (ACL) of // the specified directory. // -// defaultACLFilePath is the Data Lake Store path (starting with '/') of the -// directory with the default ACL being removed. op is the constant value for -// the operation. -func (client GroupClient) RemoveDefaultACL(defaultACLFilePath string, op string) (result autorest.Response, err error) { - req, err := client.RemoveDefaultACLPreparer(defaultACLFilePath, op) +// accountName is the Azure Data Lake Store account to execute filesystem +// operations on. defaultACLFilePath is the Data Lake Store path (starting with +// '/') of the directory with the default ACL being removed. op is the constant +// value for the operation. +func (client GroupClient) RemoveDefaultACL(accountName string, defaultACLFilePath string, op string) (result autorest.Response, err error) { + req, err := client.RemoveDefaultACLPreparer(accountName, defaultACLFilePath, op) if err != nil { return result, autorest.NewErrorWithError(err, "filesystem.GroupClient", "RemoveDefaultACL", nil, "Failure preparing request") } @@ -1200,19 +1368,25 @@ func (client GroupClient) RemoveDefaultACL(defaultACLFilePath string, op string) } // RemoveDefaultACLPreparer prepares the RemoveDefaultACL request. -func (client GroupClient) RemoveDefaultACLPreparer(defaultACLFilePath string, op string) (*http.Request, error) { +func (client GroupClient) RemoveDefaultACLPreparer(accountName string, defaultACLFilePath string, op string) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "accountName": accountName, + "adlsFileSystemDnsSuffix": client.AdlsFileSystemDNSSuffix, + } + pathParameters := map[string]interface{}{ "defaultAclFilePath": autorest.Encode("path", defaultACLFilePath), } + const APIVersion = "2016-11-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, "op": autorest.Encode("query", op), } preparer := autorest.CreatePreparer( autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), + autorest.WithCustomBaseURL("https://{accountName}.{adlsFileSystemDnsSuffix}", urlParameters), autorest.WithPathParameters("/webhdfs/v1/{defaultAclFilePath}", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare(&http.Request{}) @@ -1238,11 +1412,13 @@ func (client GroupClient) RemoveDefaultACLResponder(resp *http.Response) (result // Rename rename a file or directory. // -// renameFilePath is the Data Lake Store path (starting with '/') of the file -// or directory to move/rename. destination is the path to move/rename the file -// or folder to op is the constant value for the operation. -func (client GroupClient) Rename(renameFilePath string, destination string, op string) (result FileOperationResult, err error) { - req, err := client.RenamePreparer(renameFilePath, destination, op) +// accountName is the Azure Data Lake Store account to execute filesystem +// operations on. renameFilePath is the Data Lake Store path (starting with +// '/') of the file or directory to move/rename. destination is the path to +// move/rename the file or folder to op is the constant value for the +// operation. +func (client GroupClient) Rename(accountName string, renameFilePath string, destination string, op string) (result FileOperationResult, err error) { + req, err := client.RenamePreparer(accountName, renameFilePath, destination, op) if err != nil { return result, autorest.NewErrorWithError(err, "filesystem.GroupClient", "Rename", nil, "Failure preparing request") } @@ -1262,20 +1438,26 @@ func (client GroupClient) Rename(renameFilePath string, destination string, op s } // RenamePreparer prepares the Rename request. -func (client GroupClient) RenamePreparer(renameFilePath string, destination string, op string) (*http.Request, error) { +func (client GroupClient) RenamePreparer(accountName string, renameFilePath string, destination string, op string) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "accountName": accountName, + "adlsFileSystemDnsSuffix": client.AdlsFileSystemDNSSuffix, + } + pathParameters := map[string]interface{}{ "renameFilePath": autorest.Encode("path", renameFilePath), } + const APIVersion = "2016-11-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, "destination": autorest.Encode("query", destination), "op": autorest.Encode("query", op), } preparer := autorest.CreatePreparer( autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), + autorest.WithCustomBaseURL("https://{accountName}.{adlsFileSystemDnsSuffix}", urlParameters), autorest.WithPathParameters("/webhdfs/v1/{renameFilePath}", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare(&http.Request{}) @@ -1302,13 +1484,14 @@ func (client GroupClient) RenameResponder(resp *http.Response) (result FileOpera // SetACL sets the Access Control List (ACL) for a file or folder. // -// setACLFilePath is the Data Lake Store path (starting with '/') of the file -// or directory on which to set the ACL. aclspec is the ACL spec included in -// ACL creation operations in the format +// accountName is the Azure Data Lake Store account to execute filesystem +// operations on. setACLFilePath is the Data Lake Store path (starting with +// '/') of the file or directory on which to set the ACL. aclspec is the ACL +// spec included in ACL creation operations in the format // '[default:]user|group|other::r|-w|-x|-' op is the constant value for the // operation. -func (client GroupClient) SetACL(setACLFilePath string, aclspec string, op string) (result autorest.Response, err error) { - req, err := client.SetACLPreparer(setACLFilePath, aclspec, op) +func (client GroupClient) SetACL(accountName string, setACLFilePath string, aclspec string, op string) (result autorest.Response, err error) { + req, err := client.SetACLPreparer(accountName, setACLFilePath, aclspec, op) if err != nil { return result, autorest.NewErrorWithError(err, "filesystem.GroupClient", "SetACL", nil, "Failure preparing request") } @@ -1328,20 +1511,26 @@ func (client GroupClient) SetACL(setACLFilePath string, aclspec string, op strin } // SetACLPreparer prepares the SetACL request. -func (client GroupClient) SetACLPreparer(setACLFilePath string, aclspec string, op string) (*http.Request, error) { +func (client GroupClient) SetACLPreparer(accountName string, setACLFilePath string, aclspec string, op string) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "accountName": accountName, + "adlsFileSystemDnsSuffix": client.AdlsFileSystemDNSSuffix, + } + pathParameters := map[string]interface{}{ "setAclFilePath": autorest.Encode("path", setACLFilePath), } + const APIVersion = "2016-11-01" queryParameters := map[string]interface{}{ "aclspec": autorest.Encode("query", aclspec), - "api-version": client.APIVersion, + "api-version": APIVersion, "op": autorest.Encode("query", op), } preparer := autorest.CreatePreparer( autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), + autorest.WithCustomBaseURL("https://{accountName}.{adlsFileSystemDnsSuffix}", urlParameters), autorest.WithPathParameters("/webhdfs/v1/{setAclFilePath}", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare(&http.Request{}) @@ -1369,19 +1558,20 @@ func (client GroupClient) SetACLResponder(resp *http.Response) (result autorest. // This operation can only be executed against files. Folders are not // supported. // -// filePath is the Data Lake Store path (starting with '/') of the file on -// which to set or remove the expiration time. expiryOption is indicates the -// type of expiration to use for the file: 1. NeverExpire: ExpireTime is -// ignored. 2. RelativeToNow: ExpireTime is an integer in milliseconds -// representing the expiration date relative to when file expiration is -// updated. 3. RelativeToCreationDate: ExpireTime is an integer in milliseconds -// representing the expiration date relative to file creation. 4. Absolute: -// ExpireTime is an integer in milliseconds, as a Unix timestamp relative to -// 1/1/1970 00:00:00. op is the constant value for the operation. expireTime is -// the time that the file will expire, corresponding to the ExpiryOption that -// was set. -func (client GroupClient) SetFileExpiry(filePath string, expiryOption ExpiryOptionType, op string, expireTime *int64) (result autorest.Response, err error) { - req, err := client.SetFileExpiryPreparer(filePath, expiryOption, op, expireTime) +// accountName is the Azure Data Lake Store account to execute filesystem +// operations on. filePath is the Data Lake Store path (starting with '/') of +// the file on which to set or remove the expiration time. expiryOption is +// indicates the type of expiration to use for the file: 1. NeverExpire: +// ExpireTime is ignored. 2. RelativeToNow: ExpireTime is an integer in +// milliseconds representing the expiration date relative to when file +// expiration is updated. 3. RelativeToCreationDate: ExpireTime is an integer +// in milliseconds representing the expiration date relative to file creation. +// 4. Absolute: ExpireTime is an integer in milliseconds, as a Unix timestamp +// relative to 1/1/1970 00:00:00. op is the constant value for the operation. +// expireTime is the time that the file will expire, corresponding to the +// ExpiryOption that was set. +func (client GroupClient) SetFileExpiry(accountName string, filePath string, expiryOption ExpiryOptionType, op string, expireTime *int64) (result autorest.Response, err error) { + req, err := client.SetFileExpiryPreparer(accountName, filePath, expiryOption, op, expireTime) if err != nil { return result, autorest.NewErrorWithError(err, "filesystem.GroupClient", "SetFileExpiry", nil, "Failure preparing request") } @@ -1401,13 +1591,19 @@ func (client GroupClient) SetFileExpiry(filePath string, expiryOption ExpiryOpti } // SetFileExpiryPreparer prepares the SetFileExpiry request. -func (client GroupClient) SetFileExpiryPreparer(filePath string, expiryOption ExpiryOptionType, op string, expireTime *int64) (*http.Request, error) { +func (client GroupClient) SetFileExpiryPreparer(accountName string, filePath string, expiryOption ExpiryOptionType, op string, expireTime *int64) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "accountName": accountName, + "adlsFileSystemDnsSuffix": client.AdlsFileSystemDNSSuffix, + } + pathParameters := map[string]interface{}{ "filePath": autorest.Encode("path", filePath), } + const APIVersion = "2016-11-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, "expiryOption": autorest.Encode("query", expiryOption), "op": autorest.Encode("query", op), } @@ -1417,7 +1613,7 @@ func (client GroupClient) SetFileExpiryPreparer(filePath string, expiryOption Ex preparer := autorest.CreatePreparer( autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), + autorest.WithCustomBaseURL("https://{accountName}.{adlsFileSystemDnsSuffix}", urlParameters), autorest.WithPathParameters("/WebHdfsExt/{filePath}", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare(&http.Request{}) @@ -1443,14 +1639,15 @@ func (client GroupClient) SetFileExpiryResponder(resp *http.Response) (result au // SetOwner sets the owner of a file or directory. // -// setOwnerFilePath is the Data Lake Store path (starting with '/') of the file -// or directory for which to set the owner. op is the constant value for the -// operation. owner is the AAD Object ID of the user owner of the file or -// directory. If empty, the property will remain unchanged. group is the AAD -// Object ID of the group owner of the file or directory. If empty, the +// accountName is the Azure Data Lake Store account to execute filesystem +// operations on. setOwnerFilePath is the Data Lake Store path (starting with +// '/') of the file or directory for which to set the owner. op is the constant +// value for the operation. owner is the AAD Object ID of the user owner of the +// file or directory. If empty, the property will remain unchanged. group is +// the AAD Object ID of the group owner of the file or directory. If empty, the // property will remain unchanged. -func (client GroupClient) SetOwner(setOwnerFilePath string, op string, owner string, group string) (result autorest.Response, err error) { - req, err := client.SetOwnerPreparer(setOwnerFilePath, op, owner, group) +func (client GroupClient) SetOwner(accountName string, setOwnerFilePath string, op string, owner string, group string) (result autorest.Response, err error) { + req, err := client.SetOwnerPreparer(accountName, setOwnerFilePath, op, owner, group) if err != nil { return result, autorest.NewErrorWithError(err, "filesystem.GroupClient", "SetOwner", nil, "Failure preparing request") } @@ -1470,13 +1667,19 @@ func (client GroupClient) SetOwner(setOwnerFilePath string, op string, owner str } // SetOwnerPreparer prepares the SetOwner request. -func (client GroupClient) SetOwnerPreparer(setOwnerFilePath string, op string, owner string, group string) (*http.Request, error) { +func (client GroupClient) SetOwnerPreparer(accountName string, setOwnerFilePath string, op string, owner string, group string) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "accountName": accountName, + "adlsFileSystemDnsSuffix": client.AdlsFileSystemDNSSuffix, + } + pathParameters := map[string]interface{}{ "setOwnerFilePath": autorest.Encode("path", setOwnerFilePath), } + const APIVersion = "2016-11-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, "op": autorest.Encode("query", op), } if len(owner) > 0 { @@ -1488,7 +1691,7 @@ func (client GroupClient) SetOwnerPreparer(setOwnerFilePath string, op string, o preparer := autorest.CreatePreparer( autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), + autorest.WithCustomBaseURL("https://{accountName}.{adlsFileSystemDnsSuffix}", urlParameters), autorest.WithPathParameters("/webhdfs/v1/{setOwnerFilePath}", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare(&http.Request{}) @@ -1514,12 +1717,13 @@ func (client GroupClient) SetOwnerResponder(resp *http.Response) (result autores // SetPermission sets the permission of the file or folder. // -// setPermissionFilePath is the Data Lake Store path (starting with '/') of the -// file or directory for which to set the permission. op is the constant value -// for the operation. permission is a string representation of the permission -// (i.e 'rwx'). If empty, this property remains unchanged. -func (client GroupClient) SetPermission(setPermissionFilePath string, op string, permission string) (result autorest.Response, err error) { - req, err := client.SetPermissionPreparer(setPermissionFilePath, op, permission) +// accountName is the Azure Data Lake Store account to execute filesystem +// operations on. setPermissionFilePath is the Data Lake Store path (starting +// with '/') of the file or directory for which to set the permission. op is +// the constant value for the operation. permission is a string representation +// of the permission (i.e 'rwx'). If empty, this property remains unchanged. +func (client GroupClient) SetPermission(accountName string, setPermissionFilePath string, op string, permission string) (result autorest.Response, err error) { + req, err := client.SetPermissionPreparer(accountName, setPermissionFilePath, op, permission) if err != nil { return result, autorest.NewErrorWithError(err, "filesystem.GroupClient", "SetPermission", nil, "Failure preparing request") } @@ -1539,13 +1743,19 @@ func (client GroupClient) SetPermission(setPermissionFilePath string, op string, } // SetPermissionPreparer prepares the SetPermission request. -func (client GroupClient) SetPermissionPreparer(setPermissionFilePath string, op string, permission string) (*http.Request, error) { +func (client GroupClient) SetPermissionPreparer(accountName string, setPermissionFilePath string, op string, permission string) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "accountName": accountName, + "adlsFileSystemDnsSuffix": client.AdlsFileSystemDNSSuffix, + } + pathParameters := map[string]interface{}{ "setPermissionFilePath": autorest.Encode("path", setPermissionFilePath), } + const APIVersion = "2016-11-01" queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, + "api-version": APIVersion, "op": autorest.Encode("query", op), } if len(permission) > 0 { @@ -1554,7 +1764,7 @@ func (client GroupClient) SetPermissionPreparer(setPermissionFilePath string, op preparer := autorest.CreatePreparer( autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), + autorest.WithCustomBaseURL("https://{accountName}.{adlsFileSystemDnsSuffix}", urlParameters), autorest.WithPathParameters("/webhdfs/v1/{setPermissionFilePath}", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare(&http.Request{}) diff --git a/datalake-store/filesystem/models.go b/datalake-store/filesystem/models.go old mode 100644 new mode 100755 index 66a766076bfc..517f86119cb4 --- a/datalake-store/filesystem/models.go +++ b/datalake-store/filesystem/models.go @@ -14,7 +14,7 @@ package filesystem // See the License for the specific language governing permissions and // limitations under the License. // -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.0 +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 // Changes may cause incorrect behavior and will be lost if the code is // regenerated. @@ -217,7 +217,7 @@ type FileStatusProperties struct { AccessTime *int64 `json:"accessTime,omitempty"` BlockSize *int64 `json:"blockSize,omitempty"` ChildrenNum *int64 `json:"childrenNum,omitempty"` - ExpirationTime *int64 `json:"expirationTime,omitempty"` + ExpirationTime *int64 `json:"msExpirationTime,omitempty"` Group *string `json:"group,omitempty"` Length *int64 `json:"length,omitempty"` ModificationTime *int64 `json:"modificationTime,omitempty"` @@ -225,6 +225,7 @@ type FileStatusProperties struct { PathSuffix *string `json:"pathSuffix,omitempty"` Permission *string `json:"permission,omitempty"` Type FileType `json:"type,omitempty"` + ACLBit *bool `json:"aclBit,omitempty"` } // FileStatusResult is data Lake Store filesystem file status information diff --git a/datalake-store/filesystem/version.go b/datalake-store/filesystem/version.go old mode 100644 new mode 100755 index 60d54e7dce6f..26184ad1a6e2 --- a/datalake-store/filesystem/version.go +++ b/datalake-store/filesystem/version.go @@ -18,43 +18,12 @@ package filesystem // Changes may cause incorrect behavior and will be lost if the code is // regenerated. -import ( - "bytes" - "fmt" - "strings" -) - -const ( - major = "8" - minor = "1" - patch = "0" - tag = "beta" - userAgentFormat = "Azure-SDK-For-Go/%s arm-%s/%s" -) - -// cached results of UserAgent and Version to prevent repeated operations. -var ( - userAgent string - version string -) - // UserAgent returns the UserAgent string to use when sending http.Requests. func UserAgent() string { - if userAgent == "" { - userAgent = fmt.Sprintf(userAgentFormat, Version(), "filesystem", "2016-11-01") - } - return userAgent + return "Azure-SDK-For-Go/v9.0.0-beta arm-filesystem/2016-11-01" } // Version returns the semantic version (see http://semver.org) of the client. func Version() string { - if version == "" { - versionBuilder := bytes.NewBufferString(fmt.Sprintf("%s.%s.%s", major, minor, patch)) - if tag != "" { - versionBuilder.WriteRune('-') - versionBuilder.WriteString(strings.TrimPrefix(tag, "-")) - } - version = string(versionBuilder.Bytes()) - } - return version + return "v9.0.0-beta" } diff --git a/storage/README.md b/storage/README.md deleted file mode 100644 index 0ab099848bba..000000000000 --- a/storage/README.md +++ /dev/null @@ -1,5 +0,0 @@ -# Azure Storage SDK for Go - -The `github.com/Azure/azure-sdk-for-go/storage` package is used to perform operations in Azure Storage Service. To manage your storage accounts (Azure Resource Manager / ARM), use the [github.com/Azure/azure-sdk-for-go/arm/storage](../arm/storage) package. For your classic storage accounts (Azure Service Management / ASM), use [github.com/Azure/azure-sdk-for-go/management/storageservice](../management/storageservice) package. - -This package includes support for [Azure Storage Emulator](https://azure.microsoft.com/documentation/articles/storage-use-emulator/) \ No newline at end of file diff --git a/storage/authorization.go b/storage/authorization.go deleted file mode 100644 index 89a0d0b3cdf8..000000000000 --- a/storage/authorization.go +++ /dev/null @@ -1,223 +0,0 @@ -// Package storage provides clients for Microsoft Azure Storage Services. -package storage - -import ( - "bytes" - "fmt" - "net/url" - "sort" - "strings" -) - -// See: https://docs.microsoft.com/rest/api/storageservices/fileservices/authentication-for-the-azure-storage-services - -type authentication string - -const ( - sharedKey authentication = "sharedKey" - sharedKeyForTable authentication = "sharedKeyTable" - sharedKeyLite authentication = "sharedKeyLite" - sharedKeyLiteForTable authentication = "sharedKeyLiteTable" - - // headers - headerAuthorization = "Authorization" - headerContentLength = "Content-Length" - headerDate = "Date" - headerXmsDate = "x-ms-date" - headerXmsVersion = "x-ms-version" - headerContentEncoding = "Content-Encoding" - headerContentLanguage = "Content-Language" - headerContentType = "Content-Type" - headerContentMD5 = "Content-MD5" - headerIfModifiedSince = "If-Modified-Since" - headerIfMatch = "If-Match" - headerIfNoneMatch = "If-None-Match" - headerIfUnmodifiedSince = "If-Unmodified-Since" - headerRange = "Range" -) - -func (c *Client) addAuthorizationHeader(verb, url string, headers map[string]string, auth authentication) (map[string]string, error) { - authHeader, err := c.getSharedKey(verb, url, headers, auth) - if err != nil { - return nil, err - } - headers[headerAuthorization] = authHeader - return headers, nil -} - -func (c *Client) getSharedKey(verb, url string, headers map[string]string, auth authentication) (string, error) { - canRes, err := c.buildCanonicalizedResource(url, auth) - if err != nil { - return "", err - } - - canString, err := buildCanonicalizedString(verb, headers, canRes, auth) - if err != nil { - return "", err - } - return c.createAuthorizationHeader(canString, auth), nil -} - -func (c *Client) buildCanonicalizedResource(uri string, auth authentication) (string, error) { - errMsg := "buildCanonicalizedResource error: %s" - u, err := url.Parse(uri) - if err != nil { - return "", fmt.Errorf(errMsg, err.Error()) - } - - cr := bytes.NewBufferString("/") - cr.WriteString(c.getCanonicalizedAccountName()) - - if len(u.Path) > 0 { - // Any portion of the CanonicalizedResource string that is derived from - // the resource's URI should be encoded exactly as it is in the URI. - // -- https://msdn.microsoft.com/en-gb/library/azure/dd179428.aspx - cr.WriteString(u.EscapedPath()) - } - - params, err := url.ParseQuery(u.RawQuery) - if err != nil { - return "", fmt.Errorf(errMsg, err.Error()) - } - - // See https://github.com/Azure/azure-storage-net/blob/master/Lib/Common/Core/Util/AuthenticationUtility.cs#L277 - if auth == sharedKey { - if len(params) > 0 { - cr.WriteString("\n") - - keys := []string{} - for key := range params { - keys = append(keys, key) - } - sort.Strings(keys) - - completeParams := []string{} - for _, key := range keys { - if len(params[key]) > 1 { - sort.Strings(params[key]) - } - - completeParams = append(completeParams, fmt.Sprintf("%s:%s", key, strings.Join(params[key], ","))) - } - cr.WriteString(strings.Join(completeParams, "\n")) - } - } else { - // search for "comp" parameter, if exists then add it to canonicalizedresource - if v, ok := params["comp"]; ok { - cr.WriteString("?comp=" + v[0]) - } - } - - return string(cr.Bytes()), nil -} - -func (c *Client) getCanonicalizedAccountName() string { - // since we may be trying to access a secondary storage account, we need to - // remove the -secondary part of the storage name - return strings.TrimSuffix(c.accountName, "-secondary") -} - -func buildCanonicalizedString(verb string, headers map[string]string, canonicalizedResource string, auth authentication) (string, error) { - contentLength := headers[headerContentLength] - if contentLength == "0" { - contentLength = "" - } - date := headers[headerDate] - if v, ok := headers[headerXmsDate]; ok { - if auth == sharedKey || auth == sharedKeyLite { - date = "" - } else { - date = v - } - } - var canString string - switch auth { - case sharedKey: - canString = strings.Join([]string{ - verb, - headers[headerContentEncoding], - headers[headerContentLanguage], - contentLength, - headers[headerContentMD5], - headers[headerContentType], - date, - headers[headerIfModifiedSince], - headers[headerIfMatch], - headers[headerIfNoneMatch], - headers[headerIfUnmodifiedSince], - headers[headerRange], - buildCanonicalizedHeader(headers), - canonicalizedResource, - }, "\n") - case sharedKeyForTable: - canString = strings.Join([]string{ - verb, - headers[headerContentMD5], - headers[headerContentType], - date, - canonicalizedResource, - }, "\n") - case sharedKeyLite: - canString = strings.Join([]string{ - verb, - headers[headerContentMD5], - headers[headerContentType], - date, - buildCanonicalizedHeader(headers), - canonicalizedResource, - }, "\n") - case sharedKeyLiteForTable: - canString = strings.Join([]string{ - date, - canonicalizedResource, - }, "\n") - default: - return "", fmt.Errorf("%s authentication is not supported yet", auth) - } - return canString, nil -} - -func buildCanonicalizedHeader(headers map[string]string) string { - cm := make(map[string]string) - - for k, v := range headers { - headerName := strings.TrimSpace(strings.ToLower(k)) - if strings.HasPrefix(headerName, "x-ms-") { - cm[headerName] = v - } - } - - if len(cm) == 0 { - return "" - } - - keys := []string{} - for key := range cm { - keys = append(keys, key) - } - - sort.Strings(keys) - - ch := bytes.NewBufferString("") - - for _, key := range keys { - ch.WriteString(key) - ch.WriteRune(':') - ch.WriteString(cm[key]) - ch.WriteRune('\n') - } - - return strings.TrimSuffix(string(ch.Bytes()), "\n") -} - -func (c *Client) createAuthorizationHeader(canonicalizedString string, auth authentication) string { - signature := c.computeHmac256(canonicalizedString) - var key string - switch auth { - case sharedKey, sharedKeyForTable: - key = "SharedKey" - case sharedKeyLite, sharedKeyLiteForTable: - key = "SharedKeyLite" - } - return fmt.Sprintf("%s %s:%s", key, c.getCanonicalizedAccountName(), signature) -} diff --git a/storage/authorization_test.go b/storage/authorization_test.go deleted file mode 100644 index 436a64fbf144..000000000000 --- a/storage/authorization_test.go +++ /dev/null @@ -1,226 +0,0 @@ -package storage - -import ( - "encoding/base64" - "net/http" - - chk "gopkg.in/check.v1" -) - -type AuthorizationSuite struct{} - -var _ = chk.Suite(&AuthorizationSuite{}) - -func (a *AuthorizationSuite) Test_addAuthorizationHeader(c *chk.C) { - cli, err := NewBasicClient("mindgotest", "zHDHGs7C+Di9pZSDMuarxJJz3xRBzAHBYaobxpLEc7kwTptR/hPEa9j93hIfb2Tbe9IA50MViGmjQ6nUF/OVvA==") - c.Assert(err, chk.IsNil) - cli.UseSharedKeyLite = true - tableCli := cli.GetTableService() - - headers := map[string]string{ - "Accept-Charset": "UTF-8", - headerContentType: "application/json", - headerXmsDate: "Wed, 23 Sep 2015 16:40:05 GMT", - headerContentLength: "0", - headerXmsVersion: "2015-02-21", - "Accept": "application/json;odata=nometadata", - } - url := "https://mindgotest.table.core.windows.net/tquery()" - headers, err = tableCli.client.addAuthorizationHeader("", url, headers, tableCli.auth) - c.Assert(err, chk.IsNil) - - c.Assert(headers[headerAuthorization], chk.Equals, "SharedKeyLite mindgotest:+32DTgsPUgXPo/O7RYaTs0DllA6FTXMj3uK4Qst8y/E=") -} - -func (a *AuthorizationSuite) Test_getSharedKey(c *chk.C) { - // Shared Key Lite for Tables - cli, err := NewBasicClient("mindgotest", "zHDHGs7C+Di9pZSDMuarxJJz3xRBzAHBYaobxpLEc7kwTptR/hPEa9j93hIfb2Tbe9IA50MViGmjQ6nUF/OVvA==") - c.Assert(err, chk.IsNil) - - headers := map[string]string{ - "Accept-Charset": "UTF-8", - headerContentType: "application/json", - headerXmsDate: "Wed, 23 Sep 2015 16:40:05 GMT", - headerContentLength: "0", - headerXmsVersion: "2015-02-21", - "Accept": "application/json;odata=nometadata", - } - url := "https://mindgotest.table.core.windows.net/tquery()" - - key, err := cli.getSharedKey("", url, headers, sharedKeyLiteForTable) - c.Assert(err, chk.IsNil) - c.Assert(key, chk.Equals, "SharedKeyLite mindgotest:+32DTgsPUgXPo/O7RYaTs0DllA6FTXMj3uK4Qst8y/E=") -} - -func (a *AuthorizationSuite) Test_buildCanonicalizedResource(c *chk.C) { - cli, err := NewBasicClient("foo", "YmFy") - c.Assert(err, chk.IsNil) - - type test struct { - url string - auth authentication - expected string - } - tests := []test{ - // Shared Key - {"https://foo.blob.core.windows.net/path?a=b&c=d", sharedKey, "/foo/path\na:b\nc:d"}, - {"https://foo.blob.core.windows.net/?comp=list", sharedKey, "/foo/\ncomp:list"}, - {"https://foo.blob.core.windows.net/cnt/blob", sharedKey, "/foo/cnt/blob"}, - {"https://foo.blob.core.windows.net/cnt/bl ob", sharedKey, "/foo/cnt/bl%20ob"}, - {"https://foo.blob.core.windows.net/c nt/blob", sharedKey, "/foo/c%20nt/blob"}, - {"https://foo.blob.core.windows.net/cnt/blob%3F%23%5B%5D%21$&%27%28%29%2A blob", sharedKey, "/foo/cnt/blob%3F%23%5B%5D%21$&%27%28%29%2A%20blob"}, - {"https://foo.blob.core.windows.net/cnt/blob-._~:,@;+=blob", sharedKey, "/foo/cnt/blob-._~:,@;+=blob"}, - {"https://foo.blob.core.windows.net/c nt/blob-._~:%3F%23%5B%5D@%21$&%27%28%29%2A,;+=/blob", sharedKey, "/foo/c%20nt/blob-._~:%3F%23%5B%5D@%21$&%27%28%29%2A,;+=/blob"}, - // Shared Key Lite for Table - {"https://foo.table.core.windows.net/mytable", sharedKeyLiteForTable, "/foo/mytable"}, - {"https://foo.table.core.windows.net/mytable?comp=acl", sharedKeyLiteForTable, "/foo/mytable?comp=acl"}, - {"https://foo.table.core.windows.net/mytable?comp=acl&timeout=10", sharedKeyForTable, "/foo/mytable?comp=acl"}, - {"https://foo.table.core.windows.net/mytable(PartitionKey='pkey',RowKey='rowkey%3D')", sharedKeyForTable, "/foo/mytable(PartitionKey='pkey',RowKey='rowkey%3D')"}, - } - - for _, t := range tests { - out, err := cli.buildCanonicalizedResource(t.url, t.auth) - c.Assert(err, chk.IsNil) - c.Assert(out, chk.Equals, t.expected) - } -} - -func (a *AuthorizationSuite) Test_buildCanonicalizedString(c *chk.C) { - var tests = []struct { - verb string - headers map[string]string - canonicalizedResource string - auth authentication - out string - }{ - { - // Shared Key - verb: http.MethodGet, - headers: map[string]string{ - headerXmsDate: "Sun, 11 Oct 2009 21:49:13 GMT", - headerXmsVersion: "2009-09-19", - }, - canonicalizedResource: "/myaccount/ mycontainer\ncomp:metadata\nrestype:container\ntimeout:20", - auth: sharedKey, - out: "GET\n\n\n\n\n\n\n\n\n\n\n\nx-ms-date:Sun, 11 Oct 2009 21:49:13 GMT\nx-ms-version:2009-09-19\n/myaccount/ mycontainer\ncomp:metadata\nrestype:container\ntimeout:20", - }, - { - // Shared Key for Tables - verb: http.MethodPut, - headers: map[string]string{ - headerContentType: "text/plain; charset=UTF-8", - headerDate: "Sun, 11 Oct 2009 19:52:39 GMT", - }, - canonicalizedResource: "/testaccount1/Tables", - auth: sharedKeyForTable, - out: "PUT\n\ntext/plain; charset=UTF-8\nSun, 11 Oct 2009 19:52:39 GMT\n/testaccount1/Tables", - }, - { - // Shared Key Lite - verb: http.MethodPut, - headers: map[string]string{ - headerContentType: "text/plain; charset=UTF-8", - headerXmsDate: "Sun, 20 Sep 2009 20:36:40 GMT", - "x-ms-meta-m1": "v1", - "x-ms-meta-m2": "v2", - }, - canonicalizedResource: "/testaccount1/mycontainer/hello.txt", - auth: sharedKeyLite, - out: "PUT\n\ntext/plain; charset=UTF-8\n\nx-ms-date:Sun, 20 Sep 2009 20:36:40 GMT\nx-ms-meta-m1:v1\nx-ms-meta-m2:v2\n/testaccount1/mycontainer/hello.txt", - }, - { - // Shared Key Lite for Tables - verb: "", - headers: map[string]string{ - headerDate: "Sun, 11 Oct 2009 19:52:39 GMT", - }, - canonicalizedResource: "/testaccount1/Tables", - auth: sharedKeyLiteForTable, - out: "Sun, 11 Oct 2009 19:52:39 GMT\n/testaccount1/Tables", - }, - } - - for _, t := range tests { - canonicalizedString, err := buildCanonicalizedString(t.verb, t.headers, t.canonicalizedResource, t.auth) - c.Assert(err, chk.IsNil) - c.Assert(canonicalizedString, chk.Equals, t.out) - } -} - -func (a *AuthorizationSuite) Test_buildCanonicalizedHeader(c *chk.C) { - type test struct { - headers map[string]string - expected string - } - tests := []test{ - {map[string]string{}, - ""}, - {map[string]string{ - "x-ms-foo": "bar"}, - "x-ms-foo:bar"}, - {map[string]string{ - "foo:": "bar"}, - ""}, - {map[string]string{ - "foo:": "bar", - "x-ms-foo": "bar"}, - "x-ms-foo:bar"}, - {map[string]string{ - "x-ms-version": "9999-99-99", - "x-ms-blob-type": "BlockBlob"}, - "x-ms-blob-type:BlockBlob\nx-ms-version:9999-99-99"}} - - for _, i := range tests { - c.Assert(buildCanonicalizedHeader(i.headers), chk.Equals, i.expected) - } -} - -func (a *AuthorizationSuite) Test_createAuthorizationHeader(c *chk.C) { - cli, err := NewBasicClient("foo", base64.StdEncoding.EncodeToString([]byte("bar"))) - c.Assert(err, chk.IsNil) - - canonicalizedString := `foobarzoo` - - c.Assert(cli.createAuthorizationHeader(canonicalizedString, sharedKey), - chk.Equals, `SharedKey foo:h5U0ATVX6SpbFX1H6GNuxIMeXXCILLoIvhflPtuQZ30=`) - c.Assert(cli.createAuthorizationHeader(canonicalizedString, sharedKeyLite), - chk.Equals, `SharedKeyLite foo:h5U0ATVX6SpbFX1H6GNuxIMeXXCILLoIvhflPtuQZ30=`) -} - -func (a *AuthorizationSuite) Test_allSharedKeys(c *chk.C) { - cli := getBasicClient(c) - - blobCli := cli.GetBlobService() - tableCli := cli.GetTableService() - - cnt1 := randContainer() - cnt2 := randContainer() - - tn1 := AzureTable(randTable()) - tn2 := AzureTable(randTable()) - - // Shared Key - c.Assert(blobCli.auth, chk.Equals, sharedKey) - c.Assert(blobCli.CreateContainer(cnt1, ContainerAccessTypePrivate), chk.IsNil) - c.Assert(blobCli.DeleteContainer(cnt1), chk.IsNil) - - // Shared Key for Tables - c.Assert(tableCli.auth, chk.Equals, sharedKeyForTable) - c.Assert(tableCli.CreateTable(tn1), chk.IsNil) - c.Assert(tableCli.DeleteTable(tn1), chk.IsNil) - - // Change to Lite - cli.UseSharedKeyLite = true - blobCli = cli.GetBlobService() - tableCli = cli.GetTableService() - - // Shared Key Lite - c.Assert(blobCli.auth, chk.Equals, sharedKeyLite) - c.Assert(blobCli.CreateContainer(cnt2, ContainerAccessTypeBlob), chk.IsNil) - c.Assert(blobCli.DeleteContainer(cnt2), chk.IsNil) - - // Shared Key Lite for Tables - c.Assert(tableCli.auth, chk.Equals, sharedKeyLiteForTable) - c.Assert(tableCli.CreateTable(tn2), chk.IsNil) - c.Assert(tableCli.DeleteTable(tn2), chk.IsNil) -} diff --git a/storage/blob.go b/storage/blob.go deleted file mode 100644 index e33de1031754..000000000000 --- a/storage/blob.go +++ /dev/null @@ -1,1539 +0,0 @@ -package storage - -import ( - "bytes" - "encoding/xml" - "errors" - "fmt" - "io" - "net/http" - "net/url" - "strconv" - "strings" - "time" -) - -// BlobStorageClient contains operations for Microsoft Azure Blob Storage -// Service. -type BlobStorageClient struct { - client Client - auth authentication -} - -// A Container is an entry in ContainerListResponse. -type Container struct { - Name string `xml:"Name"` - Properties ContainerProperties `xml:"Properties"` - // TODO (ahmetalpbalkan) Metadata -} - -// ContainerProperties contains various properties of a container returned from -// various endpoints like ListContainers. -type ContainerProperties struct { - LastModified string `xml:"Last-Modified"` - Etag string `xml:"Etag"` - LeaseStatus string `xml:"LeaseStatus"` - LeaseState string `xml:"LeaseState"` - LeaseDuration string `xml:"LeaseDuration"` - // TODO (ahmetalpbalkan) remaining fields -} - -// ContainerListResponse contains the response fields from -// ListContainers call. -// -// See https://msdn.microsoft.com/en-us/library/azure/dd179352.aspx -type ContainerListResponse struct { - XMLName xml.Name `xml:"EnumerationResults"` - Xmlns string `xml:"xmlns,attr"` - Prefix string `xml:"Prefix"` - Marker string `xml:"Marker"` - NextMarker string `xml:"NextMarker"` - MaxResults int64 `xml:"MaxResults"` - Containers []Container `xml:"Containers>Container"` -} - -// A Blob is an entry in BlobListResponse. -type Blob struct { - Name string `xml:"Name"` - Properties BlobProperties `xml:"Properties"` - Metadata BlobMetadata `xml:"Metadata"` -} - -// BlobMetadata is a set of custom name/value pairs. -// -// See https://msdn.microsoft.com/en-us/library/azure/dd179404.aspx -type BlobMetadata map[string]string - -type blobMetadataEntries struct { - Entries []blobMetadataEntry `xml:",any"` -} -type blobMetadataEntry struct { - XMLName xml.Name - Value string `xml:",chardata"` -} - -// UnmarshalXML converts the xml:Metadata into Metadata map -func (bm *BlobMetadata) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error { - var entries blobMetadataEntries - if err := d.DecodeElement(&entries, &start); err != nil { - return err - } - for _, entry := range entries.Entries { - if *bm == nil { - *bm = make(BlobMetadata) - } - (*bm)[strings.ToLower(entry.XMLName.Local)] = entry.Value - } - return nil -} - -// MarshalXML implements the xml.Marshaler interface. It encodes -// metadata name/value pairs as they would appear in an Azure -// ListBlobs response. -func (bm BlobMetadata) MarshalXML(enc *xml.Encoder, start xml.StartElement) error { - entries := make([]blobMetadataEntry, 0, len(bm)) - for k, v := range bm { - entries = append(entries, blobMetadataEntry{ - XMLName: xml.Name{Local: http.CanonicalHeaderKey(k)}, - Value: v, - }) - } - return enc.EncodeElement(blobMetadataEntries{ - Entries: entries, - }, start) -} - -// BlobProperties contains various properties of a blob -// returned in various endpoints like ListBlobs or GetBlobProperties. -type BlobProperties struct { - LastModified string `xml:"Last-Modified"` - Etag string `xml:"Etag"` - ContentMD5 string `xml:"Content-MD5"` - ContentLength int64 `xml:"Content-Length"` - ContentType string `xml:"Content-Type"` - ContentEncoding string `xml:"Content-Encoding"` - CacheControl string `xml:"Cache-Control"` - ContentLanguage string `xml:"Cache-Language"` - BlobType BlobType `xml:"x-ms-blob-blob-type"` - SequenceNumber int64 `xml:"x-ms-blob-sequence-number"` - CopyID string `xml:"CopyId"` - CopyStatus string `xml:"CopyStatus"` - CopySource string `xml:"CopySource"` - CopyProgress string `xml:"CopyProgress"` - CopyCompletionTime string `xml:"CopyCompletionTime"` - CopyStatusDescription string `xml:"CopyStatusDescription"` - LeaseStatus string `xml:"LeaseStatus"` - LeaseState string `xml:"LeaseState"` -} - -// BlobHeaders contains various properties of a blob and is an entry -// in SetBlobProperties -type BlobHeaders struct { - ContentMD5 string `header:"x-ms-blob-content-md5"` - ContentLanguage string `header:"x-ms-blob-content-language"` - ContentEncoding string `header:"x-ms-blob-content-encoding"` - ContentType string `header:"x-ms-blob-content-type"` - CacheControl string `header:"x-ms-blob-cache-control"` -} - -// BlobListResponse contains the response fields from ListBlobs call. -// -// See https://msdn.microsoft.com/en-us/library/azure/dd135734.aspx -type BlobListResponse struct { - XMLName xml.Name `xml:"EnumerationResults"` - Xmlns string `xml:"xmlns,attr"` - Prefix string `xml:"Prefix"` - Marker string `xml:"Marker"` - NextMarker string `xml:"NextMarker"` - MaxResults int64 `xml:"MaxResults"` - Blobs []Blob `xml:"Blobs>Blob"` - - // BlobPrefix is used to traverse blobs as if it were a file system. - // It is returned if ListBlobsParameters.Delimiter is specified. - // The list here can be thought of as "folders" that may contain - // other folders or blobs. - BlobPrefixes []string `xml:"Blobs>BlobPrefix>Name"` - - // Delimiter is used to traverse blobs as if it were a file system. - // It is returned if ListBlobsParameters.Delimiter is specified. - Delimiter string `xml:"Delimiter"` -} - -// ListContainersParameters defines the set of customizable parameters to make a -// List Containers call. -// -// See https://msdn.microsoft.com/en-us/library/azure/dd179352.aspx -type ListContainersParameters struct { - Prefix string - Marker string - Include string - MaxResults uint - Timeout uint -} - -func (p ListContainersParameters) getParameters() url.Values { - out := url.Values{} - - if p.Prefix != "" { - out.Set("prefix", p.Prefix) - } - if p.Marker != "" { - out.Set("marker", p.Marker) - } - if p.Include != "" { - out.Set("include", p.Include) - } - if p.MaxResults != 0 { - out.Set("maxresults", fmt.Sprintf("%v", p.MaxResults)) - } - if p.Timeout != 0 { - out.Set("timeout", fmt.Sprintf("%v", p.Timeout)) - } - - return out -} - -// ListBlobsParameters defines the set of customizable -// parameters to make a List Blobs call. -// -// See https://msdn.microsoft.com/en-us/library/azure/dd135734.aspx -type ListBlobsParameters struct { - Prefix string - Delimiter string - Marker string - Include string - MaxResults uint - Timeout uint -} - -func (p ListBlobsParameters) getParameters() url.Values { - out := url.Values{} - - if p.Prefix != "" { - out.Set("prefix", p.Prefix) - } - if p.Delimiter != "" { - out.Set("delimiter", p.Delimiter) - } - if p.Marker != "" { - out.Set("marker", p.Marker) - } - if p.Include != "" { - out.Set("include", p.Include) - } - if p.MaxResults != 0 { - out.Set("maxresults", fmt.Sprintf("%v", p.MaxResults)) - } - if p.Timeout != 0 { - out.Set("timeout", fmt.Sprintf("%v", p.Timeout)) - } - - return out -} - -// BlobType defines the type of the Azure Blob. -type BlobType string - -// Types of page blobs -const ( - BlobTypeBlock BlobType = "BlockBlob" - BlobTypePage BlobType = "PageBlob" - BlobTypeAppend BlobType = "AppendBlob" -) - -// PageWriteType defines the type updates that are going to be -// done on the page blob. -type PageWriteType string - -// Types of operations on page blobs -const ( - PageWriteTypeUpdate PageWriteType = "update" - PageWriteTypeClear PageWriteType = "clear" -) - -const ( - blobCopyStatusPending = "pending" - blobCopyStatusSuccess = "success" - blobCopyStatusAborted = "aborted" - blobCopyStatusFailed = "failed" -) - -// lease constants. -const ( - leaseHeaderPrefix = "x-ms-lease-" - headerLeaseID = "x-ms-lease-id" - leaseAction = "x-ms-lease-action" - leaseBreakPeriod = "x-ms-lease-break-period" - leaseDuration = "x-ms-lease-duration" - leaseProposedID = "x-ms-proposed-lease-id" - leaseTime = "x-ms-lease-time" - - acquireLease = "acquire" - renewLease = "renew" - changeLease = "change" - releaseLease = "release" - breakLease = "break" -) - -// BlockListType is used to filter out types of blocks in a Get Blocks List call -// for a block blob. -// -// See https://msdn.microsoft.com/en-us/library/azure/dd179400.aspx for all -// block types. -type BlockListType string - -// Filters for listing blocks in block blobs -const ( - BlockListTypeAll BlockListType = "all" - BlockListTypeCommitted BlockListType = "committed" - BlockListTypeUncommitted BlockListType = "uncommitted" -) - -// ContainerAccessType defines the access level to the container from a public -// request. -// -// See https://msdn.microsoft.com/en-us/library/azure/dd179468.aspx and "x-ms- -// blob-public-access" header. -type ContainerAccessType string - -// Access options for containers -const ( - ContainerAccessTypePrivate ContainerAccessType = "" - ContainerAccessTypeBlob ContainerAccessType = "blob" - ContainerAccessTypeContainer ContainerAccessType = "container" -) - -// ContainerAccessPolicyDetails are used for SETTING container policies -type ContainerAccessPolicyDetails struct { - ID string - StartTime time.Time - ExpiryTime time.Time - CanRead bool - CanWrite bool - CanDelete bool -} - -// ContainerPermissions is used when setting permissions and Access Policies for containers. -type ContainerPermissions struct { - AccessType ContainerAccessType - AccessPolicies []ContainerAccessPolicyDetails -} - -// ContainerAccessHeader references header used when setting/getting container ACL -const ( - ContainerAccessHeader string = "x-ms-blob-public-access" -) - -// Maximum sizes (per REST API) for various concepts -const ( - MaxBlobBlockSize = 4 * 1024 * 1024 - MaxBlobPageSize = 4 * 1024 * 1024 -) - -// BlockStatus defines states a block for a block blob can -// be in. -type BlockStatus string - -// List of statuses that can be used to refer to a block in a block list -const ( - BlockStatusUncommitted BlockStatus = "Uncommitted" - BlockStatusCommitted BlockStatus = "Committed" - BlockStatusLatest BlockStatus = "Latest" -) - -// Block is used to create Block entities for Put Block List -// call. -type Block struct { - ID string - Status BlockStatus -} - -// BlockListResponse contains the response fields from Get Block List call. -// -// See https://msdn.microsoft.com/en-us/library/azure/dd179400.aspx -type BlockListResponse struct { - XMLName xml.Name `xml:"BlockList"` - CommittedBlocks []BlockResponse `xml:"CommittedBlocks>Block"` - UncommittedBlocks []BlockResponse `xml:"UncommittedBlocks>Block"` -} - -// BlockResponse contains the block information returned -// in the GetBlockListCall. -type BlockResponse struct { - Name string `xml:"Name"` - Size int64 `xml:"Size"` -} - -// GetPageRangesResponse contains the response fields from -// Get Page Ranges call. -// -// See https://msdn.microsoft.com/en-us/library/azure/ee691973.aspx -type GetPageRangesResponse struct { - XMLName xml.Name `xml:"PageList"` - PageList []PageRange `xml:"PageRange"` -} - -// PageRange contains information about a page of a page blob from -// Get Pages Range call. -// -// See https://msdn.microsoft.com/en-us/library/azure/ee691973.aspx -type PageRange struct { - Start int64 `xml:"Start"` - End int64 `xml:"End"` -} - -var ( - errBlobCopyAborted = errors.New("storage: blob copy is aborted") - errBlobCopyIDMismatch = errors.New("storage: blob copy id is a mismatch") -) - -// ListContainers returns the list of containers in a storage account along with -// pagination token and other response details. -// -// See https://msdn.microsoft.com/en-us/library/azure/dd179352.aspx -func (b BlobStorageClient) ListContainers(params ListContainersParameters) (ContainerListResponse, error) { - q := mergeParams(params.getParameters(), url.Values{"comp": {"list"}}) - uri := b.client.getEndpoint(blobServiceName, "", q) - headers := b.client.getStandardHeaders() - - var out ContainerListResponse - resp, err := b.client.exec(http.MethodGet, uri, headers, nil, b.auth) - if err != nil { - return out, err - } - defer resp.body.Close() - - err = xmlUnmarshal(resp.body, &out) - return out, err -} - -// CreateContainer creates a blob container within the storage account -// with given name and access level. Returns error if container already exists. -// -// See https://msdn.microsoft.com/en-us/library/azure/dd179468.aspx -func (b BlobStorageClient) CreateContainer(name string, access ContainerAccessType) error { - resp, err := b.createContainer(name, access) - if err != nil { - return err - } - defer resp.body.Close() - return checkRespCode(resp.statusCode, []int{http.StatusCreated}) -} - -// CreateContainerIfNotExists creates a blob container if it does not exist. Returns -// true if container is newly created or false if container already exists. -func (b BlobStorageClient) CreateContainerIfNotExists(name string, access ContainerAccessType) (bool, error) { - resp, err := b.createContainer(name, access) - if resp != nil { - defer resp.body.Close() - if resp.statusCode == http.StatusCreated || resp.statusCode == http.StatusConflict { - return resp.statusCode == http.StatusCreated, nil - } - } - return false, err -} - -func (b BlobStorageClient) createContainer(name string, access ContainerAccessType) (*storageResponse, error) { - uri := b.client.getEndpoint(blobServiceName, pathForContainer(name), url.Values{"restype": {"container"}}) - - headers := b.client.getStandardHeaders() - if access != "" { - headers[ContainerAccessHeader] = string(access) - } - return b.client.exec(http.MethodPut, uri, headers, nil, b.auth) -} - -// ContainerExists returns true if a container with given name exists -// on the storage account, otherwise returns false. -func (b BlobStorageClient) ContainerExists(name string) (bool, error) { - uri := b.client.getEndpoint(blobServiceName, pathForContainer(name), url.Values{"restype": {"container"}}) - headers := b.client.getStandardHeaders() - - resp, err := b.client.exec(http.MethodHead, uri, headers, nil, b.auth) - if resp != nil { - defer resp.body.Close() - if resp.statusCode == http.StatusOK || resp.statusCode == http.StatusNotFound { - return resp.statusCode == http.StatusOK, nil - } - } - return false, err -} - -// SetContainerPermissions sets up container permissions as per https://msdn.microsoft.com/en-us/library/azure/dd179391.aspx -func (b BlobStorageClient) SetContainerPermissions(container string, containerPermissions ContainerPermissions, timeout int, leaseID string) (err error) { - params := url.Values{ - "restype": {"container"}, - "comp": {"acl"}, - } - - if timeout > 0 { - params.Add("timeout", strconv.Itoa(timeout)) - } - - uri := b.client.getEndpoint(blobServiceName, pathForContainer(container), params) - headers := b.client.getStandardHeaders() - if containerPermissions.AccessType != "" { - headers[ContainerAccessHeader] = string(containerPermissions.AccessType) - } - - if leaseID != "" { - headers[headerLeaseID] = leaseID - } - - body, length, err := generateContainerACLpayload(containerPermissions.AccessPolicies) - headers["Content-Length"] = strconv.Itoa(length) - resp, err := b.client.exec(http.MethodPut, uri, headers, body, b.auth) - - if err != nil { - return err - } - - if resp != nil { - defer resp.body.Close() - - if resp.statusCode != http.StatusOK { - return errors.New("Unable to set permissions") - } - } - return nil -} - -// GetContainerPermissions gets the container permissions as per https://msdn.microsoft.com/en-us/library/azure/dd179469.aspx -// If timeout is 0 then it will not be passed to Azure -// leaseID will only be passed to Azure if populated -// Returns permissionResponse which is combined permissions and AccessPolicy -func (b BlobStorageClient) GetContainerPermissions(container string, timeout int, leaseID string) (*ContainerPermissions, error) { - params := url.Values{"restype": {"container"}, - "comp": {"acl"}} - - if timeout > 0 { - params.Add("timeout", strconv.Itoa(timeout)) - } - - uri := b.client.getEndpoint(blobServiceName, pathForContainer(container), params) - headers := b.client.getStandardHeaders() - - if leaseID != "" { - headers[headerLeaseID] = leaseID - } - - resp, err := b.client.exec(http.MethodGet, uri, headers, nil, b.auth) - if err != nil { - return nil, err - } - defer resp.body.Close() - - var out AccessPolicy - err = xmlUnmarshal(resp.body, &out.SignedIdentifiersList) - if err != nil { - return nil, err - } - - permissionResponse := updateContainerAccessPolicy(out, &resp.headers) - return &permissionResponse, nil -} - -func updateContainerAccessPolicy(ap AccessPolicy, headers *http.Header) ContainerPermissions { - // containerAccess. Blob, Container, empty - containerAccess := headers.Get(http.CanonicalHeaderKey(ContainerAccessHeader)) - - var cp ContainerPermissions - cp.AccessType = ContainerAccessType(containerAccess) - for _, policy := range ap.SignedIdentifiersList.SignedIdentifiers { - capd := ContainerAccessPolicyDetails{ - ID: policy.ID, - StartTime: policy.AccessPolicy.StartTime, - ExpiryTime: policy.AccessPolicy.ExpiryTime, - } - capd.CanRead = updatePermissions(policy.AccessPolicy.Permission, "r") - capd.CanWrite = updatePermissions(policy.AccessPolicy.Permission, "w") - capd.CanDelete = updatePermissions(policy.AccessPolicy.Permission, "d") - - cp.AccessPolicies = append(cp.AccessPolicies, capd) - } - - return cp -} - -// DeleteContainer deletes the container with given name on the storage -// account. If the container does not exist returns error. -// -// See https://msdn.microsoft.com/en-us/library/azure/dd179408.aspx -func (b BlobStorageClient) DeleteContainer(name string) error { - resp, err := b.deleteContainer(name) - if err != nil { - return err - } - defer resp.body.Close() - return checkRespCode(resp.statusCode, []int{http.StatusAccepted}) -} - -// DeleteContainerIfExists deletes the container with given name on the storage -// account if it exists. Returns true if container is deleted with this call, or -// false if the container did not exist at the time of the Delete Container -// operation. -// -// See https://msdn.microsoft.com/en-us/library/azure/dd179408.aspx -func (b BlobStorageClient) DeleteContainerIfExists(name string) (bool, error) { - resp, err := b.deleteContainer(name) - if resp != nil { - defer resp.body.Close() - if resp.statusCode == http.StatusAccepted || resp.statusCode == http.StatusNotFound { - return resp.statusCode == http.StatusAccepted, nil - } - } - return false, err -} - -func (b BlobStorageClient) deleteContainer(name string) (*storageResponse, error) { - uri := b.client.getEndpoint(blobServiceName, pathForContainer(name), url.Values{"restype": {"container"}}) - - headers := b.client.getStandardHeaders() - return b.client.exec(http.MethodDelete, uri, headers, nil, b.auth) -} - -// ListBlobs returns an object that contains list of blobs in the container, -// pagination token and other information in the response of List Blobs call. -// -// See https://msdn.microsoft.com/en-us/library/azure/dd135734.aspx -func (b BlobStorageClient) ListBlobs(container string, params ListBlobsParameters) (BlobListResponse, error) { - q := mergeParams(params.getParameters(), url.Values{ - "restype": {"container"}, - "comp": {"list"}}) - uri := b.client.getEndpoint(blobServiceName, pathForContainer(container), q) - headers := b.client.getStandardHeaders() - - var out BlobListResponse - resp, err := b.client.exec(http.MethodGet, uri, headers, nil, b.auth) - if err != nil { - return out, err - } - defer resp.body.Close() - - err = xmlUnmarshal(resp.body, &out) - return out, err -} - -// BlobExists returns true if a blob with given name exists on the specified -// container of the storage account. -func (b BlobStorageClient) BlobExists(container, name string) (bool, error) { - uri := b.client.getEndpoint(blobServiceName, pathForBlob(container, name), url.Values{}) - headers := b.client.getStandardHeaders() - resp, err := b.client.exec(http.MethodHead, uri, headers, nil, b.auth) - if resp != nil { - defer resp.body.Close() - if resp.statusCode == http.StatusOK || resp.statusCode == http.StatusNotFound { - return resp.statusCode == http.StatusOK, nil - } - } - return false, err -} - -// GetBlobURL gets the canonical URL to the blob with the specified name in the -// specified container. This method does not create a publicly accessible URL if -// the blob or container is private and this method does not check if the blob -// exists. -func (b BlobStorageClient) GetBlobURL(container, name string) string { - if container == "" { - container = "$root" - } - return b.client.getEndpoint(blobServiceName, pathForBlob(container, name), url.Values{}) -} - -// GetBlob returns a stream to read the blob. Caller must call Close() the -// reader to close on the underlying connection. -// -// See https://msdn.microsoft.com/en-us/library/azure/dd179440.aspx -func (b BlobStorageClient) GetBlob(container, name string) (io.ReadCloser, error) { - resp, err := b.getBlobRange(container, name, "", nil) - if err != nil { - return nil, err - } - - if err := checkRespCode(resp.statusCode, []int{http.StatusOK}); err != nil { - return nil, err - } - return resp.body, nil -} - -// GetBlobRange reads the specified range of a blob to a stream. The bytesRange -// string must be in a format like "0-", "10-100" as defined in HTTP 1.1 spec. -// -// See https://msdn.microsoft.com/en-us/library/azure/dd179440.aspx -func (b BlobStorageClient) GetBlobRange(container, name, bytesRange string, extraHeaders map[string]string) (io.ReadCloser, error) { - resp, err := b.getBlobRange(container, name, bytesRange, extraHeaders) - if err != nil { - return nil, err - } - - if err := checkRespCode(resp.statusCode, []int{http.StatusPartialContent}); err != nil { - return nil, err - } - return resp.body, nil -} - -func (b BlobStorageClient) getBlobRange(container, name, bytesRange string, extraHeaders map[string]string) (*storageResponse, error) { - uri := b.client.getEndpoint(blobServiceName, pathForBlob(container, name), url.Values{}) - - extraHeaders = b.client.protectUserAgent(extraHeaders) - headers := b.client.getStandardHeaders() - if bytesRange != "" { - headers["Range"] = fmt.Sprintf("bytes=%s", bytesRange) - } - - for k, v := range extraHeaders { - headers[k] = v - } - - resp, err := b.client.exec(http.MethodGet, uri, headers, nil, b.auth) - if err != nil { - return nil, err - } - return resp, err -} - -// leasePut is common PUT code for the various acquire/release/break etc functions. -func (b BlobStorageClient) leaseCommonPut(container string, name string, headers map[string]string, expectedStatus int) (http.Header, error) { - params := url.Values{"comp": {"lease"}} - uri := b.client.getEndpoint(blobServiceName, pathForBlob(container, name), params) - - resp, err := b.client.exec(http.MethodPut, uri, headers, nil, b.auth) - if err != nil { - return nil, err - } - defer resp.body.Close() - - if err := checkRespCode(resp.statusCode, []int{expectedStatus}); err != nil { - return nil, err - } - - return resp.headers, nil -} - -// SnapshotBlob creates a snapshot for a blob as per https://msdn.microsoft.com/en-us/library/azure/ee691971.aspx -func (b BlobStorageClient) SnapshotBlob(container string, name string, timeout int, extraHeaders map[string]string) (snapshotTimestamp *time.Time, err error) { - extraHeaders = b.client.protectUserAgent(extraHeaders) - headers := b.client.getStandardHeaders() - params := url.Values{"comp": {"snapshot"}} - - if timeout > 0 { - params.Add("timeout", strconv.Itoa(timeout)) - } - - for k, v := range extraHeaders { - headers[k] = v - } - - uri := b.client.getEndpoint(blobServiceName, pathForBlob(container, name), params) - resp, err := b.client.exec(http.MethodPut, uri, headers, nil, b.auth) - if err != nil { - return nil, err - } - - if err := checkRespCode(resp.statusCode, []int{http.StatusCreated}); err != nil { - return nil, err - } - - snapshotResponse := resp.headers.Get(http.CanonicalHeaderKey("x-ms-snapshot")) - if snapshotResponse != "" { - snapshotTimestamp, err := time.Parse(time.RFC3339, snapshotResponse) - if err != nil { - return nil, err - } - - return &snapshotTimestamp, nil - } - - return nil, errors.New("Snapshot not created") -} - -// AcquireLease creates a lease for a blob as per https://msdn.microsoft.com/en-us/library/azure/ee691972.aspx -// returns leaseID acquired -func (b BlobStorageClient) AcquireLease(container string, name string, leaseTimeInSeconds int, proposedLeaseID string) (returnedLeaseID string, err error) { - headers := b.client.getStandardHeaders() - headers[leaseAction] = acquireLease - - if leaseTimeInSeconds > 0 { - headers[leaseDuration] = strconv.Itoa(leaseTimeInSeconds) - } - - if proposedLeaseID != "" { - headers[leaseProposedID] = proposedLeaseID - } - - respHeaders, err := b.leaseCommonPut(container, name, headers, http.StatusCreated) - if err != nil { - return "", err - } - - returnedLeaseID = respHeaders.Get(http.CanonicalHeaderKey(headerLeaseID)) - - if returnedLeaseID != "" { - return returnedLeaseID, nil - } - - return "", errors.New("LeaseID not returned") -} - -// BreakLease breaks the lease for a blob as per https://msdn.microsoft.com/en-us/library/azure/ee691972.aspx -// Returns the timeout remaining in the lease in seconds -func (b BlobStorageClient) BreakLease(container string, name string) (breakTimeout int, err error) { - headers := b.client.getStandardHeaders() - headers[leaseAction] = breakLease - return b.breakLeaseCommon(container, name, headers) -} - -// BreakLeaseWithBreakPeriod breaks the lease for a blob as per https://msdn.microsoft.com/en-us/library/azure/ee691972.aspx -// breakPeriodInSeconds is used to determine how long until new lease can be created. -// Returns the timeout remaining in the lease in seconds -func (b BlobStorageClient) BreakLeaseWithBreakPeriod(container string, name string, breakPeriodInSeconds int) (breakTimeout int, err error) { - headers := b.client.getStandardHeaders() - headers[leaseAction] = breakLease - headers[leaseBreakPeriod] = strconv.Itoa(breakPeriodInSeconds) - return b.breakLeaseCommon(container, name, headers) -} - -// breakLeaseCommon is common code for both version of BreakLease (with and without break period) -func (b BlobStorageClient) breakLeaseCommon(container string, name string, headers map[string]string) (breakTimeout int, err error) { - - respHeaders, err := b.leaseCommonPut(container, name, headers, http.StatusAccepted) - if err != nil { - return 0, err - } - - breakTimeoutStr := respHeaders.Get(http.CanonicalHeaderKey(leaseTime)) - if breakTimeoutStr != "" { - breakTimeout, err = strconv.Atoi(breakTimeoutStr) - if err != nil { - return 0, err - } - } - - return breakTimeout, nil -} - -// ChangeLease changes a lease ID for a blob as per https://msdn.microsoft.com/en-us/library/azure/ee691972.aspx -// Returns the new LeaseID acquired -func (b BlobStorageClient) ChangeLease(container string, name string, currentLeaseID string, proposedLeaseID string) (newLeaseID string, err error) { - headers := b.client.getStandardHeaders() - headers[leaseAction] = changeLease - headers[headerLeaseID] = currentLeaseID - headers[leaseProposedID] = proposedLeaseID - - respHeaders, err := b.leaseCommonPut(container, name, headers, http.StatusOK) - if err != nil { - return "", err - } - - newLeaseID = respHeaders.Get(http.CanonicalHeaderKey(headerLeaseID)) - if newLeaseID != "" { - return newLeaseID, nil - } - - return "", errors.New("LeaseID not returned") -} - -// ReleaseLease releases the lease for a blob as per https://msdn.microsoft.com/en-us/library/azure/ee691972.aspx -func (b BlobStorageClient) ReleaseLease(container string, name string, currentLeaseID string) error { - headers := b.client.getStandardHeaders() - headers[leaseAction] = releaseLease - headers[headerLeaseID] = currentLeaseID - - _, err := b.leaseCommonPut(container, name, headers, http.StatusOK) - if err != nil { - return err - } - - return nil -} - -// RenewLease renews the lease for a blob as per https://msdn.microsoft.com/en-us/library/azure/ee691972.aspx -func (b BlobStorageClient) RenewLease(container string, name string, currentLeaseID string) error { - headers := b.client.getStandardHeaders() - headers[leaseAction] = renewLease - headers[headerLeaseID] = currentLeaseID - - _, err := b.leaseCommonPut(container, name, headers, http.StatusOK) - if err != nil { - return err - } - - return nil -} - -// GetBlobProperties provides various information about the specified -// blob. See https://msdn.microsoft.com/en-us/library/azure/dd179394.aspx -func (b BlobStorageClient) GetBlobProperties(container, name string) (*BlobProperties, error) { - uri := b.client.getEndpoint(blobServiceName, pathForBlob(container, name), url.Values{}) - - headers := b.client.getStandardHeaders() - resp, err := b.client.exec(http.MethodHead, uri, headers, nil, b.auth) - if err != nil { - return nil, err - } - defer resp.body.Close() - - if err = checkRespCode(resp.statusCode, []int{http.StatusOK}); err != nil { - return nil, err - } - - var contentLength int64 - contentLengthStr := resp.headers.Get("Content-Length") - if contentLengthStr != "" { - contentLength, err = strconv.ParseInt(contentLengthStr, 0, 64) - if err != nil { - return nil, err - } - } - - var sequenceNum int64 - sequenceNumStr := resp.headers.Get("x-ms-blob-sequence-number") - if sequenceNumStr != "" { - sequenceNum, err = strconv.ParseInt(sequenceNumStr, 0, 64) - if err != nil { - return nil, err - } - } - - return &BlobProperties{ - LastModified: resp.headers.Get("Last-Modified"), - Etag: resp.headers.Get("Etag"), - ContentMD5: resp.headers.Get("Content-MD5"), - ContentLength: contentLength, - ContentEncoding: resp.headers.Get("Content-Encoding"), - ContentType: resp.headers.Get("Content-Type"), - CacheControl: resp.headers.Get("Cache-Control"), - ContentLanguage: resp.headers.Get("Content-Language"), - SequenceNumber: sequenceNum, - CopyCompletionTime: resp.headers.Get("x-ms-copy-completion-time"), - CopyStatusDescription: resp.headers.Get("x-ms-copy-status-description"), - CopyID: resp.headers.Get("x-ms-copy-id"), - CopyProgress: resp.headers.Get("x-ms-copy-progress"), - CopySource: resp.headers.Get("x-ms-copy-source"), - CopyStatus: resp.headers.Get("x-ms-copy-status"), - BlobType: BlobType(resp.headers.Get("x-ms-blob-type")), - LeaseStatus: resp.headers.Get("x-ms-lease-status"), - LeaseState: resp.headers.Get("x-ms-lease-state"), - }, nil -} - -// SetBlobProperties replaces the BlobHeaders for the specified blob. -// -// Some keys may be converted to Camel-Case before sending. All keys -// are returned in lower case by GetBlobProperties. HTTP header names -// are case-insensitive so case munging should not matter to other -// applications either. -// -// See https://msdn.microsoft.com/en-us/library/azure/ee691966.aspx -func (b BlobStorageClient) SetBlobProperties(container, name string, blobHeaders BlobHeaders) error { - params := url.Values{"comp": {"properties"}} - uri := b.client.getEndpoint(blobServiceName, pathForBlob(container, name), params) - headers := b.client.getStandardHeaders() - - extraHeaders := headersFromStruct(blobHeaders) - - for k, v := range extraHeaders { - headers[k] = v - } - - resp, err := b.client.exec(http.MethodPut, uri, headers, nil, b.auth) - if err != nil { - return err - } - defer resp.body.Close() - - return checkRespCode(resp.statusCode, []int{http.StatusOK}) -} - -// SetBlobMetadata replaces the metadata for the specified blob. -// -// Some keys may be converted to Camel-Case before sending. All keys -// are returned in lower case by GetBlobMetadata. HTTP header names -// are case-insensitive so case munging should not matter to other -// applications either. -// -// See https://msdn.microsoft.com/en-us/library/azure/dd179414.aspx -func (b BlobStorageClient) SetBlobMetadata(container, name string, metadata map[string]string, extraHeaders map[string]string) error { - params := url.Values{"comp": {"metadata"}} - uri := b.client.getEndpoint(blobServiceName, pathForBlob(container, name), params) - metadata = b.client.protectUserAgent(metadata) - extraHeaders = b.client.protectUserAgent(extraHeaders) - headers := b.client.getStandardHeaders() - for k, v := range metadata { - headers[userDefinedMetadataHeaderPrefix+k] = v - } - - for k, v := range extraHeaders { - headers[k] = v - } - - resp, err := b.client.exec(http.MethodPut, uri, headers, nil, b.auth) - if err != nil { - return err - } - defer resp.body.Close() - - return checkRespCode(resp.statusCode, []int{http.StatusOK}) -} - -// GetBlobMetadata returns all user-defined metadata for the specified blob. -// -// All metadata keys will be returned in lower case. (HTTP header -// names are case-insensitive.) -// -// See https://msdn.microsoft.com/en-us/library/azure/dd179414.aspx -func (b BlobStorageClient) GetBlobMetadata(container, name string) (map[string]string, error) { - params := url.Values{"comp": {"metadata"}} - uri := b.client.getEndpoint(blobServiceName, pathForBlob(container, name), params) - headers := b.client.getStandardHeaders() - - resp, err := b.client.exec(http.MethodGet, uri, headers, nil, b.auth) - if err != nil { - return nil, err - } - defer resp.body.Close() - - if err := checkRespCode(resp.statusCode, []int{http.StatusOK}); err != nil { - return nil, err - } - - metadata := make(map[string]string) - for k, v := range resp.headers { - // Can't trust CanonicalHeaderKey() to munge case - // reliably. "_" is allowed in identifiers: - // https://msdn.microsoft.com/en-us/library/azure/dd179414.aspx - // https://msdn.microsoft.com/library/aa664670(VS.71).aspx - // http://tools.ietf.org/html/rfc7230#section-3.2 - // ...but "_" is considered invalid by - // CanonicalMIMEHeaderKey in - // https://golang.org/src/net/textproto/reader.go?s=14615:14659#L542 - // so k can be "X-Ms-Meta-Foo" or "x-ms-meta-foo_bar". - k = strings.ToLower(k) - if len(v) == 0 || !strings.HasPrefix(k, strings.ToLower(userDefinedMetadataHeaderPrefix)) { - continue - } - // metadata["foo"] = content of the last X-Ms-Meta-Foo header - k = k[len(userDefinedMetadataHeaderPrefix):] - metadata[k] = v[len(v)-1] - } - return metadata, nil -} - -// CreateBlockBlob initializes an empty block blob with no blocks. -// -// See https://msdn.microsoft.com/en-us/library/azure/dd179451.aspx -func (b BlobStorageClient) CreateBlockBlob(container, name string) error { - return b.CreateBlockBlobFromReader(container, name, 0, nil, nil) -} - -// CreateBlockBlobFromReader initializes a block blob using data from -// reader. Size must be the number of bytes read from reader. To -// create an empty blob, use size==0 and reader==nil. -// -// The API rejects requests with size > 64 MiB (but this limit is not -// checked by the SDK). To write a larger blob, use CreateBlockBlob, -// PutBlock, and PutBlockList. -// -// See https://msdn.microsoft.com/en-us/library/azure/dd179451.aspx -func (b BlobStorageClient) CreateBlockBlobFromReader(container, name string, size uint64, blob io.Reader, extraHeaders map[string]string) error { - path := fmt.Sprintf("%s/%s", container, name) - uri := b.client.getEndpoint(blobServiceName, path, url.Values{}) - extraHeaders = b.client.protectUserAgent(extraHeaders) - headers := b.client.getStandardHeaders() - headers["x-ms-blob-type"] = string(BlobTypeBlock) - headers["Content-Length"] = fmt.Sprintf("%d", size) - - for k, v := range extraHeaders { - headers[k] = v - } - - resp, err := b.client.exec(http.MethodPut, uri, headers, blob, b.auth) - if err != nil { - return err - } - defer resp.body.Close() - return checkRespCode(resp.statusCode, []int{http.StatusCreated}) -} - -// PutBlock saves the given data chunk to the specified block blob with -// given ID. -// -// The API rejects chunks larger than 4 MiB (but this limit is not -// checked by the SDK). -// -// See https://msdn.microsoft.com/en-us/library/azure/dd135726.aspx -func (b BlobStorageClient) PutBlock(container, name, blockID string, chunk []byte) error { - return b.PutBlockWithLength(container, name, blockID, uint64(len(chunk)), bytes.NewReader(chunk), nil) -} - -// PutBlockWithLength saves the given data stream of exactly specified size to -// the block blob with given ID. It is an alternative to PutBlocks where data -// comes as stream but the length is known in advance. -// -// The API rejects requests with size > 4 MiB (but this limit is not -// checked by the SDK). -// -// See https://msdn.microsoft.com/en-us/library/azure/dd135726.aspx -func (b BlobStorageClient) PutBlockWithLength(container, name, blockID string, size uint64, blob io.Reader, extraHeaders map[string]string) error { - uri := b.client.getEndpoint(blobServiceName, pathForBlob(container, name), url.Values{"comp": {"block"}, "blockid": {blockID}}) - extraHeaders = b.client.protectUserAgent(extraHeaders) - headers := b.client.getStandardHeaders() - headers["x-ms-blob-type"] = string(BlobTypeBlock) - headers["Content-Length"] = fmt.Sprintf("%v", size) - - for k, v := range extraHeaders { - headers[k] = v - } - - resp, err := b.client.exec(http.MethodPut, uri, headers, blob, b.auth) - if err != nil { - return err - } - - defer resp.body.Close() - return checkRespCode(resp.statusCode, []int{http.StatusCreated}) -} - -// PutBlockList saves list of blocks to the specified block blob. -// -// See https://msdn.microsoft.com/en-us/library/azure/dd179467.aspx -func (b BlobStorageClient) PutBlockList(container, name string, blocks []Block) error { - blockListXML := prepareBlockListRequest(blocks) - - uri := b.client.getEndpoint(blobServiceName, pathForBlob(container, name), url.Values{"comp": {"blocklist"}}) - headers := b.client.getStandardHeaders() - headers["Content-Length"] = fmt.Sprintf("%v", len(blockListXML)) - - resp, err := b.client.exec(http.MethodPut, uri, headers, strings.NewReader(blockListXML), b.auth) - if err != nil { - return err - } - defer resp.body.Close() - return checkRespCode(resp.statusCode, []int{http.StatusCreated}) -} - -// GetBlockList retrieves list of blocks in the specified block blob. -// -// See https://msdn.microsoft.com/en-us/library/azure/dd179400.aspx -func (b BlobStorageClient) GetBlockList(container, name string, blockType BlockListType) (BlockListResponse, error) { - params := url.Values{"comp": {"blocklist"}, "blocklisttype": {string(blockType)}} - uri := b.client.getEndpoint(blobServiceName, pathForBlob(container, name), params) - headers := b.client.getStandardHeaders() - - var out BlockListResponse - resp, err := b.client.exec(http.MethodGet, uri, headers, nil, b.auth) - if err != nil { - return out, err - } - defer resp.body.Close() - - err = xmlUnmarshal(resp.body, &out) - return out, err -} - -// PutPageBlob initializes an empty page blob with specified name and maximum -// size in bytes (size must be aligned to a 512-byte boundary). A page blob must -// be created using this method before writing pages. -// -// See https://msdn.microsoft.com/en-us/library/azure/dd179451.aspx -func (b BlobStorageClient) PutPageBlob(container, name string, size int64, extraHeaders map[string]string) error { - path := fmt.Sprintf("%s/%s", container, name) - uri := b.client.getEndpoint(blobServiceName, path, url.Values{}) - extraHeaders = b.client.protectUserAgent(extraHeaders) - headers := b.client.getStandardHeaders() - headers["x-ms-blob-type"] = string(BlobTypePage) - headers["x-ms-blob-content-length"] = fmt.Sprintf("%v", size) - - for k, v := range extraHeaders { - headers[k] = v - } - - resp, err := b.client.exec(http.MethodPut, uri, headers, nil, b.auth) - if err != nil { - return err - } - defer resp.body.Close() - - return checkRespCode(resp.statusCode, []int{http.StatusCreated}) -} - -// PutPage writes a range of pages to a page blob or clears the given range. -// In case of 'clear' writes, given chunk is discarded. Ranges must be aligned -// with 512-byte boundaries and chunk must be of size multiplies by 512. -// -// See https://msdn.microsoft.com/en-us/library/ee691975.aspx -func (b BlobStorageClient) PutPage(container, name string, startByte, endByte int64, writeType PageWriteType, chunk []byte, extraHeaders map[string]string) error { - path := fmt.Sprintf("%s/%s", container, name) - uri := b.client.getEndpoint(blobServiceName, path, url.Values{"comp": {"page"}}) - extraHeaders = b.client.protectUserAgent(extraHeaders) - headers := b.client.getStandardHeaders() - headers["x-ms-blob-type"] = string(BlobTypePage) - headers["x-ms-page-write"] = string(writeType) - headers["x-ms-range"] = fmt.Sprintf("bytes=%v-%v", startByte, endByte) - for k, v := range extraHeaders { - headers[k] = v - } - var contentLength int64 - var data io.Reader - if writeType == PageWriteTypeClear { - contentLength = 0 - data = bytes.NewReader([]byte{}) - } else { - contentLength = int64(len(chunk)) - data = bytes.NewReader(chunk) - } - headers["Content-Length"] = fmt.Sprintf("%v", contentLength) - - resp, err := b.client.exec(http.MethodPut, uri, headers, data, b.auth) - if err != nil { - return err - } - defer resp.body.Close() - - return checkRespCode(resp.statusCode, []int{http.StatusCreated}) -} - -// GetPageRanges returns the list of valid page ranges for a page blob. -// -// See https://msdn.microsoft.com/en-us/library/azure/ee691973.aspx -func (b BlobStorageClient) GetPageRanges(container, name string) (GetPageRangesResponse, error) { - path := fmt.Sprintf("%s/%s", container, name) - uri := b.client.getEndpoint(blobServiceName, path, url.Values{"comp": {"pagelist"}}) - headers := b.client.getStandardHeaders() - - var out GetPageRangesResponse - resp, err := b.client.exec(http.MethodGet, uri, headers, nil, b.auth) - if err != nil { - return out, err - } - defer resp.body.Close() - - if err = checkRespCode(resp.statusCode, []int{http.StatusOK}); err != nil { - return out, err - } - err = xmlUnmarshal(resp.body, &out) - return out, err -} - -// PutAppendBlob initializes an empty append blob with specified name. An -// append blob must be created using this method before appending blocks. -// -// See https://msdn.microsoft.com/en-us/library/azure/dd179451.aspx -func (b BlobStorageClient) PutAppendBlob(container, name string, extraHeaders map[string]string) error { - path := fmt.Sprintf("%s/%s", container, name) - uri := b.client.getEndpoint(blobServiceName, path, url.Values{}) - extraHeaders = b.client.protectUserAgent(extraHeaders) - headers := b.client.getStandardHeaders() - headers["x-ms-blob-type"] = string(BlobTypeAppend) - - for k, v := range extraHeaders { - headers[k] = v - } - - resp, err := b.client.exec(http.MethodPut, uri, headers, nil, b.auth) - if err != nil { - return err - } - defer resp.body.Close() - - return checkRespCode(resp.statusCode, []int{http.StatusCreated}) -} - -// AppendBlock appends a block to an append blob. -// -// See https://msdn.microsoft.com/en-us/library/azure/mt427365.aspx -func (b BlobStorageClient) AppendBlock(container, name string, chunk []byte, extraHeaders map[string]string) error { - path := fmt.Sprintf("%s/%s", container, name) - uri := b.client.getEndpoint(blobServiceName, path, url.Values{"comp": {"appendblock"}}) - extraHeaders = b.client.protectUserAgent(extraHeaders) - headers := b.client.getStandardHeaders() - headers["x-ms-blob-type"] = string(BlobTypeAppend) - headers["Content-Length"] = fmt.Sprintf("%v", len(chunk)) - - for k, v := range extraHeaders { - headers[k] = v - } - - resp, err := b.client.exec(http.MethodPut, uri, headers, bytes.NewReader(chunk), b.auth) - if err != nil { - return err - } - defer resp.body.Close() - - return checkRespCode(resp.statusCode, []int{http.StatusCreated}) -} - -// CopyBlob starts a blob copy operation and waits for the operation to -// complete. sourceBlob parameter must be a canonical URL to the blob (can be -// obtained using GetBlobURL method.) There is no SLA on blob copy and therefore -// this helper method works faster on smaller files. -// -// See https://msdn.microsoft.com/en-us/library/azure/dd894037.aspx -func (b BlobStorageClient) CopyBlob(container, name, sourceBlob string) error { - copyID, err := b.StartBlobCopy(container, name, sourceBlob) - if err != nil { - return err - } - - return b.WaitForBlobCopy(container, name, copyID) -} - -// StartBlobCopy starts a blob copy operation. -// sourceBlob parameter must be a canonical URL to the blob (can be -// obtained using GetBlobURL method.) -// -// See https://msdn.microsoft.com/en-us/library/azure/dd894037.aspx -func (b BlobStorageClient) StartBlobCopy(container, name, sourceBlob string) (string, error) { - uri := b.client.getEndpoint(blobServiceName, pathForBlob(container, name), url.Values{}) - - headers := b.client.getStandardHeaders() - headers["x-ms-copy-source"] = sourceBlob - - resp, err := b.client.exec(http.MethodPut, uri, headers, nil, b.auth) - if err != nil { - return "", err - } - defer resp.body.Close() - - if err := checkRespCode(resp.statusCode, []int{http.StatusAccepted, http.StatusCreated}); err != nil { - return "", err - } - - copyID := resp.headers.Get("x-ms-copy-id") - if copyID == "" { - return "", errors.New("Got empty copy id header") - } - return copyID, nil -} - -// AbortBlobCopy aborts a BlobCopy which has already been triggered by the StartBlobCopy function. -// copyID is generated from StartBlobCopy function. -// currentLeaseID is required IF the destination blob has an active lease on it. -// As defined in https://msdn.microsoft.com/en-us/library/azure/jj159098.aspx -func (b BlobStorageClient) AbortBlobCopy(container, name, copyID, currentLeaseID string, timeout int) error { - params := url.Values{"comp": {"copy"}, "copyid": {copyID}} - if timeout > 0 { - params.Add("timeout", strconv.Itoa(timeout)) - } - - uri := b.client.getEndpoint(blobServiceName, pathForBlob(container, name), params) - headers := b.client.getStandardHeaders() - headers["x-ms-copy-action"] = "abort" - - if currentLeaseID != "" { - headers[headerLeaseID] = currentLeaseID - } - - resp, err := b.client.exec(http.MethodPut, uri, headers, nil, b.auth) - if err != nil { - return err - } - defer resp.body.Close() - - if err := checkRespCode(resp.statusCode, []int{http.StatusNoContent}); err != nil { - return err - } - - return nil -} - -// WaitForBlobCopy loops until a BlobCopy operation is completed (or fails with error) -func (b BlobStorageClient) WaitForBlobCopy(container, name, copyID string) error { - for { - props, err := b.GetBlobProperties(container, name) - if err != nil { - return err - } - - if props.CopyID != copyID { - return errBlobCopyIDMismatch - } - - switch props.CopyStatus { - case blobCopyStatusSuccess: - return nil - case blobCopyStatusPending: - continue - case blobCopyStatusAborted: - return errBlobCopyAborted - case blobCopyStatusFailed: - return fmt.Errorf("storage: blob copy failed. Id=%s Description=%s", props.CopyID, props.CopyStatusDescription) - default: - return fmt.Errorf("storage: unhandled blob copy status: '%s'", props.CopyStatus) - } - } -} - -// DeleteBlob deletes the given blob from the specified container. -// If the blob does not exists at the time of the Delete Blob operation, it -// returns error. See https://msdn.microsoft.com/en-us/library/azure/dd179413.aspx -func (b BlobStorageClient) DeleteBlob(container, name string, extraHeaders map[string]string) error { - resp, err := b.deleteBlob(container, name, extraHeaders) - if err != nil { - return err - } - defer resp.body.Close() - return checkRespCode(resp.statusCode, []int{http.StatusAccepted}) -} - -// DeleteBlobIfExists deletes the given blob from the specified container If the -// blob is deleted with this call, returns true. Otherwise returns false. -// -// See https://msdn.microsoft.com/en-us/library/azure/dd179413.aspx -func (b BlobStorageClient) DeleteBlobIfExists(container, name string, extraHeaders map[string]string) (bool, error) { - resp, err := b.deleteBlob(container, name, extraHeaders) - if resp != nil { - defer resp.body.Close() - if resp.statusCode == http.StatusAccepted || resp.statusCode == http.StatusNotFound { - return resp.statusCode == http.StatusAccepted, nil - } - } - return false, err -} - -func (b BlobStorageClient) deleteBlob(container, name string, extraHeaders map[string]string) (*storageResponse, error) { - uri := b.client.getEndpoint(blobServiceName, pathForBlob(container, name), url.Values{}) - extraHeaders = b.client.protectUserAgent(extraHeaders) - headers := b.client.getStandardHeaders() - for k, v := range extraHeaders { - headers[k] = v - } - - return b.client.exec(http.MethodDelete, uri, headers, nil, b.auth) -} - -// helper method to construct the path to a container given its name -func pathForContainer(name string) string { - return fmt.Sprintf("/%s", name) -} - -// helper method to construct the path to a blob given its container and blob -// name -func pathForBlob(container, name string) string { - return fmt.Sprintf("/%s/%s", container, name) -} - -// GetBlobSASURIWithSignedIPAndProtocol creates an URL to the specified blob which contains the Shared -// Access Signature with specified permissions and expiration time. Also includes signedIPRange and allowed protocols. -// If old API version is used but no signedIP is passed (ie empty string) then this should still work. -// We only populate the signedIP when it non-empty. -// -// See https://msdn.microsoft.com/en-us/library/azure/ee395415.aspx -func (b BlobStorageClient) GetBlobSASURIWithSignedIPAndProtocol(container, name string, expiry time.Time, permissions string, signedIPRange string, HTTPSOnly bool) (string, error) { - var ( - signedPermissions = permissions - blobURL = b.GetBlobURL(container, name) - ) - canonicalizedResource, err := b.client.buildCanonicalizedResource(blobURL, b.auth) - if err != nil { - return "", err - } - - // "The canonicalizedresouce portion of the string is a canonical path to the signed resource. - // It must include the service name (blob, table, queue or file) for version 2015-02-21 or - // later, the storage account name, and the resource name, and must be URL-decoded. - // -- https://msdn.microsoft.com/en-us/library/azure/dn140255.aspx - - // We need to replace + with %2b first to avoid being treated as a space (which is correct for query strings, but not the path component). - canonicalizedResource = strings.Replace(canonicalizedResource, "+", "%2b", -1) - canonicalizedResource, err = url.QueryUnescape(canonicalizedResource) - if err != nil { - return "", err - } - - signedExpiry := expiry.UTC().Format(time.RFC3339) - signedResource := "b" - - protocols := "https,http" - if HTTPSOnly { - protocols = "https" - } - stringToSign, err := blobSASStringToSign(b.client.apiVersion, canonicalizedResource, signedExpiry, signedPermissions, signedIPRange, protocols) - if err != nil { - return "", err - } - - sig := b.client.computeHmac256(stringToSign) - sasParams := url.Values{ - "sv": {b.client.apiVersion}, - "se": {signedExpiry}, - "sr": {signedResource}, - "sp": {signedPermissions}, - "sig": {sig}, - } - - if b.client.apiVersion >= "2015-04-05" { - sasParams.Add("spr", protocols) - if signedIPRange != "" { - sasParams.Add("sip", signedIPRange) - } - } - - sasURL, err := url.Parse(blobURL) - if err != nil { - return "", err - } - sasURL.RawQuery = sasParams.Encode() - return sasURL.String(), nil -} - -// GetBlobSASURI creates an URL to the specified blob which contains the Shared -// Access Signature with specified permissions and expiration time. -// -// See https://msdn.microsoft.com/en-us/library/azure/ee395415.aspx -func (b BlobStorageClient) GetBlobSASURI(container, name string, expiry time.Time, permissions string) (string, error) { - url, err := b.GetBlobSASURIWithSignedIPAndProtocol(container, name, expiry, permissions, "", false) - return url, err -} - -func blobSASStringToSign(signedVersion, canonicalizedResource, signedExpiry, signedPermissions string, signedIP string, protocols string) (string, error) { - var signedStart, signedIdentifier, rscc, rscd, rsce, rscl, rsct string - - if signedVersion >= "2015-02-21" { - canonicalizedResource = "/blob" + canonicalizedResource - } - - // https://msdn.microsoft.com/en-us/library/azure/dn140255.aspx#Anchor_12 - if signedVersion >= "2015-04-05" { - return fmt.Sprintf("%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s", signedPermissions, signedStart, signedExpiry, canonicalizedResource, signedIdentifier, signedIP, protocols, signedVersion, rscc, rscd, rsce, rscl, rsct), nil - } - - // reference: http://msdn.microsoft.com/en-us/library/azure/dn140255.aspx - if signedVersion >= "2013-08-15" { - return fmt.Sprintf("%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s", signedPermissions, signedStart, signedExpiry, canonicalizedResource, signedIdentifier, signedVersion, rscc, rscd, rsce, rscl, rsct), nil - } - - return "", errors.New("storage: not implemented SAS for versions earlier than 2013-08-15") -} - -func generateContainerACLpayload(policies []ContainerAccessPolicyDetails) (io.Reader, int, error) { - sil := SignedIdentifiers{ - SignedIdentifiers: []SignedIdentifier{}, - } - for _, capd := range policies { - permission := capd.generateContainerPermissions() - signedIdentifier := convertAccessPolicyToXMLStructs(capd.ID, capd.StartTime, capd.ExpiryTime, permission) - sil.SignedIdentifiers = append(sil.SignedIdentifiers, signedIdentifier) - } - return xmlMarshal(sil) -} - -func (capd *ContainerAccessPolicyDetails) generateContainerPermissions() (permissions string) { - // generate the permissions string (rwd). - // still want the end user API to have bool flags. - permissions = "" - - if capd.CanRead { - permissions += "r" - } - - if capd.CanWrite { - permissions += "w" - } - - if capd.CanDelete { - permissions += "d" - } - - return permissions -} diff --git a/storage/blob_test.go b/storage/blob_test.go deleted file mode 100644 index 1e84942d9cae..000000000000 --- a/storage/blob_test.go +++ /dev/null @@ -1,1599 +0,0 @@ -package storage - -import ( - "bytes" - "crypto/rand" - "encoding/base64" - "encoding/xml" - "fmt" - "io" - "io/ioutil" - "net/http" - "net/url" - "sort" - "sync" - "testing" - "time" - - chk "gopkg.in/check.v1" -) - -type StorageBlobSuite struct{} - -var _ = chk.Suite(&StorageBlobSuite{}) - -const testContainerPrefix = "zzzztest-" - -func getBlobClient(c *chk.C) BlobStorageClient { - return getBasicClient(c).GetBlobService() -} - -func (s *StorageBlobSuite) Test_pathForContainer(c *chk.C) { - c.Assert(pathForContainer("foo"), chk.Equals, "/foo") -} - -func (s *StorageBlobSuite) Test_pathForBlob(c *chk.C) { - c.Assert(pathForBlob("foo", "blob"), chk.Equals, "/foo/blob") -} - -func (s *StorageBlobSuite) Test_blobSASStringToSign(c *chk.C) { - _, err := blobSASStringToSign("2012-02-12", "CS", "SE", "SP", "", "") - c.Assert(err, chk.NotNil) // not implemented SAS for versions earlier than 2013-08-15 - - out, err := blobSASStringToSign("2013-08-15", "CS", "SE", "SP", "", "") - c.Assert(err, chk.IsNil) - c.Assert(out, chk.Equals, "SP\n\nSE\nCS\n\n2013-08-15\n\n\n\n\n") - - // check format for 2015-04-05 version - out, err = blobSASStringToSign("2015-04-05", "CS", "SE", "SP", "127.0.0.1", "https,http") - c.Assert(err, chk.IsNil) - c.Assert(out, chk.Equals, "SP\n\nSE\n/blobCS\n\n127.0.0.1\nhttps,http\n2015-04-05\n\n\n\n\n") -} - -func (s *StorageBlobSuite) TestGetBlobSASURI(c *chk.C) { - api, err := NewClient("foo", "YmFy", DefaultBaseURL, "2013-08-15", true) - c.Assert(err, chk.IsNil) - cli := api.GetBlobService() - expiry := time.Time{} - - expectedParts := url.URL{ - Scheme: "https", - Host: "foo.blob.core.windows.net", - Path: "container/name", - RawQuery: url.Values{ - "sv": {"2013-08-15"}, - "sig": {"/OXG7rWh08jYwtU03GzJM0DHZtidRGpC6g69rSGm3I0="}, - "sr": {"b"}, - "sp": {"r"}, - "se": {"0001-01-01T00:00:00Z"}, - }.Encode()} - - u, err := cli.GetBlobSASURI("container", "name", expiry, "r") - c.Assert(err, chk.IsNil) - sasParts, err := url.Parse(u) - c.Assert(err, chk.IsNil) - c.Assert(expectedParts.String(), chk.Equals, sasParts.String()) - c.Assert(expectedParts.Query(), chk.DeepEquals, sasParts.Query()) -} - -func (s *StorageBlobSuite) TestGetBlobSASURIWithSignedIPAndProtocolValidAPIVersionPassed(c *chk.C) { - api, err := NewClient("foo", "YmFy", DefaultBaseURL, "2015-04-05", true) - c.Assert(err, chk.IsNil) - cli := api.GetBlobService() - expiry := time.Time{} - - expectedParts := url.URL{ - Scheme: "https", - Host: "foo.blob.core.windows.net", - Path: "/container/name", - RawQuery: url.Values{ - "sv": {"2015-04-05"}, - "sig": {"VBOYJmt89UuBRXrxNzmsCMoC+8PXX2yklV71QcL1BfM="}, - "sr": {"b"}, - "sip": {"127.0.0.1"}, - "sp": {"r"}, - "se": {"0001-01-01T00:00:00Z"}, - "spr": {"https"}, - }.Encode()} - - u, err := cli.GetBlobSASURIWithSignedIPAndProtocol("container", "name", expiry, "r", "127.0.0.1", true) - c.Assert(err, chk.IsNil) - sasParts, err := url.Parse(u) - c.Assert(err, chk.IsNil) - c.Assert(sasParts.Query(), chk.DeepEquals, expectedParts.Query()) -} - -// Trying to use SignedIP and Protocol but using an older version of the API. -// Should ignore the signedIP/protocol and just use what the older version requires. -func (s *StorageBlobSuite) TestGetBlobSASURIWithSignedIPAndProtocolUsingOldAPIVersion(c *chk.C) { - api, err := NewClient("foo", "YmFy", DefaultBaseURL, "2013-08-15", true) - c.Assert(err, chk.IsNil) - cli := api.GetBlobService() - expiry := time.Time{} - - expectedParts := url.URL{ - Scheme: "https", - Host: "foo.blob.core.windows.net", - Path: "/container/name", - RawQuery: url.Values{ - "sv": {"2013-08-15"}, - "sig": {"/OXG7rWh08jYwtU03GzJM0DHZtidRGpC6g69rSGm3I0="}, - "sr": {"b"}, - "sp": {"r"}, - "se": {"0001-01-01T00:00:00Z"}, - }.Encode()} - - u, err := cli.GetBlobSASURIWithSignedIPAndProtocol("container", "name", expiry, "r", "", true) - c.Assert(err, chk.IsNil) - sasParts, err := url.Parse(u) - c.Assert(err, chk.IsNil) - c.Assert(expectedParts.String(), chk.Equals, sasParts.String()) - c.Assert(expectedParts.Query(), chk.DeepEquals, sasParts.Query()) -} - -func (s *StorageBlobSuite) TestBlobSASURICorrectness(c *chk.C) { - cli := getBlobClient(c) - cnt := randContainer() - blob := randNameWithSpecialChars(5) - body := []byte(randString(100)) - expiry := now.UTC().Add(time.Hour) - permissions := "r" - - c.Assert(cli.CreateContainer(cnt, ContainerAccessTypePrivate), chk.IsNil) - defer cli.DeleteContainer(cnt) - - c.Assert(cli.putSingleBlockBlob(cnt, blob, body), chk.IsNil) - - sasURI, err := cli.GetBlobSASURI(cnt, blob, expiry, permissions) - c.Assert(err, chk.IsNil) - - resp, err := http.Get(sasURI) - c.Assert(err, chk.IsNil) - - blobResp, err := ioutil.ReadAll(resp.Body) - defer resp.Body.Close() - c.Assert(err, chk.IsNil) - - c.Assert(resp.StatusCode, chk.Equals, http.StatusOK) - c.Assert(len(blobResp), chk.Equals, len(body)) -} - -func (s *StorageBlobSuite) TestListContainersPagination(c *chk.C) { - cli := getBlobClient(c) - c.Assert(deleteTestContainers(cli), chk.IsNil) - - const n = 5 - const pageSize = 2 - - // Create test containers - created := []string{} - for i := 0; i < n; i++ { - name := randContainer() - c.Assert(cli.CreateContainer(name, ContainerAccessTypePrivate), chk.IsNil) - created = append(created, name) - } - sort.Strings(created) - - // Defer test container deletions - defer func() { - var wg sync.WaitGroup - for _, cnt := range created { - wg.Add(1) - go func(name string) { - c.Assert(cli.DeleteContainer(name), chk.IsNil) - wg.Done() - }(cnt) - } - wg.Wait() - }() - - // Paginate results - seen := []string{} - marker := "" - for { - resp, err := cli.ListContainers(ListContainersParameters{ - Prefix: testContainerPrefix, - MaxResults: pageSize, - Marker: marker}) - c.Assert(err, chk.IsNil) - - containers := resp.Containers - if len(containers) > pageSize { - c.Fatalf("Got a bigger page. Expected: %d, got: %d", pageSize, len(containers)) - } - - for _, c := range containers { - seen = append(seen, c.Name) - } - - marker = resp.NextMarker - if marker == "" || len(containers) == 0 { - break - } - } - - c.Assert(seen, chk.DeepEquals, created) -} - -func (s *StorageBlobSuite) TestContainerExists(c *chk.C) { - cnt := randContainer() - cli := getBlobClient(c) - ok, err := cli.ContainerExists(cnt) - c.Assert(err, chk.IsNil) - c.Assert(ok, chk.Equals, false) - - c.Assert(cli.CreateContainer(cnt, ContainerAccessTypeBlob), chk.IsNil) - defer cli.DeleteContainer(cnt) - - ok, err = cli.ContainerExists(cnt) - c.Assert(err, chk.IsNil) - c.Assert(ok, chk.Equals, true) -} - -func (s *StorageBlobSuite) TestCreateContainerDeleteContainer(c *chk.C) { - cnt := randContainer() - cli := getBlobClient(c) - c.Assert(cli.CreateContainer(cnt, ContainerAccessTypePrivate), chk.IsNil) - c.Assert(cli.DeleteContainer(cnt), chk.IsNil) -} - -func (s *StorageBlobSuite) TestCreateContainerIfNotExists(c *chk.C) { - cnt := randContainer() - cli := getBlobClient(c) - defer cli.DeleteContainer(cnt) - - // First create - ok, err := cli.CreateContainerIfNotExists(cnt, ContainerAccessTypePrivate) - c.Assert(err, chk.IsNil) - c.Assert(ok, chk.Equals, true) - - // Second create, should not give errors - ok, err = cli.CreateContainerIfNotExists(cnt, ContainerAccessTypePrivate) - c.Assert(err, chk.IsNil) - c.Assert(ok, chk.Equals, false) -} - -func (s *StorageBlobSuite) TestDeleteContainerIfExists(c *chk.C) { - cnt := randContainer() - cli := getBlobClient(c) - - // Nonexisting container - c.Assert(cli.DeleteContainer(cnt), chk.NotNil) - - ok, err := cli.DeleteContainerIfExists(cnt) - c.Assert(err, chk.IsNil) - c.Assert(ok, chk.Equals, false) - - // Existing container - c.Assert(cli.CreateContainer(cnt, ContainerAccessTypePrivate), chk.IsNil) - ok, err = cli.DeleteContainerIfExists(cnt) - c.Assert(err, chk.IsNil) - c.Assert(ok, chk.Equals, true) -} - -func (s *StorageBlobSuite) TestBlobExists(c *chk.C) { - cnt := randContainer() - blob := randName(5) - cli := getBlobClient(c) - - c.Assert(cli.CreateContainer(cnt, ContainerAccessTypeBlob), chk.IsNil) - defer cli.DeleteContainer(cnt) - c.Assert(cli.putSingleBlockBlob(cnt, blob, []byte("Hello!")), chk.IsNil) - defer cli.DeleteBlob(cnt, blob, nil) - - ok, err := cli.BlobExists(cnt, blob+".foo") - c.Assert(err, chk.IsNil) - c.Assert(ok, chk.Equals, false) - - ok, err = cli.BlobExists(cnt, blob) - c.Assert(err, chk.IsNil) - c.Assert(ok, chk.Equals, true) -} - -func (s *StorageBlobSuite) TestGetBlobURL(c *chk.C) { - api, err := NewBasicClient("foo", "YmFy") - c.Assert(err, chk.IsNil) - cli := api.GetBlobService() - - c.Assert(cli.GetBlobURL("c", "nested/blob"), chk.Equals, "https://foo.blob.core.windows.net/c/nested/blob") - c.Assert(cli.GetBlobURL("", "blob"), chk.Equals, "https://foo.blob.core.windows.net/$root/blob") - c.Assert(cli.GetBlobURL("", "nested/blob"), chk.Equals, "https://foo.blob.core.windows.net/$root/nested/blob") -} - -func (s *StorageBlobSuite) TestBlobCopy(c *chk.C) { - if testing.Short() { - c.Skip("skipping blob copy in short mode, no SLA on async operation") - } - - cli := getBlobClient(c) - cnt := randContainer() - src := randName(5) - dst := randName(5) - body := []byte(randString(1024)) - - c.Assert(cli.CreateContainer(cnt, ContainerAccessTypePrivate), chk.IsNil) - defer cli.deleteContainer(cnt) - - c.Assert(cli.putSingleBlockBlob(cnt, src, body), chk.IsNil) - defer cli.DeleteBlob(cnt, src, nil) - - c.Assert(cli.CopyBlob(cnt, dst, cli.GetBlobURL(cnt, src)), chk.IsNil) - defer cli.DeleteBlob(cnt, dst, nil) - - blobBody, err := cli.GetBlob(cnt, dst) - c.Assert(err, chk.IsNil) - - b, err := ioutil.ReadAll(blobBody) - defer blobBody.Close() - c.Assert(err, chk.IsNil) - c.Assert(b, chk.DeepEquals, body) -} - -func (s *StorageBlobSuite) TestStartBlobCopy(c *chk.C) { - if testing.Short() { - c.Skip("skipping blob copy in short mode, no SLA on async operation") - } - - cli := getBlobClient(c) - cnt := randContainer() - src := randName(5) - dst := randName(5) - body := []byte(randString(1024)) - - c.Assert(cli.CreateContainer(cnt, ContainerAccessTypePrivate), chk.IsNil) - defer cli.deleteContainer(cnt) - - c.Assert(cli.putSingleBlockBlob(cnt, src, body), chk.IsNil) - defer cli.DeleteBlob(cnt, src, nil) - - // given we dont know when it will start, can we even test destination creation? - // will just test that an error wasn't thrown for now. - copyID, err := cli.StartBlobCopy(cnt, dst, cli.GetBlobURL(cnt, src)) - c.Assert(copyID, chk.NotNil) - c.Assert(err, chk.IsNil) -} - -// Tests abort of blobcopy. Given the blobcopy is usually over before we can actually trigger an abort -// it is agreed that we perform a copy then try and perform an abort. It should result in a HTTP status of 409. -// So basically we're testing negative scenario (as good as we can do for now) -func (s *StorageBlobSuite) TestAbortBlobCopy(c *chk.C) { - if testing.Short() { - c.Skip("skipping blob copy in short mode, no SLA on async operation") - } - - cli := getBlobClient(c) - cnt := randContainer() - src := randName(5) - dst := randName(5) - body := []byte(randString(1024)) - - c.Assert(cli.CreateContainer(cnt, ContainerAccessTypePrivate), chk.IsNil) - defer cli.deleteContainer(cnt) - - c.Assert(cli.putSingleBlockBlob(cnt, src, body), chk.IsNil) - defer cli.DeleteBlob(cnt, src, nil) - - // given we dont know when it will start, can we even test destination creation? - // will just test that an error wasn't thrown for now. - copyID, err := cli.StartBlobCopy(cnt, dst, cli.GetBlobURL(cnt, src)) - c.Assert(copyID, chk.NotNil) - c.Assert(err, chk.IsNil) - - err = cli.WaitForBlobCopy(cnt, dst, copyID) - c.Assert(err, chk.IsNil) - - // abort abort abort, but we *know* its already completed. - err = cli.AbortBlobCopy(cnt, dst, copyID, "", 0) - - // abort should fail (over already) - c.Assert(err.(AzureStorageServiceError).StatusCode, chk.Equals, http.StatusConflict) -} - -func (s *StorageBlobSuite) TestDeleteBlobIfExists(c *chk.C) { - cnt := randContainer() - blob := randName(5) - - cli := getBlobClient(c) - c.Assert(cli.DeleteBlob(cnt, blob, nil), chk.NotNil) - - ok, err := cli.DeleteBlobIfExists(cnt, blob, nil) - c.Assert(err, chk.IsNil) - c.Assert(ok, chk.Equals, false) -} - -func (s *StorageBlobSuite) TestDeleteBlobWithConditions(c *chk.C) { - cnt := randContainer() - blob := randName(5) - - cli := getBlobClient(c) - - c.Assert(cli.CreateContainer(cnt, ContainerAccessTypePrivate), chk.IsNil) - defer cli.deleteContainer(cnt) - - c.Assert(cli.CreateBlockBlob(cnt, blob), chk.IsNil) - oldProps, err := cli.GetBlobProperties(cnt, blob) - c.Assert(err, chk.IsNil) - - // Update metadata, so Etag changes - c.Assert(cli.SetBlobMetadata(cnt, blob, map[string]string{}, nil), chk.IsNil) - newProps, err := cli.GetBlobProperties(cnt, blob) - c.Assert(err, chk.IsNil) - - // "Delete if matches old Etag" should fail without deleting. - err = cli.DeleteBlob(cnt, blob, map[string]string{ - "If-Match": oldProps.Etag, - }) - c.Assert(err, chk.FitsTypeOf, AzureStorageServiceError{}) - c.Assert(err.(AzureStorageServiceError).StatusCode, chk.Equals, http.StatusPreconditionFailed) - _, err = cli.GetBlob(cnt, blob) - c.Assert(err, chk.IsNil) - - // "Delete if matches new Etag" should succeed. - err = cli.DeleteBlob(cnt, blob, map[string]string{ - "If-Match": newProps.Etag, - }) - c.Assert(err, chk.IsNil) - _, err = cli.GetBlob(cnt, blob) - c.Assert(err, chk.Not(chk.IsNil)) -} - -func (s *StorageBlobSuite) TestGetBlobProperties(c *chk.C) { - cnt := randContainer() - blob := randName(5) - contents := randString(64) - - cli := getBlobClient(c) - c.Assert(cli.CreateContainer(cnt, ContainerAccessTypePrivate), chk.IsNil) - defer cli.DeleteContainer(cnt) - - // Nonexisting blob - _, err := cli.GetBlobProperties(cnt, blob) - c.Assert(err, chk.NotNil) - - // Put the blob - c.Assert(cli.putSingleBlockBlob(cnt, blob, []byte(contents)), chk.IsNil) - - // Get blob properties - props, err := cli.GetBlobProperties(cnt, blob) - c.Assert(err, chk.IsNil) - - c.Assert(props.ContentLength, chk.Equals, int64(len(contents))) - c.Assert(props.ContentType, chk.Equals, "application/octet-stream") - c.Assert(props.BlobType, chk.Equals, BlobTypeBlock) -} - -func (s *StorageBlobSuite) TestListBlobsPagination(c *chk.C) { - cli := getBlobClient(c) - cnt := randContainer() - - c.Assert(cli.CreateContainer(cnt, ContainerAccessTypePrivate), chk.IsNil) - defer cli.DeleteContainer(cnt) - - blobs := []string{} - const n = 5 - const pageSize = 2 - for i := 0; i < n; i++ { - name := randName(5) - c.Assert(cli.putSingleBlockBlob(cnt, name, []byte("Hello, world!")), chk.IsNil) - blobs = append(blobs, name) - } - sort.Strings(blobs) - - // Paginate - seen := []string{} - marker := "" - for { - resp, err := cli.ListBlobs(cnt, ListBlobsParameters{ - MaxResults: pageSize, - Marker: marker}) - c.Assert(err, chk.IsNil) - - for _, v := range resp.Blobs { - seen = append(seen, v.Name) - } - - marker = resp.NextMarker - if marker == "" || len(resp.Blobs) == 0 { - break - } - } - - // Compare - c.Assert(seen, chk.DeepEquals, blobs) -} - -// listBlobsAsFiles is a helper function to list blobs as "folders" and "files". -func listBlobsAsFiles(cli BlobStorageClient, cnt string, parentDir string) (folders []string, files []string, err error) { - var blobParams ListBlobsParameters - var blobListResponse BlobListResponse - - // Top level "folders" - blobParams = ListBlobsParameters{ - Delimiter: "/", - Prefix: parentDir, - } - - blobListResponse, err = cli.ListBlobs(cnt, blobParams) - if err != nil { - return nil, nil, err - } - - // These are treated as "folders" under the parentDir. - folders = blobListResponse.BlobPrefixes - - // "Files"" are blobs which are under the parentDir. - files = make([]string, len(blobListResponse.Blobs)) - for i := range blobListResponse.Blobs { - files[i] = blobListResponse.Blobs[i].Name - } - - return folders, files, nil -} - -// TestListBlobsTraversal tests that we can correctly traverse -// blobs in blob storage as if it were a file system by using -// a combination of Prefix, Delimiter, and BlobPrefixes. -// -// Blob storage is flat, but we can *simulate* the file -// system with folders and files using conventions in naming. -// With the blob namedd "/usr/bin/ls", when we use delimiter '/', -// the "ls" would be a "file"; with "/", /usr" and "/usr/bin" being -// the "folders" -// -// NOTE: The use of delimiter (eg forward slash) is extremely fiddly -// and difficult to get right so some discipline in naming and rules -// when using the API is required to get everything to work as expected. -// -// Assuming our delimiter is a forward slash, the rules are: -// -// - Do use a leading forward slash in blob names to make things -// consistent and simpler (see further). -// Note that doing so will show "" as the only top-level -// folder in the container in Azure portal, which may look strange. -// -// - The "folder names" are returned *with trailing forward slash* as per MSDN. -// -// - The "folder names" will be "absolue paths", e.g. listing things under "/usr/" -// will return folder names "/usr/bin/". -// -// - The "file names" are returned as full blob names, e.g. when listing -// things under "/usr/bin/", the file names will be "/usr/bin/ls" and -// "/usr/bin/cat". -// -// - Everything is returned with case-sensitive order as expected in real file system -// as per MSDN. -// -// - To list things under a "folder" always use trailing forward slash. -// -// Example: to list top level folders we use root folder named "" with -// trailing forward slash, so we use "/". -// -// Example: to list folders under "/usr", we again append forward slash and -// so we use "/usr/". -// -// Because we use leading forward slash we don't need to have different -// treatment of "get top-level folders" and "get non-top-level folders" -// scenarios. -func (s *StorageBlobSuite) TestListBlobsTraversal(c *chk.C) { - cli := getBlobClient(c) - cnt := randContainer() - - c.Assert(cli.CreateContainer(cnt, ContainerAccessTypePrivate), chk.IsNil) - defer cli.DeleteContainer(cnt) - - // Note use of leading forward slash as per naming rules. - blobsToCreate := []string{ - "/usr/bin/ls", - "/usr/bin/cat", - "/usr/lib64/libc.so", - "/etc/hosts", - "/etc/init.d/iptables", - } - - // Create the above blobs - for _, blobName := range blobsToCreate { - err := cli.CreateBlockBlob(cnt, blobName) - c.Assert(err, chk.IsNil) - } - - var folders []string - var files []string - var err error - - // Top level folders and files. - folders, files, err = listBlobsAsFiles(cli, cnt, "/") - c.Assert(err, chk.IsNil) - c.Assert(folders, chk.DeepEquals, []string{"/etc/", "/usr/"}) - c.Assert(files, chk.DeepEquals, []string{}) - - // Things under /etc/. Note use of trailing forward slash here as per rules. - folders, files, err = listBlobsAsFiles(cli, cnt, "/etc/") - c.Assert(err, chk.IsNil) - c.Assert(folders, chk.DeepEquals, []string{"/etc/init.d/"}) - c.Assert(files, chk.DeepEquals, []string{"/etc/hosts"}) - - // Things under /etc/init.d/ - folders, files, err = listBlobsAsFiles(cli, cnt, "/etc/init.d/") - c.Assert(err, chk.IsNil) - c.Assert(folders, chk.DeepEquals, []string(nil)) - c.Assert(files, chk.DeepEquals, []string{"/etc/init.d/iptables"}) - - // Things under /usr/ - folders, files, err = listBlobsAsFiles(cli, cnt, "/usr/") - c.Assert(err, chk.IsNil) - c.Assert(folders, chk.DeepEquals, []string{"/usr/bin/", "/usr/lib64/"}) - c.Assert(files, chk.DeepEquals, []string{}) - - // Things under /usr/bin/ - folders, files, err = listBlobsAsFiles(cli, cnt, "/usr/bin/") - c.Assert(err, chk.IsNil) - c.Assert(folders, chk.DeepEquals, []string(nil)) - c.Assert(files, chk.DeepEquals, []string{"/usr/bin/cat", "/usr/bin/ls"}) -} - -func (s *StorageBlobSuite) TestListBlobsWithMetadata(c *chk.C) { - cli := getBlobClient(c) - cnt := randContainer() - - c.Assert(cli.CreateContainer(cnt, ContainerAccessTypePrivate), chk.IsNil) - defer cli.deleteContainer(cnt) - - expectMeta := make(map[string]BlobMetadata) - - // Put 4 blobs with metadata - for i := 0; i < 4; i++ { - name := randName(5) - c.Assert(cli.putSingleBlockBlob(cnt, name, []byte("Hello, world!")), chk.IsNil) - c.Assert(cli.SetBlobMetadata(cnt, name, map[string]string{ - "Foo": name, - "Bar_BAZ": "Waz Qux", - }, nil), chk.IsNil) - expectMeta[name] = BlobMetadata{ - "foo": name, - "bar_baz": "Waz Qux", - } - } - - // Put one more blob with no metadata - blobWithoutMetadata := randName(5) - c.Assert(cli.putSingleBlockBlob(cnt, blobWithoutMetadata, []byte("Hello, world!")), chk.IsNil) - expectMeta[blobWithoutMetadata] = nil - - // Get ListBlobs with include:"metadata" - resp, err := cli.ListBlobs(cnt, ListBlobsParameters{ - MaxResults: 5, - Include: "metadata"}) - c.Assert(err, chk.IsNil) - - respBlobs := make(map[string]Blob) - for _, v := range resp.Blobs { - respBlobs[v.Name] = v - } - - // Verify the metadata is as expected - for name := range expectMeta { - c.Check(respBlobs[name].Metadata, chk.DeepEquals, expectMeta[name]) - } -} - -// Ensure it's possible to generate a ListBlobs response with -// metadata, e.g., for a stub server. -func (s *StorageBlobSuite) TestMarshalBlobMetadata(c *chk.C) { - buf, err := xml.Marshal(Blob{ - Name: randName(5), - Properties: BlobProperties{}, - Metadata: BlobMetadata{"foo": "baz < waz"}, - }) - c.Assert(err, chk.IsNil) - c.Assert(string(buf), chk.Matches, `.*baz < waz.*`) -} - -func (s *StorageBlobSuite) TestGetAndSetMetadata(c *chk.C) { - cli := getBlobClient(c) - cnt := randContainer() - - c.Assert(cli.CreateContainer(cnt, ContainerAccessTypePrivate), chk.IsNil) - defer cli.deleteContainer(cnt) - - blob := randName(5) - c.Assert(cli.putSingleBlockBlob(cnt, blob, []byte{}), chk.IsNil) - - m, err := cli.GetBlobMetadata(cnt, blob) - c.Assert(err, chk.IsNil) - c.Assert(m, chk.Not(chk.Equals), nil) - c.Assert(len(m), chk.Equals, 0) - - mPut := map[string]string{ - "foo": "bar", - "bar_baz": "waz qux", - } - - err = cli.SetBlobMetadata(cnt, blob, mPut, nil) - c.Assert(err, chk.IsNil) - - m, err = cli.GetBlobMetadata(cnt, blob) - c.Assert(err, chk.IsNil) - c.Check(m, chk.DeepEquals, mPut) - - // Case munging - - mPutUpper := map[string]string{ - "Foo": "different bar", - "bar_BAZ": "different waz qux", - } - mExpectLower := map[string]string{ - "foo": "different bar", - "bar_baz": "different waz qux", - } - - err = cli.SetBlobMetadata(cnt, blob, mPutUpper, nil) - c.Assert(err, chk.IsNil) - - m, err = cli.GetBlobMetadata(cnt, blob) - c.Assert(err, chk.IsNil) - c.Check(m, chk.DeepEquals, mExpectLower) -} - -func (s *StorageBlobSuite) TestSetMetadataWithExtraHeaders(c *chk.C) { - cli := getBlobClient(c) - cnt := randContainer() - - c.Assert(cli.CreateContainer(cnt, ContainerAccessTypePrivate), chk.IsNil) - defer cli.deleteContainer(cnt) - - blob := randName(5) - c.Assert(cli.putSingleBlockBlob(cnt, blob, []byte{}), chk.IsNil) - - mPut := map[string]string{ - "foo": "bar", - "bar_baz": "waz qux", - } - - extraHeaders := map[string]string{ - "If-Match": "incorrect-etag", - } - - // Set with incorrect If-Match in extra headers should result in error - err := cli.SetBlobMetadata(cnt, blob, mPut, extraHeaders) - c.Assert(err, chk.NotNil) - - props, err := cli.GetBlobProperties(cnt, blob) - extraHeaders = map[string]string{ - "If-Match": props.Etag, - } - - // Set with matching If-Match in extra headers should succeed - err = cli.SetBlobMetadata(cnt, blob, mPut, extraHeaders) - c.Assert(err, chk.IsNil) -} - -func (s *StorageBlobSuite) TestSetBlobProperties(c *chk.C) { - cli := getBlobClient(c) - cnt := randContainer() - - c.Assert(cli.CreateContainer(cnt, ContainerAccessTypePrivate), chk.IsNil) - defer cli.deleteContainer(cnt) - - blob := randName(5) - c.Assert(cli.putSingleBlockBlob(cnt, blob, []byte{}), chk.IsNil) - - mPut := BlobHeaders{ - CacheControl: "private, max-age=0, no-cache", - ContentMD5: "oBATU+oaDduHWbVZLuzIJw==", - ContentType: "application/json", - ContentEncoding: "gzip", - ContentLanguage: "de-DE", - } - - err := cli.SetBlobProperties(cnt, blob, mPut) - c.Assert(err, chk.IsNil) - - props, err := cli.GetBlobProperties(cnt, blob) - c.Assert(err, chk.IsNil) - - c.Check(mPut.CacheControl, chk.Equals, props.CacheControl) - c.Check(mPut.ContentType, chk.Equals, props.ContentType) - c.Check(mPut.ContentMD5, chk.Equals, props.ContentMD5) - c.Check(mPut.ContentEncoding, chk.Equals, props.ContentEncoding) - c.Check(mPut.ContentLanguage, chk.Equals, props.ContentLanguage) -} - -func appendContainerPermission(perms ContainerPermissions, accessType ContainerAccessType, - ID string, start time.Time, expiry time.Time, - canRead bool, canWrite bool, canDelete bool) ContainerPermissions { - - perms.AccessType = accessType - - if ID != "" { - capd := ContainerAccessPolicyDetails{ - ID: ID, - StartTime: start, - ExpiryTime: expiry, - CanRead: canRead, - CanWrite: canWrite, - CanDelete: canDelete, - } - perms.AccessPolicies = append(perms.AccessPolicies, capd) - } - return perms -} - -func (s *StorageBlobSuite) TestSetContainerPermissionsWithTimeoutSuccessfully(c *chk.C) { - cli := getBlobClient(c) - cnt := randContainer() - - c.Assert(cli.CreateContainer(cnt, ContainerAccessTypePrivate), chk.IsNil) - defer cli.deleteContainer(cnt) - - perms := ContainerPermissions{} - perms = appendContainerPermission(perms, ContainerAccessTypeBlob, "GolangRocksOnAzure", now, now.Add(10*time.Hour), true, true, true) - - err := cli.SetContainerPermissions(cnt, perms, 30, "") - c.Assert(err, chk.IsNil) -} - -func (s *StorageBlobSuite) TestSetContainerPermissionsSuccessfully(c *chk.C) { - cli := getBlobClient(c) - cnt := randContainer() - - c.Assert(cli.CreateContainer(cnt, ContainerAccessTypePrivate), chk.IsNil) - defer cli.deleteContainer(cnt) - - perms := ContainerPermissions{} - perms = appendContainerPermission(perms, ContainerAccessTypeBlob, "GolangRocksOnAzure", now, now.Add(10*time.Hour), true, true, true) - - err := cli.SetContainerPermissions(cnt, perms, 0, "") - c.Assert(err, chk.IsNil) -} - -func (s *StorageBlobSuite) TestSetThenGetContainerPermissionsSuccessfully(c *chk.C) { - cli := getBlobClient(c) - cnt := randContainer() - - c.Assert(cli.CreateContainer(cnt, ContainerAccessTypePrivate), chk.IsNil) - defer cli.deleteContainer(cnt) - - perms := ContainerPermissions{} - perms = appendContainerPermission(perms, ContainerAccessTypeBlob, "AutoRestIsSuperCool", now, now.Add(10*time.Hour), true, true, true) - perms = appendContainerPermission(perms, ContainerAccessTypeBlob, "GolangRocksOnAzure", now.Add(20*time.Hour), now.Add(30*time.Hour), true, false, false) - - err := cli.SetContainerPermissions(cnt, perms, 0, "") - c.Assert(err, chk.IsNil) - - returnedPerms, err := cli.GetContainerPermissions(cnt, 0, "") - c.Assert(err, chk.IsNil) - - // check container permissions itself. - c.Assert(returnedPerms.AccessType, chk.Equals, perms.AccessType) - - // now check policy set. - c.Assert(returnedPerms.AccessPolicies, chk.HasLen, 2) - - for i := range perms.AccessPolicies { - c.Assert(returnedPerms.AccessPolicies[i].ID, chk.Equals, perms.AccessPolicies[i].ID) - - // test timestamps down the second - // rounding start/expiry time original perms since the returned perms would have been rounded. - // so need rounded vs rounded. - c.Assert(returnedPerms.AccessPolicies[i].StartTime.UTC().Round(time.Second).Format(time.RFC1123), - chk.Equals, perms.AccessPolicies[i].StartTime.UTC().Round(time.Second).Format(time.RFC1123)) - - c.Assert(returnedPerms.AccessPolicies[i].ExpiryTime.UTC().Round(time.Second).Format(time.RFC1123), - chk.Equals, perms.AccessPolicies[i].ExpiryTime.UTC().Round(time.Second).Format(time.RFC1123)) - - c.Assert(returnedPerms.AccessPolicies[i].CanRead, chk.Equals, perms.AccessPolicies[i].CanRead) - c.Assert(returnedPerms.AccessPolicies[i].CanWrite, chk.Equals, perms.AccessPolicies[i].CanWrite) - c.Assert(returnedPerms.AccessPolicies[i].CanDelete, chk.Equals, perms.AccessPolicies[i].CanDelete) - } -} - -func (s *StorageBlobSuite) TestSetContainerPermissionsOnlySuccessfully(c *chk.C) { - cli := getBlobClient(c) - cnt := randContainer() - - c.Assert(cli.CreateContainer(cnt, ContainerAccessTypePrivate), chk.IsNil) - defer cli.deleteContainer(cnt) - - perms := ContainerPermissions{} - perms = appendContainerPermission(perms, ContainerAccessTypeBlob, "GolangRocksOnAzure", now, now.Add(10*time.Hour), true, true, true) - - err := cli.SetContainerPermissions(cnt, perms, 0, "") - c.Assert(err, chk.IsNil) -} - -func (s *StorageBlobSuite) TestSetThenGetContainerPermissionsOnlySuccessfully(c *chk.C) { - cli := getBlobClient(c) - cnt := randContainer() - - c.Assert(cli.CreateContainer(cnt, ContainerAccessTypePrivate), chk.IsNil) - defer cli.deleteContainer(cnt) - - perms := ContainerPermissions{} - perms = appendContainerPermission(perms, ContainerAccessTypeBlob, "", now, now.Add(10*time.Hour), true, true, true) - - err := cli.SetContainerPermissions(cnt, perms, 0, "") - c.Assert(err, chk.IsNil) - - returnedPerms, err := cli.GetContainerPermissions(cnt, 0, "") - c.Assert(err, chk.IsNil) - - // check container permissions itself. - c.Assert(returnedPerms.AccessType, chk.Equals, perms.AccessType) - - // now check there are NO policies set - c.Assert(returnedPerms.AccessPolicies, chk.HasLen, 0) -} - -func (s *StorageBlobSuite) TestSnapshotBlob(c *chk.C) { - cli := getBlobClient(c) - cnt := randContainer() - - c.Assert(cli.CreateContainer(cnt, ContainerAccessTypePrivate), chk.IsNil) - defer cli.deleteContainer(cnt) - - blob := randName(5) - c.Assert(cli.putSingleBlockBlob(cnt, blob, []byte{}), chk.IsNil) - - snapshotTime, err := cli.SnapshotBlob(cnt, blob, 0, nil) - c.Assert(err, chk.IsNil) - c.Assert(snapshotTime, chk.NotNil) -} - -func (s *StorageBlobSuite) TestSnapshotBlobWithTimeout(c *chk.C) { - cli := getBlobClient(c) - cnt := randContainer() - - c.Assert(cli.CreateContainer(cnt, ContainerAccessTypePrivate), chk.IsNil) - defer cli.deleteContainer(cnt) - - blob := randName(5) - c.Assert(cli.putSingleBlockBlob(cnt, blob, []byte{}), chk.IsNil) - - snapshotTime, err := cli.SnapshotBlob(cnt, blob, 30, nil) - c.Assert(err, chk.IsNil) - c.Assert(snapshotTime, chk.NotNil) -} - -func (s *StorageBlobSuite) TestSnapshotBlobWithValidLease(c *chk.C) { - cli := getBlobClient(c) - cnt := randContainer() - - c.Assert(cli.CreateContainer(cnt, ContainerAccessTypePrivate), chk.IsNil) - defer cli.deleteContainer(cnt) - - blob := randName(5) - c.Assert(cli.putSingleBlockBlob(cnt, blob, []byte{}), chk.IsNil) - - // generate lease. - currentLeaseID, err := cli.AcquireLease(cnt, blob, 30, "") - c.Assert(err, chk.IsNil) - - extraHeaders := map[string]string{ - headerLeaseID: currentLeaseID, - } - - snapshotTime, err := cli.SnapshotBlob(cnt, blob, 0, extraHeaders) - c.Assert(err, chk.IsNil) - c.Assert(snapshotTime, chk.NotNil) -} - -func (s *StorageBlobSuite) TestSnapshotBlobWithInvalidLease(c *chk.C) { - cli := getBlobClient(c) - cnt := randContainer() - - c.Assert(cli.CreateContainer(cnt, ContainerAccessTypePrivate), chk.IsNil) - defer cli.deleteContainer(cnt) - - blob := randName(5) - c.Assert(cli.putSingleBlockBlob(cnt, blob, []byte{}), chk.IsNil) - - // generate lease. - leaseID, err := cli.AcquireLease(cnt, blob, 30, "") - c.Assert(err, chk.IsNil) - c.Assert(leaseID, chk.Not(chk.Equals), "") - - extraHeaders := map[string]string{ - headerLeaseID: "GolangRocksOnAzure", - } - - snapshotTime, err := cli.SnapshotBlob(cnt, blob, 0, extraHeaders) - c.Assert(err, chk.NotNil) - c.Assert(snapshotTime, chk.IsNil) -} - -func (s *StorageBlobSuite) TestAcquireLeaseWithNoProposedLeaseID(c *chk.C) { - cli := getBlobClient(c) - cnt := randContainer() - - c.Assert(cli.CreateContainer(cnt, ContainerAccessTypePrivate), chk.IsNil) - defer cli.deleteContainer(cnt) - - blob := randName(5) - c.Assert(cli.putSingleBlockBlob(cnt, blob, []byte{}), chk.IsNil) - - _, err := cli.AcquireLease(cnt, blob, 30, "") - c.Assert(err, chk.IsNil) -} - -func (s *StorageBlobSuite) TestAcquireLeaseWithProposedLeaseID(c *chk.C) { - cli := getBlobClient(c) - cnt := randContainer() - - c.Assert(cli.CreateContainer(cnt, ContainerAccessTypePrivate), chk.IsNil) - defer cli.deleteContainer(cnt) - - blob := randName(5) - c.Assert(cli.putSingleBlockBlob(cnt, blob, []byte{}), chk.IsNil) - - proposedLeaseID := "dfe6dde8-68d5-4910-9248-c97c61768fea" - leaseID, err := cli.AcquireLease(cnt, blob, 30, proposedLeaseID) - c.Assert(err, chk.IsNil) - c.Assert(leaseID, chk.Equals, proposedLeaseID) -} - -func (s *StorageBlobSuite) TestAcquireLeaseWithBadProposedLeaseID(c *chk.C) { - cli := getBlobClient(c) - cnt := randContainer() - - c.Assert(cli.CreateContainer(cnt, ContainerAccessTypePrivate), chk.IsNil) - defer cli.deleteContainer(cnt) - - blob := randName(5) - c.Assert(cli.putSingleBlockBlob(cnt, blob, []byte{}), chk.IsNil) - - proposedLeaseID := "badbadbad" - _, err := cli.AcquireLease(cnt, blob, 30, proposedLeaseID) - c.Assert(err, chk.NotNil) -} - -func (s *StorageBlobSuite) TestRenewLeaseSuccessful(c *chk.C) { - cli := getBlobClient(c) - cnt := randContainer() - - c.Assert(cli.CreateContainer(cnt, ContainerAccessTypePrivate), chk.IsNil) - defer cli.deleteContainer(cnt) - - blob := randName(5) - c.Assert(cli.putSingleBlockBlob(cnt, blob, []byte{}), chk.IsNil) - - proposedLeaseID := "dfe6dde8-68d5-4910-9248-c97c61768fea" - leaseID, err := cli.AcquireLease(cnt, blob, 30, proposedLeaseID) - c.Assert(err, chk.IsNil) - - err = cli.RenewLease(cnt, blob, leaseID) - c.Assert(err, chk.IsNil) -} - -func (s *StorageBlobSuite) TestRenewLeaseAgainstNoCurrentLease(c *chk.C) { - cli := getBlobClient(c) - cnt := randContainer() - - c.Assert(cli.CreateContainer(cnt, ContainerAccessTypePrivate), chk.IsNil) - defer cli.deleteContainer(cnt) - - blob := randName(5) - c.Assert(cli.putSingleBlockBlob(cnt, blob, []byte{}), chk.IsNil) - - badLeaseID := "1f812371-a41d-49e6-b123-f4b542e85144" - err := cli.RenewLease(cnt, blob, badLeaseID) - c.Assert(err, chk.NotNil) -} - -func (s *StorageBlobSuite) TestChangeLeaseSuccessful(c *chk.C) { - cli := getBlobClient(c) - cnt := randContainer() - - c.Assert(cli.CreateContainer(cnt, ContainerAccessTypePrivate), chk.IsNil) - defer cli.deleteContainer(cnt) - - blob := randName(5) - c.Assert(cli.putSingleBlockBlob(cnt, blob, []byte{}), chk.IsNil) - proposedLeaseID := "dfe6dde8-68d5-4910-9248-c97c61768fea" - leaseID, err := cli.AcquireLease(cnt, blob, 30, proposedLeaseID) - c.Assert(err, chk.IsNil) - - newProposedLeaseID := "dfe6dde8-68d5-4910-9248-c97c61768fbb" - newLeaseID, err := cli.ChangeLease(cnt, blob, leaseID, newProposedLeaseID) - c.Assert(err, chk.IsNil) - c.Assert(newLeaseID, chk.Equals, newProposedLeaseID) -} - -func (s *StorageBlobSuite) TestChangeLeaseNotSuccessfulbadProposedLeaseID(c *chk.C) { - cli := getBlobClient(c) - cnt := randContainer() - - c.Assert(cli.CreateContainer(cnt, ContainerAccessTypePrivate), chk.IsNil) - defer cli.deleteContainer(cnt) - - blob := randName(5) - c.Assert(cli.putSingleBlockBlob(cnt, blob, []byte{}), chk.IsNil) - proposedLeaseID := "dfe6dde8-68d5-4910-9248-c97c61768fea" - leaseID, err := cli.AcquireLease(cnt, blob, 30, proposedLeaseID) - c.Assert(err, chk.IsNil) - - newProposedLeaseID := "1f812371-a41d-49e6-b123-f4b542e" - _, err = cli.ChangeLease(cnt, blob, leaseID, newProposedLeaseID) - c.Assert(err, chk.NotNil) -} - -func (s *StorageBlobSuite) TestReleaseLeaseSuccessful(c *chk.C) { - cli := getBlobClient(c) - cnt := randContainer() - - c.Assert(cli.CreateContainer(cnt, ContainerAccessTypePrivate), chk.IsNil) - defer cli.deleteContainer(cnt) - - blob := randName(5) - c.Assert(cli.putSingleBlockBlob(cnt, blob, []byte{}), chk.IsNil) - proposedLeaseID := "dfe6dde8-68d5-4910-9248-c97c61768fea" - leaseID, err := cli.AcquireLease(cnt, blob, 30, proposedLeaseID) - c.Assert(err, chk.IsNil) - - err = cli.ReleaseLease(cnt, blob, leaseID) - c.Assert(err, chk.IsNil) -} - -func (s *StorageBlobSuite) TestReleaseLeaseNotSuccessfulBadLeaseID(c *chk.C) { - cli := getBlobClient(c) - cnt := randContainer() - - c.Assert(cli.CreateContainer(cnt, ContainerAccessTypePrivate), chk.IsNil) - defer cli.deleteContainer(cnt) - - blob := randName(5) - c.Assert(cli.putSingleBlockBlob(cnt, blob, []byte{}), chk.IsNil) - proposedLeaseID := "dfe6dde8-68d5-4910-9248-c97c61768fea" - _, err := cli.AcquireLease(cnt, blob, 30, proposedLeaseID) - c.Assert(err, chk.IsNil) - - err = cli.ReleaseLease(cnt, blob, "badleaseid") - c.Assert(err, chk.NotNil) -} - -func (s *StorageBlobSuite) TestBreakLeaseSuccessful(c *chk.C) { - cli := getBlobClient(c) - cnt := randContainer() - - c.Assert(cli.CreateContainer(cnt, ContainerAccessTypePrivate), chk.IsNil) - defer cli.deleteContainer(cnt) - - blob := randName(5) - c.Assert(cli.putSingleBlockBlob(cnt, blob, []byte{}), chk.IsNil) - - proposedLeaseID := "dfe6dde8-68d5-4910-9248-c97c61768fea" - _, err := cli.AcquireLease(cnt, blob, 30, proposedLeaseID) - c.Assert(err, chk.IsNil) - - _, err = cli.BreakLease(cnt, blob) - c.Assert(err, chk.IsNil) -} - -func (s *StorageBlobSuite) TestPutEmptyBlockBlob(c *chk.C) { - cli := getBlobClient(c) - cnt := randContainer() - - c.Assert(cli.CreateContainer(cnt, ContainerAccessTypePrivate), chk.IsNil) - defer cli.deleteContainer(cnt) - - blob := randName(5) - c.Assert(cli.putSingleBlockBlob(cnt, blob, []byte{}), chk.IsNil) - - props, err := cli.GetBlobProperties(cnt, blob) - c.Assert(err, chk.IsNil) - c.Assert(props.ContentLength, chk.Not(chk.Equals), 0) -} - -func (s *StorageBlobSuite) TestGetBlobRange(c *chk.C) { - cnt := randContainer() - blob := randName(5) - body := "0123456789" - - cli := getBlobClient(c) - c.Assert(cli.CreateContainer(cnt, ContainerAccessTypeBlob), chk.IsNil) - defer cli.DeleteContainer(cnt) - - c.Assert(cli.putSingleBlockBlob(cnt, blob, []byte(body)), chk.IsNil) - defer cli.DeleteBlob(cnt, blob, nil) - - // Read 1-3 - for _, r := range []struct { - rangeStr string - expected string - }{ - {"0-", body}, - {"1-3", body[1 : 3+1]}, - {"3-", body[3:]}, - } { - resp, err := cli.GetBlobRange(cnt, blob, r.rangeStr, nil) - c.Assert(err, chk.IsNil) - blobBody, err := ioutil.ReadAll(resp) - c.Assert(err, chk.IsNil) - - str := string(blobBody) - c.Assert(str, chk.Equals, r.expected) - } -} - -func (s *StorageBlobSuite) TestCreateBlockBlobFromReader(c *chk.C) { - cli := getBlobClient(c) - cnt := randContainer() - c.Assert(cli.CreateContainer(cnt, ContainerAccessTypePrivate), chk.IsNil) - defer cli.deleteContainer(cnt) - - name := randName(5) - data := randBytes(8888) - c.Assert(cli.CreateBlockBlobFromReader(cnt, name, uint64(len(data)), bytes.NewReader(data), nil), chk.IsNil) - - body, err := cli.GetBlob(cnt, name) - c.Assert(err, chk.IsNil) - gotData, err := ioutil.ReadAll(body) - body.Close() - - c.Assert(err, chk.IsNil) - c.Assert(gotData, chk.DeepEquals, data) -} - -func (s *StorageBlobSuite) TestCreateBlockBlobFromReaderWithShortData(c *chk.C) { - cli := getBlobClient(c) - cnt := randContainer() - c.Assert(cli.CreateContainer(cnt, ContainerAccessTypePrivate), chk.IsNil) - defer cli.deleteContainer(cnt) - - name := randName(5) - data := randBytes(8888) - err := cli.CreateBlockBlobFromReader(cnt, name, 9999, bytes.NewReader(data), nil) - c.Assert(err, chk.Not(chk.IsNil)) - - _, err = cli.GetBlob(cnt, name) - // Upload was incomplete: blob should not have been created. - c.Assert(err, chk.Not(chk.IsNil)) -} - -func (s *StorageBlobSuite) TestPutBlock(c *chk.C) { - cli := getBlobClient(c) - cnt := randContainer() - c.Assert(cli.CreateContainer(cnt, ContainerAccessTypePrivate), chk.IsNil) - defer cli.deleteContainer(cnt) - - blob := randName(5) - chunk := []byte(randString(1024)) - blockID := base64.StdEncoding.EncodeToString([]byte("foo")) - c.Assert(cli.PutBlock(cnt, blob, blockID, chunk), chk.IsNil) -} - -func (s *StorageBlobSuite) TestGetBlockList_PutBlockList(c *chk.C) { - cli := getBlobClient(c) - cnt := randContainer() - c.Assert(cli.CreateContainer(cnt, ContainerAccessTypePrivate), chk.IsNil) - defer cli.deleteContainer(cnt) - - blob := randName(5) - chunk := []byte(randString(1024)) - blockID := base64.StdEncoding.EncodeToString([]byte("foo")) - - // Put one block - c.Assert(cli.PutBlock(cnt, blob, blockID, chunk), chk.IsNil) - defer cli.deleteBlob(cnt, blob, nil) - - // Get committed blocks - committed, err := cli.GetBlockList(cnt, blob, BlockListTypeCommitted) - c.Assert(err, chk.IsNil) - - if len(committed.CommittedBlocks) > 0 { - c.Fatal("There are committed blocks") - } - - // Get uncommitted blocks - uncommitted, err := cli.GetBlockList(cnt, blob, BlockListTypeUncommitted) - c.Assert(err, chk.IsNil) - - c.Assert(len(uncommitted.UncommittedBlocks), chk.Equals, 1) - // Commit block list - c.Assert(cli.PutBlockList(cnt, blob, []Block{{blockID, BlockStatusUncommitted}}), chk.IsNil) - - // Get all blocks - all, err := cli.GetBlockList(cnt, blob, BlockListTypeAll) - c.Assert(err, chk.IsNil) - c.Assert(len(all.CommittedBlocks), chk.Equals, 1) - c.Assert(len(all.UncommittedBlocks), chk.Equals, 0) - - // Verify the block - thatBlock := all.CommittedBlocks[0] - c.Assert(thatBlock.Name, chk.Equals, blockID) - c.Assert(thatBlock.Size, chk.Equals, int64(len(chunk))) -} - -func (s *StorageBlobSuite) TestCreateBlockBlob(c *chk.C) { - cli := getBlobClient(c) - cnt := randContainer() - c.Assert(cli.CreateContainer(cnt, ContainerAccessTypePrivate), chk.IsNil) - defer cli.deleteContainer(cnt) - - blob := randName(5) - c.Assert(cli.CreateBlockBlob(cnt, blob), chk.IsNil) - - // Verify - blocks, err := cli.GetBlockList(cnt, blob, BlockListTypeAll) - c.Assert(err, chk.IsNil) - c.Assert(len(blocks.CommittedBlocks), chk.Equals, 0) - c.Assert(len(blocks.UncommittedBlocks), chk.Equals, 0) -} - -func (s *StorageBlobSuite) TestPutPageBlob(c *chk.C) { - cli := getBlobClient(c) - cnt := randContainer() - c.Assert(cli.CreateContainer(cnt, ContainerAccessTypePrivate), chk.IsNil) - defer cli.deleteContainer(cnt) - - blob := randName(5) - size := int64(10 * 1024 * 1024) - c.Assert(cli.PutPageBlob(cnt, blob, size, nil), chk.IsNil) - - // Verify - props, err := cli.GetBlobProperties(cnt, blob) - c.Assert(err, chk.IsNil) - c.Assert(props.ContentLength, chk.Equals, size) - c.Assert(props.BlobType, chk.Equals, BlobTypePage) -} - -func (s *StorageBlobSuite) TestPutPagesUpdate(c *chk.C) { - cli := getBlobClient(c) - cnt := randContainer() - c.Assert(cli.CreateContainer(cnt, ContainerAccessTypePrivate), chk.IsNil) - defer cli.deleteContainer(cnt) - - blob := randName(5) - size := int64(10 * 1024 * 1024) // larger than we'll use - c.Assert(cli.PutPageBlob(cnt, blob, size, nil), chk.IsNil) - - chunk1 := []byte(randString(1024)) - chunk2 := []byte(randString(512)) - - // Append chunks - c.Assert(cli.PutPage(cnt, blob, 0, int64(len(chunk1)-1), PageWriteTypeUpdate, chunk1, nil), chk.IsNil) - c.Assert(cli.PutPage(cnt, blob, int64(len(chunk1)), int64(len(chunk1)+len(chunk2)-1), PageWriteTypeUpdate, chunk2, nil), chk.IsNil) - - // Verify contents - out, err := cli.GetBlobRange(cnt, blob, fmt.Sprintf("%v-%v", 0, len(chunk1)+len(chunk2)-1), nil) - c.Assert(err, chk.IsNil) - defer out.Close() - blobContents, err := ioutil.ReadAll(out) - c.Assert(err, chk.IsNil) - c.Assert(blobContents, chk.DeepEquals, append(chunk1, chunk2...)) - out.Close() - - // Overwrite first half of chunk1 - chunk0 := []byte(randString(512)) - c.Assert(cli.PutPage(cnt, blob, 0, int64(len(chunk0)-1), PageWriteTypeUpdate, chunk0, nil), chk.IsNil) - - // Verify contents - out, err = cli.GetBlobRange(cnt, blob, fmt.Sprintf("%v-%v", 0, len(chunk1)+len(chunk2)-1), nil) - c.Assert(err, chk.IsNil) - defer out.Close() - blobContents, err = ioutil.ReadAll(out) - c.Assert(err, chk.IsNil) - c.Assert(blobContents, chk.DeepEquals, append(append(chunk0, chunk1[512:]...), chunk2...)) -} - -func (s *StorageBlobSuite) TestPutPagesClear(c *chk.C) { - cli := getBlobClient(c) - cnt := randContainer() - c.Assert(cli.CreateContainer(cnt, ContainerAccessTypePrivate), chk.IsNil) - defer cli.deleteContainer(cnt) - - blob := randName(5) - size := int64(10 * 1024 * 1024) // larger than we'll use - c.Assert(cli.PutPageBlob(cnt, blob, size, nil), chk.IsNil) - - // Put 0-2047 - chunk := []byte(randString(2048)) - c.Assert(cli.PutPage(cnt, blob, 0, 2047, PageWriteTypeUpdate, chunk, nil), chk.IsNil) - - // Clear 512-1023 - c.Assert(cli.PutPage(cnt, blob, 512, 1023, PageWriteTypeClear, nil, nil), chk.IsNil) - - // Verify contents - out, err := cli.GetBlobRange(cnt, blob, "0-2047", nil) - c.Assert(err, chk.IsNil) - contents, err := ioutil.ReadAll(out) - c.Assert(err, chk.IsNil) - defer out.Close() - c.Assert(contents, chk.DeepEquals, append(append(chunk[:512], make([]byte, 512)...), chunk[1024:]...)) -} - -func (s *StorageBlobSuite) TestGetPageRanges(c *chk.C) { - cli := getBlobClient(c) - cnt := randContainer() - c.Assert(cli.CreateContainer(cnt, ContainerAccessTypePrivate), chk.IsNil) - defer cli.deleteContainer(cnt) - - blob := randName(5) - size := int64(10 * 1024 * 1024) // larger than we'll use - c.Assert(cli.PutPageBlob(cnt, blob, size, nil), chk.IsNil) - - // Get page ranges on empty blob - out, err := cli.GetPageRanges(cnt, blob) - c.Assert(err, chk.IsNil) - c.Assert(len(out.PageList), chk.Equals, 0) - - // Add 0-512 page - c.Assert(cli.PutPage(cnt, blob, 0, 511, PageWriteTypeUpdate, []byte(randString(512)), nil), chk.IsNil) - - out, err = cli.GetPageRanges(cnt, blob) - c.Assert(err, chk.IsNil) - c.Assert(len(out.PageList), chk.Equals, 1) - - // Add 1024-2048 - c.Assert(cli.PutPage(cnt, blob, 1024, 2047, PageWriteTypeUpdate, []byte(randString(1024)), nil), chk.IsNil) - - out, err = cli.GetPageRanges(cnt, blob) - c.Assert(err, chk.IsNil) - c.Assert(len(out.PageList), chk.Equals, 2) -} - -func (s *StorageBlobSuite) TestPutAppendBlob(c *chk.C) { - cli := getBlobClient(c) - cnt := randContainer() - c.Assert(cli.CreateContainer(cnt, ContainerAccessTypePrivate), chk.IsNil) - defer cli.deleteContainer(cnt) - - blob := randName(5) - c.Assert(cli.PutAppendBlob(cnt, blob, nil), chk.IsNil) - - // Verify - props, err := cli.GetBlobProperties(cnt, blob) - c.Assert(err, chk.IsNil) - c.Assert(props.ContentLength, chk.Equals, int64(0)) - c.Assert(props.BlobType, chk.Equals, BlobTypeAppend) -} - -func (s *StorageBlobSuite) TestPutAppendBlobAppendBlocks(c *chk.C) { - cli := getBlobClient(c) - cnt := randContainer() - c.Assert(cli.CreateContainer(cnt, ContainerAccessTypePrivate), chk.IsNil) - defer cli.deleteContainer(cnt) - - blob := randName(5) - c.Assert(cli.PutAppendBlob(cnt, blob, nil), chk.IsNil) - - chunk1 := []byte(randString(1024)) - chunk2 := []byte(randString(512)) - - // Append first block - c.Assert(cli.AppendBlock(cnt, blob, chunk1, nil), chk.IsNil) - - // Verify contents - out, err := cli.GetBlobRange(cnt, blob, fmt.Sprintf("%v-%v", 0, len(chunk1)-1), nil) - c.Assert(err, chk.IsNil) - defer out.Close() - blobContents, err := ioutil.ReadAll(out) - c.Assert(err, chk.IsNil) - c.Assert(blobContents, chk.DeepEquals, chunk1) - out.Close() - - // Append second block - c.Assert(cli.AppendBlock(cnt, blob, chunk2, nil), chk.IsNil) - - // Verify contents - out, err = cli.GetBlobRange(cnt, blob, fmt.Sprintf("%v-%v", 0, len(chunk1)+len(chunk2)-1), nil) - c.Assert(err, chk.IsNil) - defer out.Close() - blobContents, err = ioutil.ReadAll(out) - c.Assert(err, chk.IsNil) - c.Assert(blobContents, chk.DeepEquals, append(chunk1, chunk2...)) - out.Close() -} - -func deleteTestContainers(cli BlobStorageClient) error { - for { - resp, err := cli.ListContainers(ListContainersParameters{Prefix: testContainerPrefix}) - if err != nil { - return err - } - if len(resp.Containers) == 0 { - break - } - for _, c := range resp.Containers { - err = cli.DeleteContainer(c.Name) - if err != nil { - return err - } - } - } - return nil -} - -func (b BlobStorageClient) putSingleBlockBlob(container, name string, chunk []byte) error { - if len(chunk) > MaxBlobBlockSize { - return fmt.Errorf("storage: provided chunk (%d bytes) cannot fit into single-block blob (max %d bytes)", len(chunk), MaxBlobBlockSize) - } - - uri := b.client.getEndpoint(blobServiceName, pathForBlob(container, name), url.Values{}) - headers := b.client.getStandardHeaders() - headers["x-ms-blob-type"] = string(BlobTypeBlock) - headers["Content-Length"] = fmt.Sprintf("%v", len(chunk)) - - resp, err := b.client.exec(http.MethodPut, uri, headers, bytes.NewReader(chunk), b.auth) - if err != nil { - return err - } - return checkRespCode(resp.statusCode, []int{http.StatusCreated}) -} - -func (s *StorageBlobSuite) TestPutAppendBlobSpecialChars(c *chk.C) { - cli := getBlobClient(c) - cnt := randContainer() - c.Assert(cli.CreateContainer(cnt, ContainerAccessTypePrivate), chk.IsNil) - defer cli.deleteContainer(cnt) - - blob := randNameWithSpecialChars(5) - c.Assert(cli.PutAppendBlob(cnt, blob, nil), chk.IsNil) - - // Verify metadata - props, err := cli.GetBlobProperties(cnt, blob) - c.Assert(err, chk.IsNil) - c.Assert(props.ContentLength, chk.Equals, int64(0)) - c.Assert(props.BlobType, chk.Equals, BlobTypeAppend) - - chunk1 := []byte(randString(1024)) - chunk2 := []byte(randString(512)) - - // Append first block - c.Assert(cli.AppendBlock(cnt, blob, chunk1, nil), chk.IsNil) - - // Verify contents - out, err := cli.GetBlobRange(cnt, blob, fmt.Sprintf("%v-%v", 0, len(chunk1)-1), nil) - c.Assert(err, chk.IsNil) - defer out.Close() - blobContents, err := ioutil.ReadAll(out) - c.Assert(err, chk.IsNil) - c.Assert(blobContents, chk.DeepEquals, chunk1) - out.Close() - - // Append second block - c.Assert(cli.AppendBlock(cnt, blob, chunk2, nil), chk.IsNil) - - // Verify contents - out, err = cli.GetBlobRange(cnt, blob, fmt.Sprintf("%v-%v", 0, len(chunk1)+len(chunk2)-1), nil) - c.Assert(err, chk.IsNil) - defer out.Close() - blobContents, err = ioutil.ReadAll(out) - c.Assert(err, chk.IsNil) - c.Assert(blobContents, chk.DeepEquals, append(chunk1, chunk2...)) - out.Close() -} - -func randContainer() string { - return testContainerPrefix + randString(32-len(testContainerPrefix)) -} - -func randString(n int) string { - if n <= 0 { - panic("negative number") - } - const alphanum = "0123456789abcdefghijklmnopqrstuvwxyz" - var bytes = make([]byte, n) - rand.Read(bytes) - for i, b := range bytes { - bytes[i] = alphanum[b%byte(len(alphanum))] - } - return string(bytes) -} - -func randBytes(n int) []byte { - data := make([]byte, n) - if _, err := io.ReadFull(rand.Reader, data); err != nil { - panic(err) - } - return data -} - -func randName(n int) string { - name := randString(n) + "/" + randString(n) - return name -} - -func randNameWithSpecialChars(n int) string { - name := randString(n) + "/" + randString(n) + "-._~:?#[]@!$&'()*,;+= " + randString(n) - return name -} diff --git a/storage/client.go b/storage/client.go deleted file mode 100644 index 817f934c5cdd..000000000000 --- a/storage/client.go +++ /dev/null @@ -1,469 +0,0 @@ -// Package storage provides clients for Microsoft Azure Storage Services. -package storage - -import ( - "bytes" - "encoding/base64" - "encoding/json" - "encoding/xml" - "errors" - "fmt" - "io" - "io/ioutil" - "net/http" - "net/url" - "runtime" - "strconv" - "strings" -) - -const ( - // DefaultBaseURL is the domain name used for storage requests when a - // default client is created. - DefaultBaseURL = "core.windows.net" - - // DefaultAPIVersion is the Azure Storage API version string used when a - // basic client is created. - DefaultAPIVersion = "2015-02-21" - - defaultUseHTTPS = true - - // StorageEmulatorAccountName is the fixed storage account used by Azure Storage Emulator - StorageEmulatorAccountName = "devstoreaccount1" - - // StorageEmulatorAccountKey is the the fixed storage account used by Azure Storage Emulator - StorageEmulatorAccountKey = "Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==" - - blobServiceName = "blob" - tableServiceName = "table" - queueServiceName = "queue" - fileServiceName = "file" - - storageEmulatorBlob = "127.0.0.1:10000" - storageEmulatorTable = "127.0.0.1:10002" - storageEmulatorQueue = "127.0.0.1:10001" - - userAgentHeader = "User-Agent" -) - -// Client is the object that needs to be constructed to perform -// operations on the storage account. -type Client struct { - // HTTPClient is the http.Client used to initiate API - // requests. If it is nil, http.DefaultClient is used. - HTTPClient *http.Client - - accountName string - accountKey []byte - useHTTPS bool - UseSharedKeyLite bool - baseURL string - apiVersion string - userAgent string -} - -type storageResponse struct { - statusCode int - headers http.Header - body io.ReadCloser -} - -type odataResponse struct { - storageResponse - odata odataErrorMessage -} - -// AzureStorageServiceError contains fields of the error response from -// Azure Storage Service REST API. See https://msdn.microsoft.com/en-us/library/azure/dd179382.aspx -// Some fields might be specific to certain calls. -type AzureStorageServiceError struct { - Code string `xml:"Code"` - Message string `xml:"Message"` - AuthenticationErrorDetail string `xml:"AuthenticationErrorDetail"` - QueryParameterName string `xml:"QueryParameterName"` - QueryParameterValue string `xml:"QueryParameterValue"` - Reason string `xml:"Reason"` - StatusCode int - RequestID string -} - -type odataErrorMessageMessage struct { - Lang string `json:"lang"` - Value string `json:"value"` -} - -type odataErrorMessageInternal struct { - Code string `json:"code"` - Message odataErrorMessageMessage `json:"message"` -} - -type odataErrorMessage struct { - Err odataErrorMessageInternal `json:"odata.error"` -} - -// UnexpectedStatusCodeError is returned when a storage service responds with neither an error -// nor with an HTTP status code indicating success. -type UnexpectedStatusCodeError struct { - allowed []int - got int -} - -func (e UnexpectedStatusCodeError) Error() string { - s := func(i int) string { return fmt.Sprintf("%d %s", i, http.StatusText(i)) } - - got := s(e.got) - expected := []string{} - for _, v := range e.allowed { - expected = append(expected, s(v)) - } - return fmt.Sprintf("storage: status code from service response is %s; was expecting %s", got, strings.Join(expected, " or ")) -} - -// Got is the actual status code returned by Azure. -func (e UnexpectedStatusCodeError) Got() int { - return e.got -} - -// NewBasicClient constructs a Client with given storage service name and -// key. -func NewBasicClient(accountName, accountKey string) (Client, error) { - if accountName == StorageEmulatorAccountName { - return NewEmulatorClient() - } - return NewClient(accountName, accountKey, DefaultBaseURL, DefaultAPIVersion, defaultUseHTTPS) - -} - -//NewEmulatorClient contructs a Client intended to only work with Azure -//Storage Emulator -func NewEmulatorClient() (Client, error) { - return NewClient(StorageEmulatorAccountName, StorageEmulatorAccountKey, DefaultBaseURL, DefaultAPIVersion, false) -} - -// NewClient constructs a Client. This should be used if the caller wants -// to specify whether to use HTTPS, a specific REST API version or a custom -// storage endpoint than Azure Public Cloud. -func NewClient(accountName, accountKey, blobServiceBaseURL, apiVersion string, useHTTPS bool) (Client, error) { - var c Client - if accountName == "" { - return c, fmt.Errorf("azure: account name required") - } else if accountKey == "" { - return c, fmt.Errorf("azure: account key required") - } else if blobServiceBaseURL == "" { - return c, fmt.Errorf("azure: base storage service url required") - } - - key, err := base64.StdEncoding.DecodeString(accountKey) - if err != nil { - return c, fmt.Errorf("azure: malformed storage account key: %v", err) - } - - c = Client{ - accountName: accountName, - accountKey: key, - useHTTPS: useHTTPS, - baseURL: blobServiceBaseURL, - apiVersion: apiVersion, - UseSharedKeyLite: false, - } - c.userAgent = c.getDefaultUserAgent() - return c, nil -} - -func (c Client) getDefaultUserAgent() string { - return fmt.Sprintf("Go/%s (%s-%s) Azure-SDK-For-Go/%s storage-dataplane/%s", - runtime.Version(), - runtime.GOARCH, - runtime.GOOS, - sdkVersion, - c.apiVersion, - ) -} - -// AddToUserAgent adds an extension to the current user agent -func (c *Client) AddToUserAgent(extension string) error { - if extension != "" { - c.userAgent = fmt.Sprintf("%s %s", c.userAgent, extension) - return nil - } - return fmt.Errorf("Extension was empty, User Agent stayed as %s", c.userAgent) -} - -// protectUserAgent is used in funcs that include extraheaders as a parameter. -// It prevents the User-Agent header to be overwritten, instead if it happens to -// be present, it gets added to the current User-Agent. Use it before getStandardHeaders -func (c *Client) protectUserAgent(extraheaders map[string]string) map[string]string { - if v, ok := extraheaders[userAgentHeader]; ok { - c.AddToUserAgent(v) - delete(extraheaders, userAgentHeader) - } - return extraheaders -} - -func (c Client) getBaseURL(service string) string { - scheme := "http" - if c.useHTTPS { - scheme = "https" - } - host := "" - if c.accountName == StorageEmulatorAccountName { - switch service { - case blobServiceName: - host = storageEmulatorBlob - case tableServiceName: - host = storageEmulatorTable - case queueServiceName: - host = storageEmulatorQueue - } - } else { - host = fmt.Sprintf("%s.%s.%s", c.accountName, service, c.baseURL) - } - - u := &url.URL{ - Scheme: scheme, - Host: host} - return u.String() -} - -func (c Client) getEndpoint(service, path string, params url.Values) string { - u, err := url.Parse(c.getBaseURL(service)) - if err != nil { - // really should not be happening - panic(err) - } - - // API doesn't accept path segments not starting with '/' - if !strings.HasPrefix(path, "/") { - path = fmt.Sprintf("/%v", path) - } - - if c.accountName == StorageEmulatorAccountName { - path = fmt.Sprintf("/%v%v", StorageEmulatorAccountName, path) - } - - u.Path = path - u.RawQuery = params.Encode() - return u.String() -} - -// GetBlobService returns a BlobStorageClient which can operate on the blob -// service of the storage account. -func (c Client) GetBlobService() BlobStorageClient { - b := BlobStorageClient{ - client: c, - } - b.client.AddToUserAgent(blobServiceName) - b.auth = sharedKey - if c.UseSharedKeyLite { - b.auth = sharedKeyLite - } - return b -} - -// GetQueueService returns a QueueServiceClient which can operate on the queue -// service of the storage account. -func (c Client) GetQueueService() QueueServiceClient { - q := QueueServiceClient{ - client: c, - } - q.client.AddToUserAgent(queueServiceName) - q.auth = sharedKey - if c.UseSharedKeyLite { - q.auth = sharedKeyLite - } - return q -} - -// GetTableService returns a TableServiceClient which can operate on the table -// service of the storage account. -func (c Client) GetTableService() TableServiceClient { - t := TableServiceClient{ - client: c, - } - t.client.AddToUserAgent(tableServiceName) - t.auth = sharedKeyForTable - if c.UseSharedKeyLite { - t.auth = sharedKeyLiteForTable - } - return t -} - -// GetFileService returns a FileServiceClient which can operate on the file -// service of the storage account. -func (c Client) GetFileService() FileServiceClient { - f := FileServiceClient{ - client: c, - } - f.client.AddToUserAgent(fileServiceName) - f.auth = sharedKey - if c.UseSharedKeyLite { - f.auth = sharedKeyLite - } - return f -} - -func (c Client) getStandardHeaders() map[string]string { - return map[string]string{ - userAgentHeader: c.userAgent, - "x-ms-version": c.apiVersion, - "x-ms-date": currentTimeRfc1123Formatted(), - } -} - -func (c Client) exec(verb, url string, headers map[string]string, body io.Reader, auth authentication) (*storageResponse, error) { - headers, err := c.addAuthorizationHeader(verb, url, headers, auth) - if err != nil { - return nil, err - } - - req, err := http.NewRequest(verb, url, body) - if err != nil { - return nil, errors.New("azure/storage: error creating request: " + err.Error()) - } - - if clstr, ok := headers["Content-Length"]; ok { - // content length header is being signed, but completely ignored by golang. - // instead we have to use the ContentLength property on the request struct - // (see https://golang.org/src/net/http/request.go?s=18140:18370#L536 and - // https://golang.org/src/net/http/transfer.go?s=1739:2467#L49) - req.ContentLength, err = strconv.ParseInt(clstr, 10, 64) - if err != nil { - return nil, err - } - } - for k, v := range headers { - req.Header.Add(k, v) - } - - httpClient := c.HTTPClient - if httpClient == nil { - httpClient = http.DefaultClient - } - resp, err := httpClient.Do(req) - if err != nil { - return nil, err - } - - statusCode := resp.StatusCode - if statusCode >= 400 && statusCode <= 505 { - var respBody []byte - respBody, err = readResponseBody(resp) - if err != nil { - return nil, err - } - - requestID := resp.Header.Get("x-ms-request-id") - if len(respBody) == 0 { - // no error in response body, might happen in HEAD requests - err = serviceErrFromStatusCode(resp.StatusCode, resp.Status, requestID) - } else { - // response contains storage service error object, unmarshal - storageErr, errIn := serviceErrFromXML(respBody, resp.StatusCode, requestID) - if err != nil { // error unmarshaling the error response - err = errIn - } - err = storageErr - } - return &storageResponse{ - statusCode: resp.StatusCode, - headers: resp.Header, - body: ioutil.NopCloser(bytes.NewReader(respBody)), /* restore the body */ - }, err - } - - return &storageResponse{ - statusCode: resp.StatusCode, - headers: resp.Header, - body: resp.Body}, nil -} - -func (c Client) execInternalJSON(verb, url string, headers map[string]string, body io.Reader, auth authentication) (*odataResponse, error) { - headers, err := c.addAuthorizationHeader(verb, url, headers, auth) - if err != nil { - return nil, err - } - - req, err := http.NewRequest(verb, url, body) - for k, v := range headers { - req.Header.Add(k, v) - } - - httpClient := c.HTTPClient - if httpClient == nil { - httpClient = http.DefaultClient - } - - resp, err := httpClient.Do(req) - if err != nil { - return nil, err - } - - respToRet := &odataResponse{} - respToRet.body = resp.Body - respToRet.statusCode = resp.StatusCode - respToRet.headers = resp.Header - - statusCode := resp.StatusCode - if statusCode >= 400 && statusCode <= 505 { - var respBody []byte - respBody, err = readResponseBody(resp) - if err != nil { - return nil, err - } - - if len(respBody) == 0 { - // no error in response body, might happen in HEAD requests - err = serviceErrFromStatusCode(resp.StatusCode, resp.Status, resp.Header.Get("x-ms-request-id")) - return respToRet, err - } - // try unmarshal as odata.error json - err = json.Unmarshal(respBody, &respToRet.odata) - return respToRet, err - } - - return respToRet, nil -} - -func readResponseBody(resp *http.Response) ([]byte, error) { - defer resp.Body.Close() - out, err := ioutil.ReadAll(resp.Body) - if err == io.EOF { - err = nil - } - return out, err -} - -func serviceErrFromXML(body []byte, statusCode int, requestID string) (AzureStorageServiceError, error) { - var storageErr AzureStorageServiceError - if err := xml.Unmarshal(body, &storageErr); err != nil { - return storageErr, err - } - storageErr.StatusCode = statusCode - storageErr.RequestID = requestID - return storageErr, nil -} - -func serviceErrFromStatusCode(code int, status string, requestID string) AzureStorageServiceError { - return AzureStorageServiceError{ - StatusCode: code, - Code: status, - RequestID: requestID, - Message: "no response body was available for error status code", - } -} - -func (e AzureStorageServiceError) Error() string { - return fmt.Sprintf("storage: service returned error: StatusCode=%d, ErrorCode=%s, ErrorMessage=%s, RequestId=%s, QueryParameterName=%s, QueryParameterValue=%s", - e.StatusCode, e.Code, e.Message, e.RequestID, e.QueryParameterName, e.QueryParameterValue) -} - -// checkRespCode returns UnexpectedStatusError if the given response code is not -// one of the allowed status codes; otherwise nil. -func checkRespCode(respCode int, allowed []int) error { - for _, v := range allowed { - if respCode == v { - return nil - } - } - return UnexpectedStatusCodeError{allowed, respCode} -} diff --git a/storage/client_test.go b/storage/client_test.go deleted file mode 100644 index 04ea80bbb31b..000000000000 --- a/storage/client_test.go +++ /dev/null @@ -1,244 +0,0 @@ -package storage - -import ( - "encoding/base64" - "net/http" - "net/url" - "os" - "testing" - "time" - - chk "gopkg.in/check.v1" -) - -// Hook up gocheck to testing -func Test(t *testing.T) { chk.TestingT(t) } - -type StorageClientSuite struct{} - -var _ = chk.Suite(&StorageClientSuite{}) - -var now = time.Now() - -// getBasicClient returns a test client from storage credentials in the env -func getBasicClient(c *chk.C) Client { - name := os.Getenv("ACCOUNT_NAME") - if name == "" { - c.Fatal("ACCOUNT_NAME not set, need an empty storage account to test") - } - key := os.Getenv("ACCOUNT_KEY") - if key == "" { - c.Fatal("ACCOUNT_KEY not set") - } - cli, err := NewBasicClient(name, key) - c.Assert(err, chk.IsNil) - return cli -} - -//getEmulatorClient returns a test client for Azure Storeage Emulator -func getEmulatorClient(c *chk.C) Client { - cli, err := NewBasicClient(StorageEmulatorAccountName, "") - c.Assert(err, chk.IsNil) - return cli -} - -func (s *StorageClientSuite) TestNewEmulatorClient(c *chk.C) { - cli, err := NewBasicClient(StorageEmulatorAccountName, "") - c.Assert(err, chk.IsNil) - c.Assert(cli.accountName, chk.Equals, StorageEmulatorAccountName) - expectedKey, err := base64.StdEncoding.DecodeString(StorageEmulatorAccountKey) - c.Assert(err, chk.IsNil) - c.Assert(cli.accountKey, chk.DeepEquals, expectedKey) -} - -func (s *StorageClientSuite) TestMalformedKeyError(c *chk.C) { - _, err := NewBasicClient("foo", "malformed") - c.Assert(err, chk.ErrorMatches, "azure: malformed storage account key: .*") -} - -func (s *StorageClientSuite) TestGetBaseURL_Basic_Https(c *chk.C) { - cli, err := NewBasicClient("foo", "YmFy") - c.Assert(err, chk.IsNil) - c.Assert(cli.apiVersion, chk.Equals, DefaultAPIVersion) - c.Assert(err, chk.IsNil) - c.Assert(cli.getBaseURL("table"), chk.Equals, "https://foo.table.core.windows.net") -} - -func (s *StorageClientSuite) TestGetBaseURL_Custom_NoHttps(c *chk.C) { - apiVersion := "2015-01-01" // a non existing one - cli, err := NewClient("foo", "YmFy", "core.chinacloudapi.cn", apiVersion, false) - c.Assert(err, chk.IsNil) - c.Assert(cli.apiVersion, chk.Equals, apiVersion) - c.Assert(cli.getBaseURL("table"), chk.Equals, "http://foo.table.core.chinacloudapi.cn") -} - -func (s *StorageClientSuite) TestGetBaseURL_StorageEmulator(c *chk.C) { - cli, err := NewBasicClient(StorageEmulatorAccountName, StorageEmulatorAccountKey) - c.Assert(err, chk.IsNil) - - type test struct{ service, expected string } - tests := []test{ - {blobServiceName, "http://127.0.0.1:10000"}, - {tableServiceName, "http://127.0.0.1:10002"}, - {queueServiceName, "http://127.0.0.1:10001"}, - } - for _, i := range tests { - baseURL := cli.getBaseURL(i.service) - c.Assert(baseURL, chk.Equals, i.expected) - } -} - -func (s *StorageClientSuite) TestGetEndpoint_None(c *chk.C) { - cli, err := NewBasicClient("foo", "YmFy") - c.Assert(err, chk.IsNil) - output := cli.getEndpoint(blobServiceName, "", url.Values{}) - c.Assert(output, chk.Equals, "https://foo.blob.core.windows.net/") -} - -func (s *StorageClientSuite) TestGetEndpoint_PathOnly(c *chk.C) { - cli, err := NewBasicClient("foo", "YmFy") - c.Assert(err, chk.IsNil) - output := cli.getEndpoint(blobServiceName, "path", url.Values{}) - c.Assert(output, chk.Equals, "https://foo.blob.core.windows.net/path") -} - -func (s *StorageClientSuite) TestGetEndpoint_ParamsOnly(c *chk.C) { - cli, err := NewBasicClient("foo", "YmFy") - c.Assert(err, chk.IsNil) - params := url.Values{} - params.Set("a", "b") - params.Set("c", "d") - output := cli.getEndpoint(blobServiceName, "", params) - c.Assert(output, chk.Equals, "https://foo.blob.core.windows.net/?a=b&c=d") -} - -func (s *StorageClientSuite) TestGetEndpoint_Mixed(c *chk.C) { - cli, err := NewBasicClient("foo", "YmFy") - c.Assert(err, chk.IsNil) - params := url.Values{} - params.Set("a", "b") - params.Set("c", "d") - output := cli.getEndpoint(blobServiceName, "path", params) - c.Assert(output, chk.Equals, "https://foo.blob.core.windows.net/path?a=b&c=d") -} - -func (s *StorageClientSuite) TestGetEndpoint_StorageEmulator(c *chk.C) { - cli, err := NewBasicClient(StorageEmulatorAccountName, StorageEmulatorAccountKey) - c.Assert(err, chk.IsNil) - - type test struct{ service, expected string } - tests := []test{ - {blobServiceName, "http://127.0.0.1:10000/devstoreaccount1/"}, - {tableServiceName, "http://127.0.0.1:10002/devstoreaccount1/"}, - {queueServiceName, "http://127.0.0.1:10001/devstoreaccount1/"}, - } - for _, i := range tests { - endpoint := cli.getEndpoint(i.service, "", url.Values{}) - c.Assert(endpoint, chk.Equals, i.expected) - } -} - -func (s *StorageClientSuite) Test_getStandardHeaders(c *chk.C) { - cli, err := NewBasicClient("foo", "YmFy") - c.Assert(err, chk.IsNil) - - headers := cli.getStandardHeaders() - c.Assert(len(headers), chk.Equals, 3) - c.Assert(headers["x-ms-version"], chk.Equals, cli.apiVersion) - if _, ok := headers["x-ms-date"]; !ok { - c.Fatal("Missing date header") - } - c.Assert(headers[userAgentHeader], chk.Equals, cli.getDefaultUserAgent()) -} - -func (s *StorageClientSuite) TestReturnsStorageServiceError(c *chk.C) { - // attempt to delete a nonexisting container - _, err := getBlobClient(c).deleteContainer(randContainer()) - c.Assert(err, chk.NotNil) - - v, ok := err.(AzureStorageServiceError) - c.Check(ok, chk.Equals, true) - c.Assert(v.StatusCode, chk.Equals, 404) - c.Assert(v.Code, chk.Equals, "ContainerNotFound") - c.Assert(v.Code, chk.Not(chk.Equals), "") - c.Assert(v.RequestID, chk.Not(chk.Equals), "") -} - -func (s *StorageClientSuite) TestReturnsStorageServiceError_withoutResponseBody(c *chk.C) { - // HEAD on non-existing blob - _, err := getBlobClient(c).GetBlobProperties("non-existing-blob", "non-existing-container") - - c.Assert(err, chk.NotNil) - c.Assert(err, chk.FitsTypeOf, AzureStorageServiceError{}) - - v, ok := err.(AzureStorageServiceError) - c.Check(ok, chk.Equals, true) - c.Assert(v.StatusCode, chk.Equals, http.StatusNotFound) - c.Assert(v.Code, chk.Equals, "404 The specified container does not exist.") - c.Assert(v.RequestID, chk.Not(chk.Equals), "") - c.Assert(v.Message, chk.Equals, "no response body was available for error status code") -} - -func (s *StorageClientSuite) Test_createServiceClients(c *chk.C) { - cli, err := NewBasicClient("foo", "YmFy") - c.Assert(err, chk.IsNil) - - ua := cli.getDefaultUserAgent() - - headers := cli.getStandardHeaders() - c.Assert(headers[userAgentHeader], chk.Equals, ua) - c.Assert(cli.userAgent, chk.Equals, ua) - - b := cli.GetBlobService() - c.Assert(b.client.userAgent, chk.Equals, ua+" "+blobServiceName) - c.Assert(cli.userAgent, chk.Equals, ua) - - t := cli.GetTableService() - c.Assert(t.client.userAgent, chk.Equals, ua+" "+tableServiceName) - c.Assert(cli.userAgent, chk.Equals, ua) - - q := cli.GetQueueService() - c.Assert(q.client.userAgent, chk.Equals, ua+" "+queueServiceName) - c.Assert(cli.userAgent, chk.Equals, ua) - - f := cli.GetFileService() - c.Assert(f.client.userAgent, chk.Equals, ua+" "+fileServiceName) - c.Assert(cli.userAgent, chk.Equals, ua) -} - -func (s *StorageClientSuite) TestAddToUserAgent(c *chk.C) { - cli, err := NewBasicClient("foo", "YmFy") - c.Assert(err, chk.IsNil) - - ua := cli.getDefaultUserAgent() - - err = cli.AddToUserAgent("bar") - c.Assert(err, chk.IsNil) - c.Assert(cli.userAgent, chk.Equals, ua+" bar") - - err = cli.AddToUserAgent("") - c.Assert(err, chk.NotNil) -} - -func (s *StorageClientSuite) Test_protectUserAgent(c *chk.C) { - extraheaders := map[string]string{ - "1": "one", - "2": "two", - "3": "three", - userAgentHeader: "four", - } - - cli, err := NewBasicClient("foo", "YmFy") - c.Assert(err, chk.IsNil) - - ua := cli.getDefaultUserAgent() - - got := cli.protectUserAgent(extraheaders) - c.Assert(cli.userAgent, chk.Equals, ua+" four") - c.Assert(got, chk.HasLen, 3) - c.Assert(got, chk.DeepEquals, map[string]string{ - "1": "one", - "2": "two", - "3": "three", - }) -} diff --git a/storage/directory.go b/storage/directory.go deleted file mode 100644 index d07e0af1cc88..000000000000 --- a/storage/directory.go +++ /dev/null @@ -1,217 +0,0 @@ -package storage - -import ( - "encoding/xml" - "net/http" - "net/url" -) - -// Directory represents a directory on a share. -type Directory struct { - fsc *FileServiceClient - Metadata map[string]string - Name string `xml:"Name"` - parent *Directory - Properties DirectoryProperties - share *Share -} - -// DirectoryProperties contains various properties of a directory. -type DirectoryProperties struct { - LastModified string `xml:"Last-Modified"` - Etag string `xml:"Etag"` -} - -// ListDirsAndFilesParameters defines the set of customizable parameters to -// make a List Files and Directories call. -// -// See https://msdn.microsoft.com/en-us/library/azure/dn166980.aspx -type ListDirsAndFilesParameters struct { - Marker string - MaxResults uint - Timeout uint -} - -// DirsAndFilesListResponse contains the response fields from -// a List Files and Directories call. -// -// See https://msdn.microsoft.com/en-us/library/azure/dn166980.aspx -type DirsAndFilesListResponse struct { - XMLName xml.Name `xml:"EnumerationResults"` - Xmlns string `xml:"xmlns,attr"` - Marker string `xml:"Marker"` - MaxResults int64 `xml:"MaxResults"` - Directories []Directory `xml:"Entries>Directory"` - Files []File `xml:"Entries>File"` - NextMarker string `xml:"NextMarker"` -} - -// builds the complete directory path for this directory object. -func (d *Directory) buildPath() string { - path := "" - current := d - for current.Name != "" { - path = "/" + current.Name + path - current = current.parent - } - return d.share.buildPath() + path -} - -// Create this directory in the associated share. -// If a directory with the same name already exists, the operation fails. -// -// See https://msdn.microsoft.com/en-us/library/azure/dn166993.aspx -func (d *Directory) Create() error { - // if this is the root directory exit early - if d.parent == nil { - return nil - } - - headers, err := d.fsc.createResource(d.buildPath(), resourceDirectory, mergeMDIntoExtraHeaders(d.Metadata, nil)) - if err != nil { - return err - } - - d.updateEtagAndLastModified(headers) - return nil -} - -// CreateIfNotExists creates this directory under the associated share if the -// directory does not exists. Returns true if the directory is newly created or -// false if the directory already exists. -// -// See https://msdn.microsoft.com/en-us/library/azure/dn166993.aspx -func (d *Directory) CreateIfNotExists() (bool, error) { - // if this is the root directory exit early - if d.parent == nil { - return false, nil - } - - resp, err := d.fsc.createResourceNoClose(d.buildPath(), resourceDirectory, nil) - if resp != nil { - defer resp.body.Close() - if resp.statusCode == http.StatusCreated || resp.statusCode == http.StatusConflict { - if resp.statusCode == http.StatusCreated { - d.updateEtagAndLastModified(resp.headers) - return true, nil - } - - return false, d.FetchAttributes() - } - } - - return false, err -} - -// Delete removes this directory. It must be empty in order to be deleted. -// If the directory does not exist the operation fails. -// -// See https://msdn.microsoft.com/en-us/library/azure/dn166969.aspx -func (d *Directory) Delete() error { - return d.fsc.deleteResource(d.buildPath(), resourceDirectory) -} - -// DeleteIfExists removes this directory if it exists. -// -// See https://msdn.microsoft.com/en-us/library/azure/dn166969.aspx -func (d *Directory) DeleteIfExists() (bool, error) { - resp, err := d.fsc.deleteResourceNoClose(d.buildPath(), resourceDirectory) - if resp != nil { - defer resp.body.Close() - if resp.statusCode == http.StatusAccepted || resp.statusCode == http.StatusNotFound { - return resp.statusCode == http.StatusAccepted, nil - } - } - return false, err -} - -// Exists returns true if this directory exists. -func (d *Directory) Exists() (bool, error) { - exists, headers, err := d.fsc.resourceExists(d.buildPath(), resourceDirectory) - if exists { - d.updateEtagAndLastModified(headers) - } - return exists, err -} - -// FetchAttributes retrieves metadata for this directory. -func (d *Directory) FetchAttributes() error { - headers, err := d.fsc.getResourceHeaders(d.buildPath(), compNone, resourceDirectory, http.MethodHead) - if err != nil { - return err - } - - d.updateEtagAndLastModified(headers) - d.Metadata = getMetadataFromHeaders(headers) - - return nil -} - -// GetDirectoryReference returns a child Directory object for this directory. -func (d *Directory) GetDirectoryReference(name string) *Directory { - return &Directory{ - fsc: d.fsc, - Name: name, - parent: d, - share: d.share, - } -} - -// GetFileReference returns a child File object for this directory. -func (d *Directory) GetFileReference(name string) *File { - return &File{ - fsc: d.fsc, - Name: name, - parent: d, - share: d.share, - } -} - -// ListDirsAndFiles returns a list of files and directories under this directory. -// It also contains a pagination token and other response details. -// -// See https://msdn.microsoft.com/en-us/library/azure/dn166980.aspx -func (d *Directory) ListDirsAndFiles(params ListDirsAndFilesParameters) (*DirsAndFilesListResponse, error) { - q := mergeParams(params.getParameters(), getURLInitValues(compList, resourceDirectory)) - - resp, err := d.fsc.listContent(d.buildPath(), q, nil) - if err != nil { - return nil, err - } - - defer resp.body.Close() - var out DirsAndFilesListResponse - err = xmlUnmarshal(resp.body, &out) - return &out, err -} - -// SetMetadata replaces the metadata for this directory. -// -// Some keys may be converted to Camel-Case before sending. All keys -// are returned in lower case by GetDirectoryMetadata. HTTP header names -// are case-insensitive so case munging should not matter to other -// applications either. -// -// See https://msdn.microsoft.com/en-us/library/azure/mt427370.aspx -func (d *Directory) SetMetadata() error { - headers, err := d.fsc.setResourceHeaders(d.buildPath(), compMetadata, resourceDirectory, mergeMDIntoExtraHeaders(d.Metadata, nil)) - if err != nil { - return err - } - - d.updateEtagAndLastModified(headers) - return nil -} - -// updates Etag and last modified date -func (d *Directory) updateEtagAndLastModified(headers http.Header) { - d.Properties.Etag = headers.Get("Etag") - d.Properties.LastModified = headers.Get("Last-Modified") -} - -// URL gets the canonical URL to this directory. -// This method does not create a publicly accessible URL if the directory -// is private and this method does not check if the directory exists. -func (d *Directory) URL() string { - return d.fsc.client.getEndpoint(fileServiceName, d.buildPath(), url.Values{}) -} diff --git a/storage/directory_test.go b/storage/directory_test.go deleted file mode 100644 index 221348dba04b..000000000000 --- a/storage/directory_test.go +++ /dev/null @@ -1,112 +0,0 @@ -package storage - -import chk "gopkg.in/check.v1" - -type StorageDirSuite struct{} - -var _ = chk.Suite(&StorageDirSuite{}) - -func (s *StorageDirSuite) TestListDirsAndFiles(c *chk.C) { - // create share - cli := getFileClient(c) - share := cli.GetShareReference(randShare()) - - c.Assert(share.Create(), chk.IsNil) - defer share.Delete() - root := share.GetRootDirectoryReference() - - // list contents, should be empty - resp, err := root.ListDirsAndFiles(ListDirsAndFilesParameters{}) - c.Assert(err, chk.IsNil) - c.Assert(resp.Directories, chk.IsNil) - c.Assert(resp.Files, chk.IsNil) - - // create a directory and a file - dir := root.GetDirectoryReference("SomeDirectory") - file := root.GetFileReference("foo.file") - c.Assert(dir.Create(), chk.IsNil) - c.Assert(file.Create(512), chk.IsNil) - - // list contents - resp, err = root.ListDirsAndFiles(ListDirsAndFilesParameters{}) - c.Assert(err, chk.IsNil) - c.Assert(len(resp.Directories), chk.Equals, 1) - c.Assert(len(resp.Files), chk.Equals, 1) - c.Assert(resp.Directories[0].Name, chk.Equals, dir.Name) - c.Assert(resp.Files[0].Name, chk.Equals, file.Name) - - // delete file - del, err := file.DeleteIfExists() - c.Assert(err, chk.IsNil) - c.Assert(del, chk.Equals, true) - - // attempt to delete again - del, err = file.DeleteIfExists() - c.Assert(err, chk.IsNil) - c.Assert(del, chk.Equals, false) -} - -func (s *StorageDirSuite) TestCreateDirectory(c *chk.C) { - // create share - cli := getFileClient(c) - share := cli.GetShareReference(randShare()) - - c.Assert(share.Create(), chk.IsNil) - defer share.Delete() - root := share.GetRootDirectoryReference() - - // directory shouldn't exist - dir := root.GetDirectoryReference("SomeDirectory") - exists, err := dir.Exists() - c.Assert(err, chk.IsNil) - c.Assert(exists, chk.Equals, false) - - // create directory - exists, err = dir.CreateIfNotExists() - c.Assert(err, chk.IsNil) - c.Assert(exists, chk.Equals, true) - - // try to create again, should fail - c.Assert(dir.Create(), chk.NotNil) - exists, err = dir.CreateIfNotExists() - c.Assert(err, chk.IsNil) - c.Assert(exists, chk.Equals, false) - - // check properties - c.Assert(dir.Properties.Etag, chk.Not(chk.Equals), "") - c.Assert(dir.Properties.LastModified, chk.Not(chk.Equals), "") - - // delete directory and verify - c.Assert(dir.Delete(), chk.IsNil) - exists, err = dir.Exists() - c.Assert(err, chk.IsNil) - c.Assert(exists, chk.Equals, false) -} - -func (s *StorageDirSuite) TestDirectoryMetadata(c *chk.C) { - // create share - cli := getFileClient(c) - share := cli.GetShareReference(randShare()) - - c.Assert(share.Create(), chk.IsNil) - defer share.Delete() - root := share.GetRootDirectoryReference() - - dir := root.GetDirectoryReference("testdir") - c.Assert(dir.Create(), chk.IsNil) - - // get metadata, shouldn't be any - c.Assert(dir.Metadata, chk.IsNil) - - // set some custom metadata - md := map[string]string{ - "something": "somethingvalue", - "another": "anothervalue", - } - dir.Metadata = md - c.Assert(dir.SetMetadata(), chk.IsNil) - - // retrieve and verify - c.Assert(dir.FetchAttributes(), chk.IsNil) - c.Assert(dir.Metadata, chk.DeepEquals, md) -} diff --git a/storage/file.go b/storage/file.go deleted file mode 100644 index 575f3f7266dc..000000000000 --- a/storage/file.go +++ /dev/null @@ -1,360 +0,0 @@ -package storage - -import ( - "errors" - "fmt" - "io" - "net/http" - "net/url" - "strconv" -) - -const fourMB = uint64(4194304) -const oneTB = uint64(1099511627776) - -// File represents a file on a share. -type File struct { - fsc *FileServiceClient - Metadata map[string]string - Name string `xml:"Name"` - parent *Directory - Properties FileProperties `xml:"Properties"` - share *Share -} - -// FileProperties contains various properties of a file. -type FileProperties struct { - CacheControl string `header:"x-ms-cache-control"` - Disposition string `header:"x-ms-content-disposition"` - Encoding string `header:"x-ms-content-encoding"` - Etag string - Language string `header:"x-ms-content-language"` - LastModified string - Length uint64 `xml:"Content-Length"` - MD5 string `header:"x-ms-content-md5"` - Type string `header:"x-ms-content-type"` -} - -// FileCopyState contains various properties of a file copy operation. -type FileCopyState struct { - CompletionTime string - ID string - Progress string - Source string - Status string - StatusDesc string -} - -// FileStream contains file data returned from a call to GetFile. -type FileStream struct { - Body io.ReadCloser - ContentMD5 string -} - -// FileRanges contains a list of file range information for a file. -// -// See https://msdn.microsoft.com/en-us/library/azure/dn166984.aspx -type FileRanges struct { - ContentLength uint64 - LastModified string - ETag string - FileRanges []FileRange `xml:"Range"` -} - -// FileRange contains range information for a file. -// -// See https://msdn.microsoft.com/en-us/library/azure/dn166984.aspx -type FileRange struct { - Start uint64 `xml:"Start"` - End uint64 `xml:"End"` -} - -func (fr FileRange) String() string { - return fmt.Sprintf("bytes=%d-%d", fr.Start, fr.End) -} - -// builds the complete file path for this file object -func (f *File) buildPath() string { - return f.parent.buildPath() + "/" + f.Name -} - -// ClearRange releases the specified range of space in a file. -// -// See https://msdn.microsoft.com/en-us/library/azure/dn194276.aspx -func (f *File) ClearRange(fileRange FileRange) error { - headers, err := f.modifyRange(nil, fileRange, nil) - if err != nil { - return err - } - - f.updateEtagAndLastModified(headers) - return nil -} - -// Create creates a new file or replaces an existing one. -// -// See https://msdn.microsoft.com/en-us/library/azure/dn194271.aspx -func (f *File) Create(maxSize uint64) error { - if maxSize > oneTB { - return fmt.Errorf("max file size is 1TB") - } - - extraHeaders := map[string]string{ - "x-ms-content-length": strconv.FormatUint(maxSize, 10), - "x-ms-type": "file", - } - - headers, err := f.fsc.createResource(f.buildPath(), resourceFile, mergeMDIntoExtraHeaders(f.Metadata, extraHeaders)) - if err != nil { - return err - } - - f.Properties.Length = maxSize - f.updateEtagAndLastModified(headers) - return nil -} - -// Delete immediately removes this file from the storage account. -// -// See https://msdn.microsoft.com/en-us/library/azure/dn689085.aspx -func (f *File) Delete() error { - return f.fsc.deleteResource(f.buildPath(), resourceFile) -} - -// DeleteIfExists removes this file if it exists. -// -// See https://msdn.microsoft.com/en-us/library/azure/dn689085.aspx -func (f *File) DeleteIfExists() (bool, error) { - resp, err := f.fsc.deleteResourceNoClose(f.buildPath(), resourceFile) - if resp != nil { - defer resp.body.Close() - if resp.statusCode == http.StatusAccepted || resp.statusCode == http.StatusNotFound { - return resp.statusCode == http.StatusAccepted, nil - } - } - return false, err -} - -// DownloadRangeToStream operation downloads the specified range of this file with optional MD5 hash. -// -// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/get-file -func (f *File) DownloadRangeToStream(fileRange FileRange, getContentMD5 bool) (fs FileStream, err error) { - if getContentMD5 && isRangeTooBig(fileRange) { - return fs, fmt.Errorf("must specify a range less than or equal to 4MB when getContentMD5 is true") - } - - extraHeaders := map[string]string{ - "Range": fileRange.String(), - } - if getContentMD5 == true { - extraHeaders["x-ms-range-get-content-md5"] = "true" - } - - resp, err := f.fsc.getResourceNoClose(f.buildPath(), compNone, resourceFile, http.MethodGet, extraHeaders) - if err != nil { - return fs, err - } - - if err = checkRespCode(resp.statusCode, []int{http.StatusOK, http.StatusPartialContent}); err != nil { - resp.body.Close() - return fs, err - } - - fs.Body = resp.body - if getContentMD5 { - fs.ContentMD5 = resp.headers.Get("Content-MD5") - } - return fs, nil -} - -// Exists returns true if this file exists. -func (f *File) Exists() (bool, error) { - exists, headers, err := f.fsc.resourceExists(f.buildPath(), resourceFile) - if exists { - f.updateEtagAndLastModified(headers) - f.updateProperties(headers) - } - return exists, err -} - -// FetchAttributes updates metadata and properties for this file. -func (f *File) FetchAttributes() error { - headers, err := f.fsc.getResourceHeaders(f.buildPath(), compNone, resourceFile, http.MethodHead) - if err != nil { - return err - } - - f.updateEtagAndLastModified(headers) - f.updateProperties(headers) - f.Metadata = getMetadataFromHeaders(headers) - return nil -} - -// returns true if the range is larger than 4MB -func isRangeTooBig(fileRange FileRange) bool { - if fileRange.End-fileRange.Start > fourMB { - return true - } - - return false -} - -// ListRanges returns the list of valid ranges for this file. -// -// See https://msdn.microsoft.com/en-us/library/azure/dn166984.aspx -func (f *File) ListRanges(listRange *FileRange) (*FileRanges, error) { - params := url.Values{"comp": {"rangelist"}} - - // add optional range to list - var headers map[string]string - if listRange != nil { - headers = make(map[string]string) - headers["Range"] = listRange.String() - } - - resp, err := f.fsc.listContent(f.buildPath(), params, headers) - if err != nil { - return nil, err - } - - defer resp.body.Close() - var cl uint64 - cl, err = strconv.ParseUint(resp.headers.Get("x-ms-content-length"), 10, 64) - if err != nil { - return nil, err - } - - var out FileRanges - out.ContentLength = cl - out.ETag = resp.headers.Get("ETag") - out.LastModified = resp.headers.Get("Last-Modified") - - err = xmlUnmarshal(resp.body, &out) - return &out, err -} - -// modifies a range of bytes in this file -func (f *File) modifyRange(bytes io.Reader, fileRange FileRange, contentMD5 *string) (http.Header, error) { - if err := f.fsc.checkForStorageEmulator(); err != nil { - return nil, err - } - if fileRange.End < fileRange.Start { - return nil, errors.New("the value for rangeEnd must be greater than or equal to rangeStart") - } - if bytes != nil && isRangeTooBig(fileRange) { - return nil, errors.New("range cannot exceed 4MB in size") - } - - uri := f.fsc.client.getEndpoint(fileServiceName, f.buildPath(), url.Values{"comp": {"range"}}) - - // default to clear - write := "clear" - cl := uint64(0) - - // if bytes is not nil then this is an update operation - if bytes != nil { - write = "update" - cl = (fileRange.End - fileRange.Start) + 1 - } - - extraHeaders := map[string]string{ - "Content-Length": strconv.FormatUint(cl, 10), - "Range": fileRange.String(), - "x-ms-write": write, - } - - if contentMD5 != nil { - extraHeaders["Content-MD5"] = *contentMD5 - } - - headers := mergeHeaders(f.fsc.client.getStandardHeaders(), extraHeaders) - resp, err := f.fsc.client.exec(http.MethodPut, uri, headers, bytes, f.fsc.auth) - if err != nil { - return nil, err - } - defer resp.body.Close() - return resp.headers, checkRespCode(resp.statusCode, []int{http.StatusCreated}) -} - -// SetMetadata replaces the metadata for this file. -// -// Some keys may be converted to Camel-Case before sending. All keys -// are returned in lower case by GetFileMetadata. HTTP header names -// are case-insensitive so case munging should not matter to other -// applications either. -// -// See https://msdn.microsoft.com/en-us/library/azure/dn689097.aspx -func (f *File) SetMetadata() error { - headers, err := f.fsc.setResourceHeaders(f.buildPath(), compMetadata, resourceFile, mergeMDIntoExtraHeaders(f.Metadata, nil)) - if err != nil { - return err - } - - f.updateEtagAndLastModified(headers) - return nil -} - -// SetProperties sets system properties on this file. -// -// Some keys may be converted to Camel-Case before sending. All keys -// are returned in lower case by SetFileProperties. HTTP header names -// are case-insensitive so case munging should not matter to other -// applications either. -// -// See https://msdn.microsoft.com/en-us/library/azure/dn166975.aspx -func (f *File) SetProperties() error { - headers, err := f.fsc.setResourceHeaders(f.buildPath(), compProperties, resourceFile, headersFromStruct(f.Properties)) - if err != nil { - return err - } - - f.updateEtagAndLastModified(headers) - return nil -} - -// updates Etag and last modified date -func (f *File) updateEtagAndLastModified(headers http.Header) { - f.Properties.Etag = headers.Get("Etag") - f.Properties.LastModified = headers.Get("Last-Modified") -} - -// updates file properties from the specified HTTP header -func (f *File) updateProperties(header http.Header) { - size, err := strconv.ParseUint(header.Get("Content-Length"), 10, 64) - if err == nil { - f.Properties.Length = size - } - - f.updateEtagAndLastModified(header) - f.Properties.CacheControl = header.Get("Cache-Control") - f.Properties.Disposition = header.Get("Content-Disposition") - f.Properties.Encoding = header.Get("Content-Encoding") - f.Properties.Language = header.Get("Content-Language") - f.Properties.MD5 = header.Get("Content-MD5") - f.Properties.Type = header.Get("Content-Type") -} - -// URL gets the canonical URL to this file. -// This method does not create a publicly accessible URL if the file -// is private and this method does not check if the file exists. -func (f *File) URL() string { - return f.fsc.client.getEndpoint(fileServiceName, f.buildPath(), url.Values{}) -} - -// WriteRange writes a range of bytes to this file with an optional MD5 hash of the content. -// Note that the length of bytes must match (rangeEnd - rangeStart) + 1 with a maximum size of 4MB. -// -// See https://msdn.microsoft.com/en-us/library/azure/dn194276.aspx -func (f *File) WriteRange(bytes io.Reader, fileRange FileRange, contentMD5 *string) error { - if bytes == nil { - return errors.New("bytes cannot be nil") - } - - headers, err := f.modifyRange(bytes, fileRange, contentMD5) - if err != nil { - return err - } - - f.updateEtagAndLastModified(headers) - return nil -} diff --git a/storage/file_test.go b/storage/file_test.go deleted file mode 100644 index 15c1ca9de48e..000000000000 --- a/storage/file_test.go +++ /dev/null @@ -1,274 +0,0 @@ -package storage - -import ( - "bytes" - "crypto/md5" - "encoding/base64" - "io" - - chk "gopkg.in/check.v1" -) - -type StorageFileSuite struct{} - -var _ = chk.Suite(&StorageFileSuite{}) - -func (s *StorageFileSuite) TestCreateFile(c *chk.C) { - // create share - cli := getFileClient(c) - share := cli.GetShareReference(randShare()) - - c.Assert(share.Create(), chk.IsNil) - defer share.Delete() - root := share.GetRootDirectoryReference() - - // create directory structure - dir1 := root.GetDirectoryReference("one") - c.Assert(dir1.Create(), chk.IsNil) - dir2 := dir1.GetDirectoryReference("two") - c.Assert(dir2.Create(), chk.IsNil) - - // verify file doesn't exist - file := dir2.GetFileReference("some.file") - exists, err := file.Exists() - c.Assert(err, chk.IsNil) - c.Assert(exists, chk.Equals, false) - - // create file - c.Assert(file.Create(1024), chk.IsNil) - exists, err = file.Exists() - c.Assert(err, chk.IsNil) - c.Assert(exists, chk.Equals, true) - - // delete file and verify - c.Assert(file.Delete(), chk.IsNil) - exists, err = file.Exists() - c.Assert(err, chk.IsNil) - c.Assert(exists, chk.Equals, false) -} - -func (s *StorageFileSuite) TestGetFile(c *chk.C) { - // create share - cli := getFileClient(c) - share := cli.GetShareReference(randShare()) - - c.Assert(share.Create(), chk.IsNil) - defer share.Delete() - root := share.GetRootDirectoryReference() - - // create file - const size = uint64(1024) - byteStream, _ := newByteStream(size) - file := root.GetFileReference("some.file") - c.Assert(file.Create(size), chk.IsNil) - - // fill file with some data - c.Assert(file.WriteRange(byteStream, FileRange{End: size - 1}, nil), chk.IsNil) - - // set some metadata - md := map[string]string{ - "something": "somethingvalue", - "another": "anothervalue", - } - file.Metadata = md - c.Assert(file.SetMetadata(), chk.IsNil) - - // retrieve full file content and verify - stream, err := file.DownloadRangeToStream(FileRange{Start: 0, End: size - 1}, false) - c.Assert(err, chk.IsNil) - defer stream.Body.Close() - var b1 [size]byte - count, _ := stream.Body.Read(b1[:]) - c.Assert(count, chk.Equals, int(size)) - var c1 [size]byte - bs, _ := newByteStream(size) - bs.Read(c1[:]) - c.Assert(b1, chk.DeepEquals, c1) - - // retrieve partial file content and verify - stream, err = file.DownloadRangeToStream(FileRange{Start: size / 2, End: size - 1}, false) - c.Assert(err, chk.IsNil) - defer stream.Body.Close() - var b2 [size / 2]byte - count, _ = stream.Body.Read(b2[:]) - c.Assert(count, chk.Equals, int(size)/2) - var c2 [size / 2]byte - bs, _ = newByteStream(size / 2) - bs.Read(c2[:]) - c.Assert(b2, chk.DeepEquals, c2) -} - -func (s *StorageFileSuite) TestFileRanges(c *chk.C) { - // create share - cli := getFileClient(c) - share := cli.GetShareReference(randShare()) - - c.Assert(share.Create(), chk.IsNil) - defer share.Delete() - root := share.GetRootDirectoryReference() - - // create file - fileSize := uint64(4096) - byteStream, _ := newByteStream(fileSize) - file := root.GetFileReference("test.dat") - c.Assert(file.Create(fileSize), chk.IsNil) - - // verify there are no valid ranges - ranges, err := file.ListRanges(nil) - c.Assert(err, chk.IsNil) - c.Assert(ranges.ContentLength, chk.Equals, fileSize) - c.Assert(ranges.FileRanges, chk.IsNil) - - // fill entire range and validate - c.Assert(file.WriteRange(byteStream, FileRange{End: fileSize - 1}, nil), chk.IsNil) - ranges, err = file.ListRanges(nil) - c.Assert(err, chk.IsNil) - c.Assert(len(ranges.FileRanges), chk.Equals, 1) - c.Assert((ranges.FileRanges[0].End-ranges.FileRanges[0].Start)+1, chk.Equals, fileSize) - - // clear entire range and validate - c.Assert(file.ClearRange(FileRange{End: fileSize - 1}), chk.IsNil) - ranges, err = file.ListRanges(nil) - c.Assert(err, chk.IsNil) - c.Assert(ranges.FileRanges, chk.IsNil) - - // put partial ranges on 512 byte aligned boundaries - putRanges := []FileRange{ - {End: 511}, - {Start: 1024, End: 1535}, - {Start: 2048, End: 2559}, - {Start: 3072, End: 3583}, - } - - for _, r := range putRanges { - byteStream, _ = newByteStream(512) - err = file.WriteRange(byteStream, r, nil) - c.Assert(err, chk.IsNil) - } - - // validate all ranges - ranges, err = file.ListRanges(nil) - c.Assert(err, chk.IsNil) - c.Assert(ranges.FileRanges, chk.DeepEquals, putRanges) - - // validate sub-ranges - ranges, err = file.ListRanges(&FileRange{Start: 1000, End: 3000}) - c.Assert(err, chk.IsNil) - c.Assert(ranges.FileRanges, chk.DeepEquals, putRanges[1:3]) - - // clear partial range and validate - c.Assert(file.ClearRange(putRanges[0]), chk.IsNil) - c.Assert(file.ClearRange(putRanges[2]), chk.IsNil) - ranges, err = file.ListRanges(nil) - c.Assert(err, chk.IsNil) - c.Assert(ranges.FileRanges, chk.HasLen, 2) - c.Assert(ranges.FileRanges[0], chk.DeepEquals, putRanges[1]) - c.Assert(ranges.FileRanges[1], chk.DeepEquals, putRanges[3]) -} - -func (s *StorageFileSuite) TestFileProperties(c *chk.C) { - // create share - cli := getFileClient(c) - share := cli.GetShareReference(randShare()) - - c.Assert(share.Create(), chk.IsNil) - defer share.Delete() - root := share.GetRootDirectoryReference() - - fileSize := uint64(512) - file := root.GetFileReference("test.dat") - c.Assert(file.Create(fileSize), chk.IsNil) - - // get initial set of properties - c.Assert(file.Properties.Length, chk.Equals, fileSize) - c.Assert(file.Properties.Etag, chk.NotNil) - - // set some file properties - cc := "cachecontrol" - ct := "mytype" - enc := "noencoding" - lang := "neutral" - disp := "friendly" - file.Properties.CacheControl = cc - file.Properties.Type = ct - file.Properties.Disposition = disp - file.Properties.Encoding = enc - file.Properties.Language = lang - c.Assert(file.SetProperties(), chk.IsNil) - - // retrieve and verify - c.Assert(file.FetchAttributes(), chk.IsNil) - c.Assert(file.Properties.CacheControl, chk.Equals, cc) - c.Assert(file.Properties.Type, chk.Equals, ct) - c.Assert(file.Properties.Disposition, chk.Equals, disp) - c.Assert(file.Properties.Encoding, chk.Equals, enc) - c.Assert(file.Properties.Language, chk.Equals, lang) -} - -func (s *StorageFileSuite) TestFileMetadata(c *chk.C) { - // create share - cli := getFileClient(c) - share := cli.GetShareReference(randShare()) - - c.Assert(share.Create(), chk.IsNil) - defer share.Delete() - root := share.GetRootDirectoryReference() - - fileSize := uint64(512) - file := root.GetFileReference("test.dat") - c.Assert(file.Create(fileSize), chk.IsNil) - - // get metadata, shouldn't be any - c.Assert(file.Metadata, chk.HasLen, 0) - - // set some custom metadata - md := map[string]string{ - "something": "somethingvalue", - "another": "anothervalue", - } - file.Metadata = md - c.Assert(file.SetMetadata(), chk.IsNil) - - // retrieve and verify - c.Assert(file.FetchAttributes(), chk.IsNil) - c.Assert(file.Metadata, chk.DeepEquals, md) -} - -func (s *StorageFileSuite) TestFileMD5(c *chk.C) { - // create share - cli := getFileClient(c) - share := cli.GetShareReference(randShare()) - - c.Assert(share.Create(), chk.IsNil) - defer share.Delete() - root := share.GetRootDirectoryReference() - - // create file - const size = uint64(1024) - fileSize := uint64(size) - file := root.GetFileReference("test.dat") - c.Assert(file.Create(fileSize), chk.IsNil) - - // fill file with some data and MD5 hash - byteStream, contentMD5 := newByteStream(size) - c.Assert(file.WriteRange(byteStream, FileRange{End: size - 1}, &contentMD5), chk.IsNil) - - // download file and verify - stream, err := file.DownloadRangeToStream(FileRange{Start: 0, End: size - 1}, true) - c.Assert(err, chk.IsNil) - defer stream.Body.Close() - c.Assert(stream.ContentMD5, chk.Equals, contentMD5) -} - -// returns a byte stream along with a base-64 encoded MD5 hash of its contents -func newByteStream(count uint64) (io.Reader, string) { - b := make([]uint8, count) - for i := uint64(0); i < count; i++ { - b[i] = 0xff - } - - // create an MD5 hash of the array - hash := md5.Sum(b) - - return bytes.NewReader(b), base64.StdEncoding.EncodeToString(hash[:]) -} diff --git a/storage/fileserviceclient.go b/storage/fileserviceclient.go deleted file mode 100644 index 81e094f00d3a..000000000000 --- a/storage/fileserviceclient.go +++ /dev/null @@ -1,360 +0,0 @@ -package storage - -import ( - "encoding/xml" - "fmt" - "net/http" - "net/url" - "strings" -) - -// FileServiceClient contains operations for Microsoft Azure File Service. -type FileServiceClient struct { - client Client - auth authentication -} - -// ListSharesParameters defines the set of customizable parameters to make a -// List Shares call. -// -// See https://msdn.microsoft.com/en-us/library/azure/dn167009.aspx -type ListSharesParameters struct { - Prefix string - Marker string - Include string - MaxResults uint - Timeout uint -} - -// ShareListResponse contains the response fields from -// ListShares call. -// -// See https://msdn.microsoft.com/en-us/library/azure/dn167009.aspx -type ShareListResponse struct { - XMLName xml.Name `xml:"EnumerationResults"` - Xmlns string `xml:"xmlns,attr"` - Prefix string `xml:"Prefix"` - Marker string `xml:"Marker"` - NextMarker string `xml:"NextMarker"` - MaxResults int64 `xml:"MaxResults"` - Shares []Share `xml:"Shares>Share"` -} - -type compType string - -const ( - compNone compType = "" - compList compType = "list" - compMetadata compType = "metadata" - compProperties compType = "properties" - compRangeList compType = "rangelist" -) - -func (ct compType) String() string { - return string(ct) -} - -type resourceType string - -const ( - resourceDirectory resourceType = "directory" - resourceFile resourceType = "" - resourceShare resourceType = "share" -) - -func (rt resourceType) String() string { - return string(rt) -} - -func (p ListSharesParameters) getParameters() url.Values { - out := url.Values{} - - if p.Prefix != "" { - out.Set("prefix", p.Prefix) - } - if p.Marker != "" { - out.Set("marker", p.Marker) - } - if p.Include != "" { - out.Set("include", p.Include) - } - if p.MaxResults != 0 { - out.Set("maxresults", fmt.Sprintf("%v", p.MaxResults)) - } - if p.Timeout != 0 { - out.Set("timeout", fmt.Sprintf("%v", p.Timeout)) - } - - return out -} - -func (p ListDirsAndFilesParameters) getParameters() url.Values { - out := url.Values{} - - if p.Marker != "" { - out.Set("marker", p.Marker) - } - if p.MaxResults != 0 { - out.Set("maxresults", fmt.Sprintf("%v", p.MaxResults)) - } - if p.Timeout != 0 { - out.Set("timeout", fmt.Sprintf("%v", p.Timeout)) - } - - return out -} - -// returns url.Values for the specified types -func getURLInitValues(comp compType, res resourceType) url.Values { - values := url.Values{} - if comp != compNone { - values.Set("comp", comp.String()) - } - if res != resourceFile { - values.Set("restype", res.String()) - } - return values -} - -// GetShareReference returns a Share object for the specified share name. -func (f FileServiceClient) GetShareReference(name string) Share { - return Share{ - fsc: &f, - Name: name, - Properties: ShareProperties{ - Quota: -1, - }, - } -} - -// ListShares returns the list of shares in a storage account along with -// pagination token and other response details. -// -// See https://msdn.microsoft.com/en-us/library/azure/dd179352.aspx -func (f FileServiceClient) ListShares(params ListSharesParameters) (*ShareListResponse, error) { - q := mergeParams(params.getParameters(), url.Values{"comp": {"list"}}) - - var out ShareListResponse - resp, err := f.listContent("", q, nil) - if err != nil { - return nil, err - } - defer resp.body.Close() - err = xmlUnmarshal(resp.body, &out) - - // assign our client to the newly created Share objects - for i := range out.Shares { - out.Shares[i].fsc = &f - } - return &out, err -} - -// retrieves directory or share content -func (f FileServiceClient) listContent(path string, params url.Values, extraHeaders map[string]string) (*storageResponse, error) { - if err := f.checkForStorageEmulator(); err != nil { - return nil, err - } - - uri := f.client.getEndpoint(fileServiceName, path, params) - extraHeaders = f.client.protectUserAgent(extraHeaders) - headers := mergeHeaders(f.client.getStandardHeaders(), extraHeaders) - - resp, err := f.client.exec(http.MethodGet, uri, headers, nil, f.auth) - if err != nil { - return nil, err - } - - if err = checkRespCode(resp.statusCode, []int{http.StatusOK}); err != nil { - resp.body.Close() - return nil, err - } - - return resp, nil -} - -// returns true if the specified resource exists -func (f FileServiceClient) resourceExists(path string, res resourceType) (bool, http.Header, error) { - if err := f.checkForStorageEmulator(); err != nil { - return false, nil, err - } - - uri := f.client.getEndpoint(fileServiceName, path, getURLInitValues(compNone, res)) - headers := f.client.getStandardHeaders() - - resp, err := f.client.exec(http.MethodHead, uri, headers, nil, f.auth) - if resp != nil { - defer resp.body.Close() - if resp.statusCode == http.StatusOK || resp.statusCode == http.StatusNotFound { - return resp.statusCode == http.StatusOK, resp.headers, nil - } - } - return false, nil, err -} - -// creates a resource depending on the specified resource type -func (f FileServiceClient) createResource(path string, res resourceType, extraHeaders map[string]string) (http.Header, error) { - resp, err := f.createResourceNoClose(path, res, extraHeaders) - if err != nil { - return nil, err - } - defer resp.body.Close() - return resp.headers, checkRespCode(resp.statusCode, []int{http.StatusCreated}) -} - -// creates a resource depending on the specified resource type, doesn't close the response body -func (f FileServiceClient) createResourceNoClose(path string, res resourceType, extraHeaders map[string]string) (*storageResponse, error) { - if err := f.checkForStorageEmulator(); err != nil { - return nil, err - } - - values := getURLInitValues(compNone, res) - uri := f.client.getEndpoint(fileServiceName, path, values) - extraHeaders = f.client.protectUserAgent(extraHeaders) - headers := mergeHeaders(f.client.getStandardHeaders(), extraHeaders) - - return f.client.exec(http.MethodPut, uri, headers, nil, f.auth) -} - -// returns HTTP header data for the specified directory or share -func (f FileServiceClient) getResourceHeaders(path string, comp compType, res resourceType, verb string) (http.Header, error) { - resp, err := f.getResourceNoClose(path, comp, res, verb, nil) - if err != nil { - return nil, err - } - defer resp.body.Close() - - if err = checkRespCode(resp.statusCode, []int{http.StatusOK}); err != nil { - return nil, err - } - - return resp.headers, nil -} - -// gets the specified resource, doesn't close the response body -func (f FileServiceClient) getResourceNoClose(path string, comp compType, res resourceType, verb string, extraHeaders map[string]string) (*storageResponse, error) { - if err := f.checkForStorageEmulator(); err != nil { - return nil, err - } - - params := getURLInitValues(comp, res) - uri := f.client.getEndpoint(fileServiceName, path, params) - extraHeaders = f.client.protectUserAgent(extraHeaders) - headers := mergeHeaders(f.client.getStandardHeaders(), extraHeaders) - - return f.client.exec(verb, uri, headers, nil, f.auth) -} - -// deletes the resource and returns the response -func (f FileServiceClient) deleteResource(path string, res resourceType) error { - resp, err := f.deleteResourceNoClose(path, res) - if err != nil { - return err - } - defer resp.body.Close() - return checkRespCode(resp.statusCode, []int{http.StatusAccepted}) -} - -// deletes the resource and returns the response, doesn't close the response body -func (f FileServiceClient) deleteResourceNoClose(path string, res resourceType) (*storageResponse, error) { - if err := f.checkForStorageEmulator(); err != nil { - return nil, err - } - - values := getURLInitValues(compNone, res) - uri := f.client.getEndpoint(fileServiceName, path, values) - return f.client.exec(http.MethodDelete, uri, f.client.getStandardHeaders(), nil, f.auth) -} - -// merges metadata into extraHeaders and returns extraHeaders -func mergeMDIntoExtraHeaders(metadata, extraHeaders map[string]string) map[string]string { - if metadata == nil && extraHeaders == nil { - return nil - } - if extraHeaders == nil { - extraHeaders = make(map[string]string) - } - for k, v := range metadata { - extraHeaders[userDefinedMetadataHeaderPrefix+k] = v - } - return extraHeaders -} - -// merges extraHeaders into headers and returns headers -func mergeHeaders(headers, extraHeaders map[string]string) map[string]string { - for k, v := range extraHeaders { - headers[k] = v - } - return headers -} - -// sets extra header data for the specified resource -func (f FileServiceClient) setResourceHeaders(path string, comp compType, res resourceType, extraHeaders map[string]string) (http.Header, error) { - if err := f.checkForStorageEmulator(); err != nil { - return nil, err - } - - params := getURLInitValues(comp, res) - uri := f.client.getEndpoint(fileServiceName, path, params) - extraHeaders = f.client.protectUserAgent(extraHeaders) - headers := mergeHeaders(f.client.getStandardHeaders(), extraHeaders) - - resp, err := f.client.exec(http.MethodPut, uri, headers, nil, f.auth) - if err != nil { - return nil, err - } - defer resp.body.Close() - - return resp.headers, checkRespCode(resp.statusCode, []int{http.StatusOK}) -} - -// gets metadata for the specified resource -func (f FileServiceClient) getMetadata(path string, res resourceType) (map[string]string, error) { - if err := f.checkForStorageEmulator(); err != nil { - return nil, err - } - - headers, err := f.getResourceHeaders(path, compMetadata, res, http.MethodGet) - if err != nil { - return nil, err - } - - return getMetadataFromHeaders(headers), nil -} - -// returns a map of custom metadata values from the specified HTTP header -func getMetadataFromHeaders(header http.Header) map[string]string { - metadata := make(map[string]string) - for k, v := range header { - // Can't trust CanonicalHeaderKey() to munge case - // reliably. "_" is allowed in identifiers: - // https://msdn.microsoft.com/en-us/library/azure/dd179414.aspx - // https://msdn.microsoft.com/library/aa664670(VS.71).aspx - // http://tools.ietf.org/html/rfc7230#section-3.2 - // ...but "_" is considered invalid by - // CanonicalMIMEHeaderKey in - // https://golang.org/src/net/textproto/reader.go?s=14615:14659#L542 - // so k can be "X-Ms-Meta-Foo" or "x-ms-meta-foo_bar". - k = strings.ToLower(k) - if len(v) == 0 || !strings.HasPrefix(k, strings.ToLower(userDefinedMetadataHeaderPrefix)) { - continue - } - // metadata["foo"] = content of the last X-Ms-Meta-Foo header - k = k[len(userDefinedMetadataHeaderPrefix):] - metadata[k] = v[len(v)-1] - } - - if len(metadata) == 0 { - return nil - } - - return metadata -} - -//checkForStorageEmulator determines if the client is setup for use with -//Azure Storage Emulator, and returns a relevant error -func (f FileServiceClient) checkForStorageEmulator() error { - if f.client.accountName == StorageEmulatorAccountName { - return fmt.Errorf("Error: File service is not currently supported by Azure Storage Emulator") - } - return nil -} diff --git a/storage/queue.go b/storage/queue.go deleted file mode 100644 index 4dbb67733105..000000000000 --- a/storage/queue.go +++ /dev/null @@ -1,346 +0,0 @@ -package storage - -import ( - "encoding/xml" - "fmt" - "net/http" - "net/url" - "strconv" - "strings" -) - -const ( - // casing is per Golang's http.Header canonicalizing the header names. - approximateMessagesCountHeader = "X-Ms-Approximate-Messages-Count" - userDefinedMetadataHeaderPrefix = "X-Ms-Meta-" -) - -// QueueServiceClient contains operations for Microsoft Azure Queue Storage -// Service. -type QueueServiceClient struct { - client Client - auth authentication -} - -func pathForQueue(queue string) string { return fmt.Sprintf("/%s", queue) } -func pathForQueueMessages(queue string) string { return fmt.Sprintf("/%s/messages", queue) } -func pathForMessage(queue, name string) string { return fmt.Sprintf("/%s/messages/%s", queue, name) } - -type putMessageRequest struct { - XMLName xml.Name `xml:"QueueMessage"` - MessageText string `xml:"MessageText"` -} - -// PutMessageParameters is the set of options can be specified for Put Messsage -// operation. A zero struct does not use any preferences for the request. -type PutMessageParameters struct { - VisibilityTimeout int - MessageTTL int -} - -func (p PutMessageParameters) getParameters() url.Values { - out := url.Values{} - if p.VisibilityTimeout != 0 { - out.Set("visibilitytimeout", strconv.Itoa(p.VisibilityTimeout)) - } - if p.MessageTTL != 0 { - out.Set("messagettl", strconv.Itoa(p.MessageTTL)) - } - return out -} - -// GetMessagesParameters is the set of options can be specified for Get -// Messsages operation. A zero struct does not use any preferences for the -// request. -type GetMessagesParameters struct { - NumOfMessages int - VisibilityTimeout int -} - -func (p GetMessagesParameters) getParameters() url.Values { - out := url.Values{} - if p.NumOfMessages != 0 { - out.Set("numofmessages", strconv.Itoa(p.NumOfMessages)) - } - if p.VisibilityTimeout != 0 { - out.Set("visibilitytimeout", strconv.Itoa(p.VisibilityTimeout)) - } - return out -} - -// PeekMessagesParameters is the set of options can be specified for Peek -// Messsage operation. A zero struct does not use any preferences for the -// request. -type PeekMessagesParameters struct { - NumOfMessages int -} - -func (p PeekMessagesParameters) getParameters() url.Values { - out := url.Values{"peekonly": {"true"}} // Required for peek operation - if p.NumOfMessages != 0 { - out.Set("numofmessages", strconv.Itoa(p.NumOfMessages)) - } - return out -} - -// UpdateMessageParameters is the set of options can be specified for Update Messsage -// operation. A zero struct does not use any preferences for the request. -type UpdateMessageParameters struct { - PopReceipt string - VisibilityTimeout int -} - -func (p UpdateMessageParameters) getParameters() url.Values { - out := url.Values{} - if p.PopReceipt != "" { - out.Set("popreceipt", p.PopReceipt) - } - if p.VisibilityTimeout != 0 { - out.Set("visibilitytimeout", strconv.Itoa(p.VisibilityTimeout)) - } - return out -} - -// GetMessagesResponse represents a response returned from Get Messages -// operation. -type GetMessagesResponse struct { - XMLName xml.Name `xml:"QueueMessagesList"` - QueueMessagesList []GetMessageResponse `xml:"QueueMessage"` -} - -// GetMessageResponse represents a QueueMessage object returned from Get -// Messages operation response. -type GetMessageResponse struct { - MessageID string `xml:"MessageId"` - InsertionTime string `xml:"InsertionTime"` - ExpirationTime string `xml:"ExpirationTime"` - PopReceipt string `xml:"PopReceipt"` - TimeNextVisible string `xml:"TimeNextVisible"` - DequeueCount int `xml:"DequeueCount"` - MessageText string `xml:"MessageText"` -} - -// PeekMessagesResponse represents a response returned from Get Messages -// operation. -type PeekMessagesResponse struct { - XMLName xml.Name `xml:"QueueMessagesList"` - QueueMessagesList []PeekMessageResponse `xml:"QueueMessage"` -} - -// PeekMessageResponse represents a QueueMessage object returned from Peek -// Messages operation response. -type PeekMessageResponse struct { - MessageID string `xml:"MessageId"` - InsertionTime string `xml:"InsertionTime"` - ExpirationTime string `xml:"ExpirationTime"` - DequeueCount int `xml:"DequeueCount"` - MessageText string `xml:"MessageText"` -} - -// QueueMetadataResponse represents user defined metadata and queue -// properties on a specific queue. -// -// See https://msdn.microsoft.com/en-us/library/azure/dd179384.aspx -type QueueMetadataResponse struct { - ApproximateMessageCount int - UserDefinedMetadata map[string]string -} - -// SetMetadata operation sets user-defined metadata on the specified queue. -// Metadata is associated with the queue as name-value pairs. -// -// See https://msdn.microsoft.com/en-us/library/azure/dd179348.aspx -func (c QueueServiceClient) SetMetadata(name string, metadata map[string]string) error { - uri := c.client.getEndpoint(queueServiceName, pathForQueue(name), url.Values{"comp": []string{"metadata"}}) - metadata = c.client.protectUserAgent(metadata) - headers := c.client.getStandardHeaders() - for k, v := range metadata { - headers[userDefinedMetadataHeaderPrefix+k] = v - } - - resp, err := c.client.exec(http.MethodPut, uri, headers, nil, c.auth) - if err != nil { - return err - } - defer resp.body.Close() - - return checkRespCode(resp.statusCode, []int{http.StatusNoContent}) -} - -// GetMetadata operation retrieves user-defined metadata and queue -// properties on the specified queue. Metadata is associated with -// the queue as name-values pairs. -// -// See https://msdn.microsoft.com/en-us/library/azure/dd179384.aspx -// -// Because the way Golang's http client (and http.Header in particular) -// canonicalize header names, the returned metadata names would always -// be all lower case. -func (c QueueServiceClient) GetMetadata(name string) (QueueMetadataResponse, error) { - qm := QueueMetadataResponse{} - qm.UserDefinedMetadata = make(map[string]string) - uri := c.client.getEndpoint(queueServiceName, pathForQueue(name), url.Values{"comp": []string{"metadata"}}) - headers := c.client.getStandardHeaders() - resp, err := c.client.exec(http.MethodGet, uri, headers, nil, c.auth) - if err != nil { - return qm, err - } - defer resp.body.Close() - - for k, v := range resp.headers { - if len(v) != 1 { - return qm, fmt.Errorf("Unexpected number of values (%d) in response header '%s'", len(v), k) - } - - value := v[0] - - if k == approximateMessagesCountHeader { - qm.ApproximateMessageCount, err = strconv.Atoi(value) - if err != nil { - return qm, fmt.Errorf("Unexpected value in response header '%s': '%s' ", k, value) - } - } else if strings.HasPrefix(k, userDefinedMetadataHeaderPrefix) { - name := strings.TrimPrefix(k, userDefinedMetadataHeaderPrefix) - qm.UserDefinedMetadata[strings.ToLower(name)] = value - } - } - - return qm, checkRespCode(resp.statusCode, []int{http.StatusOK}) -} - -// CreateQueue operation creates a queue under the given account. -// -// See https://msdn.microsoft.com/en-us/library/azure/dd179342.aspx -func (c QueueServiceClient) CreateQueue(name string) error { - uri := c.client.getEndpoint(queueServiceName, pathForQueue(name), url.Values{}) - headers := c.client.getStandardHeaders() - resp, err := c.client.exec(http.MethodPut, uri, headers, nil, c.auth) - if err != nil { - return err - } - defer resp.body.Close() - return checkRespCode(resp.statusCode, []int{http.StatusCreated}) -} - -// DeleteQueue operation permanently deletes the specified queue. -// -// See https://msdn.microsoft.com/en-us/library/azure/dd179436.aspx -func (c QueueServiceClient) DeleteQueue(name string) error { - uri := c.client.getEndpoint(queueServiceName, pathForQueue(name), url.Values{}) - resp, err := c.client.exec(http.MethodDelete, uri, c.client.getStandardHeaders(), nil, c.auth) - if err != nil { - return err - } - defer resp.body.Close() - return checkRespCode(resp.statusCode, []int{http.StatusNoContent}) -} - -// QueueExists returns true if a queue with given name exists. -func (c QueueServiceClient) QueueExists(name string) (bool, error) { - uri := c.client.getEndpoint(queueServiceName, pathForQueue(name), url.Values{"comp": {"metadata"}}) - resp, err := c.client.exec(http.MethodGet, uri, c.client.getStandardHeaders(), nil, c.auth) - if resp != nil && (resp.statusCode == http.StatusOK || resp.statusCode == http.StatusNotFound) { - return resp.statusCode == http.StatusOK, nil - } - - return false, err -} - -// PutMessage operation adds a new message to the back of the message queue. -// -// See https://msdn.microsoft.com/en-us/library/azure/dd179346.aspx -func (c QueueServiceClient) PutMessage(queue string, message string, params PutMessageParameters) error { - uri := c.client.getEndpoint(queueServiceName, pathForQueueMessages(queue), params.getParameters()) - req := putMessageRequest{MessageText: message} - body, nn, err := xmlMarshal(req) - if err != nil { - return err - } - headers := c.client.getStandardHeaders() - headers["Content-Length"] = strconv.Itoa(nn) - resp, err := c.client.exec(http.MethodPost, uri, headers, body, c.auth) - if err != nil { - return err - } - defer resp.body.Close() - return checkRespCode(resp.statusCode, []int{http.StatusCreated}) -} - -// ClearMessages operation deletes all messages from the specified queue. -// -// See https://msdn.microsoft.com/en-us/library/azure/dd179454.aspx -func (c QueueServiceClient) ClearMessages(queue string) error { - uri := c.client.getEndpoint(queueServiceName, pathForQueueMessages(queue), url.Values{}) - resp, err := c.client.exec(http.MethodDelete, uri, c.client.getStandardHeaders(), nil, c.auth) - if err != nil { - return err - } - defer resp.body.Close() - return checkRespCode(resp.statusCode, []int{http.StatusNoContent}) -} - -// GetMessages operation retrieves one or more messages from the front of the -// queue. -// -// See https://msdn.microsoft.com/en-us/library/azure/dd179474.aspx -func (c QueueServiceClient) GetMessages(queue string, params GetMessagesParameters) (GetMessagesResponse, error) { - var r GetMessagesResponse - uri := c.client.getEndpoint(queueServiceName, pathForQueueMessages(queue), params.getParameters()) - resp, err := c.client.exec(http.MethodGet, uri, c.client.getStandardHeaders(), nil, c.auth) - if err != nil { - return r, err - } - defer resp.body.Close() - err = xmlUnmarshal(resp.body, &r) - return r, err -} - -// PeekMessages retrieves one or more messages from the front of the queue, but -// does not alter the visibility of the message. -// -// See https://msdn.microsoft.com/en-us/library/azure/dd179472.aspx -func (c QueueServiceClient) PeekMessages(queue string, params PeekMessagesParameters) (PeekMessagesResponse, error) { - var r PeekMessagesResponse - uri := c.client.getEndpoint(queueServiceName, pathForQueueMessages(queue), params.getParameters()) - resp, err := c.client.exec(http.MethodGet, uri, c.client.getStandardHeaders(), nil, c.auth) - if err != nil { - return r, err - } - defer resp.body.Close() - err = xmlUnmarshal(resp.body, &r) - return r, err -} - -// DeleteMessage operation deletes the specified message. -// -// See https://msdn.microsoft.com/en-us/library/azure/dd179347.aspx -func (c QueueServiceClient) DeleteMessage(queue, messageID, popReceipt string) error { - uri := c.client.getEndpoint(queueServiceName, pathForMessage(queue, messageID), url.Values{ - "popreceipt": {popReceipt}}) - resp, err := c.client.exec(http.MethodDelete, uri, c.client.getStandardHeaders(), nil, c.auth) - if err != nil { - return err - } - defer resp.body.Close() - return checkRespCode(resp.statusCode, []int{http.StatusNoContent}) -} - -// UpdateMessage operation deletes the specified message. -// -// See https://msdn.microsoft.com/en-us/library/azure/hh452234.aspx -func (c QueueServiceClient) UpdateMessage(queue string, messageID string, message string, params UpdateMessageParameters) error { - uri := c.client.getEndpoint(queueServiceName, pathForMessage(queue, messageID), params.getParameters()) - req := putMessageRequest{MessageText: message} - body, nn, err := xmlMarshal(req) - if err != nil { - return err - } - headers := c.client.getStandardHeaders() - headers["Content-Length"] = fmt.Sprintf("%d", nn) - resp, err := c.client.exec(http.MethodPut, uri, headers, body, c.auth) - if err != nil { - return err - } - defer resp.body.Close() - return checkRespCode(resp.statusCode, []int{http.StatusNoContent}) -} diff --git a/storage/queue_test.go b/storage/queue_test.go deleted file mode 100644 index 45a8901d6beb..000000000000 --- a/storage/queue_test.go +++ /dev/null @@ -1,142 +0,0 @@ -package storage - -import ( - "time" - - chk "gopkg.in/check.v1" -) - -type StorageQueueSuite struct{} - -var _ = chk.Suite(&StorageQueueSuite{}) - -func getQueueClient(c *chk.C) QueueServiceClient { - return getBasicClient(c).GetQueueService() -} - -func (s *StorageQueueSuite) Test_pathForQueue(c *chk.C) { - c.Assert(pathForQueue("q"), chk.Equals, "/q") -} - -func (s *StorageQueueSuite) Test_pathForQueueMessages(c *chk.C) { - c.Assert(pathForQueueMessages("q"), chk.Equals, "/q/messages") -} - -func (s *StorageQueueSuite) Test_pathForMessage(c *chk.C) { - c.Assert(pathForMessage("q", "m"), chk.Equals, "/q/messages/m") -} - -func (s *StorageQueueSuite) TestCreateQueue_DeleteQueue(c *chk.C) { - cli := getQueueClient(c) - name := randString(20) - c.Assert(cli.CreateQueue(name), chk.IsNil) - c.Assert(cli.DeleteQueue(name), chk.IsNil) -} - -func (s *StorageQueueSuite) Test_GetMetadata_GetApproximateCount(c *chk.C) { - cli := getQueueClient(c) - name := randString(20) - c.Assert(cli.CreateQueue(name), chk.IsNil) - defer cli.DeleteQueue(name) - - qm, err := cli.GetMetadata(name) - c.Assert(err, chk.IsNil) - c.Assert(qm.ApproximateMessageCount, chk.Equals, 0) - - for ix := 0; ix < 3; ix++ { - err = cli.PutMessage(name, "foobar", PutMessageParameters{}) - c.Assert(err, chk.IsNil) - } - time.Sleep(1 * time.Second) - - qm, err = cli.GetMetadata(name) - c.Assert(err, chk.IsNil) - c.Assert(qm.ApproximateMessageCount, chk.Equals, 3) -} - -func (s *StorageQueueSuite) Test_SetMetadataGetMetadata_Roundtrips(c *chk.C) { - cli := getQueueClient(c) - name := randString(20) - c.Assert(cli.CreateQueue(name), chk.IsNil) - defer cli.DeleteQueue(name) - - metadata := make(map[string]string) - metadata["Foo1"] = "bar1" - metadata["fooBaz"] = "bar" - err := cli.SetMetadata(name, metadata) - c.Assert(err, chk.IsNil) - - qm, err := cli.GetMetadata(name) - c.Assert(err, chk.IsNil) - c.Assert(qm.UserDefinedMetadata["foo1"], chk.Equals, "bar1") - c.Assert(qm.UserDefinedMetadata["foobaz"], chk.Equals, "bar") -} - -func (s *StorageQueueSuite) TestQueueExists(c *chk.C) { - cli := getQueueClient(c) - ok, err := cli.QueueExists("nonexistent-queue") - c.Assert(err, chk.IsNil) - c.Assert(ok, chk.Equals, false) - - name := randString(20) - c.Assert(cli.CreateQueue(name), chk.IsNil) - defer cli.DeleteQueue(name) - - ok, err = cli.QueueExists(name) - c.Assert(err, chk.IsNil) - c.Assert(ok, chk.Equals, true) -} - -func (s *StorageQueueSuite) TestPutMessage_PeekMessage_UpdateMessage_DeleteMessage(c *chk.C) { - q := randString(20) - cli := getQueueClient(c) - c.Assert(cli.CreateQueue(q), chk.IsNil) - defer cli.DeleteQueue(q) - - msg := randString(64 * 1024) // exercise max length - c.Assert(cli.PutMessage(q, msg, PutMessageParameters{}), chk.IsNil) - r, err := cli.PeekMessages(q, PeekMessagesParameters{}) - c.Assert(err, chk.IsNil) - c.Assert(len(r.QueueMessagesList), chk.Equals, 1) - c.Assert(r.QueueMessagesList[0].MessageText, chk.Equals, msg) - - gr, gerr := cli.GetMessages(q, GetMessagesParameters{NumOfMessages: 1, VisibilityTimeout: 2}) - c.Assert(gerr, chk.IsNil) - - updatedMsg := "Test Message" - c.Assert(cli.UpdateMessage(q, r.QueueMessagesList[0].MessageID, updatedMsg, - UpdateMessageParameters{PopReceipt: gr.QueueMessagesList[0].PopReceipt, VisibilityTimeout: 2}), chk.IsNil) - r, err = cli.PeekMessages(q, PeekMessagesParameters{}) - c.Assert(err, chk.IsNil) - c.Assert(len(r.QueueMessagesList), chk.Equals, 0) -} - -func (s *StorageQueueSuite) TestGetMessages(c *chk.C) { - q := randString(20) - cli := getQueueClient(c) - c.Assert(cli.CreateQueue(q), chk.IsNil) - defer cli.DeleteQueue(q) - - n := 4 - for i := 0; i < n; i++ { - c.Assert(cli.PutMessage(q, randString(10), PutMessageParameters{}), chk.IsNil) - } - - r, err := cli.GetMessages(q, GetMessagesParameters{NumOfMessages: n}) - c.Assert(err, chk.IsNil) - c.Assert(len(r.QueueMessagesList), chk.Equals, n) -} - -func (s *StorageQueueSuite) TestDeleteMessages(c *chk.C) { - q := randString(20) - cli := getQueueClient(c) - c.Assert(cli.CreateQueue(q), chk.IsNil) - defer cli.DeleteQueue(q) - - c.Assert(cli.PutMessage(q, "message", PutMessageParameters{}), chk.IsNil) - r, err := cli.GetMessages(q, GetMessagesParameters{VisibilityTimeout: 1}) - c.Assert(err, chk.IsNil) - c.Assert(len(r.QueueMessagesList), chk.Equals, 1) - m := r.QueueMessagesList[0] - c.Assert(cli.DeleteMessage(q, m.MessageID, m.PopReceipt), chk.IsNil) -} diff --git a/storage/share.go b/storage/share.go deleted file mode 100644 index 8423aedcc549..000000000000 --- a/storage/share.go +++ /dev/null @@ -1,186 +0,0 @@ -package storage - -import ( - "fmt" - "net/http" - "net/url" - "strconv" -) - -// Share represents an Azure file share. -type Share struct { - fsc *FileServiceClient - Name string `xml:"Name"` - Properties ShareProperties `xml:"Properties"` - Metadata map[string]string -} - -// ShareProperties contains various properties of a share. -type ShareProperties struct { - LastModified string `xml:"Last-Modified"` - Etag string `xml:"Etag"` - Quota int `xml:"Quota"` -} - -// builds the complete path for this share object. -func (s *Share) buildPath() string { - return fmt.Sprintf("/%s", s.Name) -} - -// Create this share under the associated account. -// If a share with the same name already exists, the operation fails. -// -// See https://msdn.microsoft.com/en-us/library/azure/dn167008.aspx -func (s *Share) Create() error { - headers, err := s.fsc.createResource(s.buildPath(), resourceShare, mergeMDIntoExtraHeaders(s.Metadata, nil)) - if err != nil { - return err - } - - s.updateEtagAndLastModified(headers) - return nil -} - -// CreateIfNotExists creates this share under the associated account if -// it does not exist. Returns true if the share is newly created or false if -// the share already exists. -// -// See https://msdn.microsoft.com/en-us/library/azure/dn167008.aspx -func (s *Share) CreateIfNotExists() (bool, error) { - resp, err := s.fsc.createResourceNoClose(s.buildPath(), resourceShare, nil) - if resp != nil { - defer resp.body.Close() - if resp.statusCode == http.StatusCreated || resp.statusCode == http.StatusConflict { - if resp.statusCode == http.StatusCreated { - s.updateEtagAndLastModified(resp.headers) - return true, nil - } - return false, s.FetchAttributes() - } - } - - return false, err -} - -// Delete marks this share for deletion. The share along with any files -// and directories contained within it are later deleted during garbage -// collection. If the share does not exist the operation fails -// -// See https://msdn.microsoft.com/en-us/library/azure/dn689090.aspx -func (s *Share) Delete() error { - return s.fsc.deleteResource(s.buildPath(), resourceShare) -} - -// DeleteIfExists operation marks this share for deletion if it exists. -// -// See https://msdn.microsoft.com/en-us/library/azure/dn689090.aspx -func (s *Share) DeleteIfExists() (bool, error) { - resp, err := s.fsc.deleteResourceNoClose(s.buildPath(), resourceShare) - if resp != nil { - defer resp.body.Close() - if resp.statusCode == http.StatusAccepted || resp.statusCode == http.StatusNotFound { - return resp.statusCode == http.StatusAccepted, nil - } - } - return false, err -} - -// Exists returns true if this share already exists -// on the storage account, otherwise returns false. -func (s *Share) Exists() (bool, error) { - exists, headers, err := s.fsc.resourceExists(s.buildPath(), resourceShare) - if exists { - s.updateEtagAndLastModified(headers) - s.updateQuota(headers) - } - return exists, err -} - -// FetchAttributes retrieves metadata and properties for this share. -func (s *Share) FetchAttributes() error { - headers, err := s.fsc.getResourceHeaders(s.buildPath(), compNone, resourceShare, http.MethodHead) - if err != nil { - return err - } - - s.updateEtagAndLastModified(headers) - s.updateQuota(headers) - s.Metadata = getMetadataFromHeaders(headers) - - return nil -} - -// GetRootDirectoryReference returns a Directory object at the root of this share. -func (s *Share) GetRootDirectoryReference() *Directory { - return &Directory{ - fsc: s.fsc, - share: s, - } -} - -// ServiceClient returns the FileServiceClient associated with this share. -func (s *Share) ServiceClient() *FileServiceClient { - return s.fsc -} - -// SetMetadata replaces the metadata for this share. -// -// Some keys may be converted to Camel-Case before sending. All keys -// are returned in lower case by GetShareMetadata. HTTP header names -// are case-insensitive so case munging should not matter to other -// applications either. -// -// See https://msdn.microsoft.com/en-us/library/azure/dd179414.aspx -func (s *Share) SetMetadata() error { - headers, err := s.fsc.setResourceHeaders(s.buildPath(), compMetadata, resourceShare, mergeMDIntoExtraHeaders(s.Metadata, nil)) - if err != nil { - return err - } - - s.updateEtagAndLastModified(headers) - return nil -} - -// SetProperties sets system properties for this share. -// -// Some keys may be converted to Camel-Case before sending. All keys -// are returned in lower case by SetShareProperties. HTTP header names -// are case-insensitive so case munging should not matter to other -// applications either. -// -// See https://msdn.microsoft.com/en-us/library/azure/mt427368.aspx -func (s *Share) SetProperties() error { - if s.Properties.Quota < 1 || s.Properties.Quota > 5120 { - return fmt.Errorf("invalid value %v for quota, valid values are [1, 5120]", s.Properties.Quota) - } - - headers, err := s.fsc.setResourceHeaders(s.buildPath(), compProperties, resourceShare, map[string]string{ - "x-ms-share-quota": strconv.Itoa(s.Properties.Quota), - }) - if err != nil { - return err - } - - s.updateEtagAndLastModified(headers) - return nil -} - -// updates Etag and last modified date -func (s *Share) updateEtagAndLastModified(headers http.Header) { - s.Properties.Etag = headers.Get("Etag") - s.Properties.LastModified = headers.Get("Last-Modified") -} - -// updates quota value -func (s *Share) updateQuota(headers http.Header) { - quota, err := strconv.Atoi(headers.Get("x-ms-share-quota")) - if err == nil { - s.Properties.Quota = quota - } -} - -// URL gets the canonical URL to this share. This method does not create a publicly accessible -// URL if the share is private and this method does not check if the share exists. -func (s *Share) URL() string { - return s.fsc.client.getEndpoint(fileServiceName, s.buildPath(), url.Values{}) -} diff --git a/storage/share_test.go b/storage/share_test.go deleted file mode 100644 index 863c32d0bc82..000000000000 --- a/storage/share_test.go +++ /dev/null @@ -1,188 +0,0 @@ -package storage - -import ( - "math/rand" - - chk "gopkg.in/check.v1" -) - -type StorageShareSuite struct{} - -var _ = chk.Suite(&StorageShareSuite{}) - -const testSharePrefix = "zzzzztest" - -func randShare() string { - return testSharePrefix + randString(32-len(testSharePrefix)) -} - -func getFileClient(c *chk.C) FileServiceClient { - return getBasicClient(c).GetFileService() -} - -func (s *StorageShareSuite) TestCreateShareDeleteShare(c *chk.C) { - cli := getFileClient(c) - share := cli.GetShareReference(randShare()) - c.Assert(share.Create(), chk.IsNil) - c.Assert(share.Delete(), chk.IsNil) -} - -func (s *StorageShareSuite) TestCreateShareIfNotExists(c *chk.C) { - cli := getFileClient(c) - share := cli.GetShareReference(randShare()) - - // First create - ok, err := share.CreateIfNotExists() - c.Assert(err, chk.IsNil) - c.Assert(ok, chk.Equals, true) - - // Second create, should not give errors - ok, err = share.CreateIfNotExists() - c.Assert(err, chk.IsNil) - c.Assert(ok, chk.Equals, false) - - // cleanup - share.Delete() -} - -func (s *StorageShareSuite) TestDeleteShareIfNotExists(c *chk.C) { - cli := getFileClient(c) - share := cli.GetShareReference(randShare()) - - // delete non-existing share - ok, err := share.DeleteIfExists() - c.Assert(err, chk.IsNil) - c.Assert(ok, chk.Equals, false) - - c.Assert(share.Create(), chk.IsNil) - - // delete existing share - ok, err = share.DeleteIfExists() - c.Assert(err, chk.IsNil) - c.Assert(ok, chk.Equals, true) -} - -func (s *StorageShareSuite) TestListShares(c *chk.C) { - cli := getFileClient(c) - c.Assert(deleteTestShares(cli), chk.IsNil) - - name := randShare() - share := cli.GetShareReference(name) - - c.Assert(share.Create(), chk.IsNil) - - resp, err := cli.ListShares(ListSharesParameters{ - MaxResults: 5, - Prefix: testSharePrefix}) - c.Assert(err, chk.IsNil) - - c.Check(len(resp.Shares), chk.Equals, 1) - c.Check(resp.Shares[0].Name, chk.Equals, name) - - // clean up via the retrieved share object - resp.Shares[0].Delete() -} - -func (s *StorageShareSuite) TestShareExists(c *chk.C) { - cli := getFileClient(c) - share := cli.GetShareReference(randShare()) - - ok, err := share.Exists() - c.Assert(err, chk.IsNil) - c.Assert(ok, chk.Equals, false) - - c.Assert(share.Create(), chk.IsNil) - defer share.Delete() - - ok, err = share.Exists() - c.Assert(err, chk.IsNil) - c.Assert(ok, chk.Equals, true) -} - -func (s *StorageShareSuite) TestGetAndSetShareProperties(c *chk.C) { - cli := getFileClient(c) - share := cli.GetShareReference(randShare()) - quota := rand.Intn(5120) - - c.Assert(share.Create(), chk.IsNil) - defer share.Delete() - c.Assert(share.Properties.LastModified, chk.Not(chk.Equals), "") - - share.Properties.Quota = quota - err := share.SetProperties() - c.Assert(err, chk.IsNil) - - err = share.FetchAttributes() - c.Assert(err, chk.IsNil) - - c.Assert(share.Properties.Quota, chk.Equals, quota) -} - -func (s *StorageShareSuite) TestGetAndSetShareMetadata(c *chk.C) { - cli := getFileClient(c) - share1 := cli.GetShareReference(randShare()) - - c.Assert(share1.Create(), chk.IsNil) - defer share1.Delete() - - // by default there should be no metadata - c.Assert(share1.Metadata, chk.IsNil) - c.Assert(share1.FetchAttributes(), chk.IsNil) - c.Assert(share1.Metadata, chk.IsNil) - - share2 := cli.GetShareReference(randShare()) - c.Assert(share2.Create(), chk.IsNil) - defer share2.Delete() - - c.Assert(share2.Metadata, chk.IsNil) - - mPut := map[string]string{ - "foo": "bar", - "bar_baz": "waz qux", - } - - share2.Metadata = mPut - c.Assert(share2.SetMetadata(), chk.IsNil) - c.Check(share2.Metadata, chk.DeepEquals, mPut) - - c.Assert(share2.FetchAttributes(), chk.IsNil) - c.Check(share2.Metadata, chk.DeepEquals, mPut) - - // Case munging - - mPutUpper := map[string]string{ - "Foo": "different bar", - "bar_BAZ": "different waz qux", - } - mExpectLower := map[string]string{ - "foo": "different bar", - "bar_baz": "different waz qux", - } - - share2.Metadata = mPutUpper - c.Assert(share2.SetMetadata(), chk.IsNil) - - c.Check(share2.Metadata, chk.DeepEquals, mPutUpper) - c.Assert(share2.FetchAttributes(), chk.IsNil) - c.Check(share2.Metadata, chk.DeepEquals, mExpectLower) -} - -func deleteTestShares(cli FileServiceClient) error { - for { - resp, err := cli.ListShares(ListSharesParameters{Prefix: testSharePrefix}) - if err != nil { - return err - } - if len(resp.Shares) == 0 { - break - } - for _, c := range resp.Shares { - share := cli.GetShareReference(c.Name) - err = share.Delete() - if err != nil { - return err - } - } - } - return nil -} diff --git a/storage/storagepolicy.go b/storage/storagepolicy.go deleted file mode 100644 index bee1c31ad61f..000000000000 --- a/storage/storagepolicy.go +++ /dev/null @@ -1,47 +0,0 @@ -package storage - -import ( - "strings" - "time" -) - -// AccessPolicyDetailsXML has specifics about an access policy -// annotated with XML details. -type AccessPolicyDetailsXML struct { - StartTime time.Time `xml:"Start"` - ExpiryTime time.Time `xml:"Expiry"` - Permission string `xml:"Permission"` -} - -// SignedIdentifier is a wrapper for a specific policy -type SignedIdentifier struct { - ID string `xml:"Id"` - AccessPolicy AccessPolicyDetailsXML `xml:"AccessPolicy"` -} - -// SignedIdentifiers part of the response from GetPermissions call. -type SignedIdentifiers struct { - SignedIdentifiers []SignedIdentifier `xml:"SignedIdentifier"` -} - -// AccessPolicy is the response type from the GetPermissions call. -type AccessPolicy struct { - SignedIdentifiersList SignedIdentifiers `xml:"SignedIdentifiers"` -} - -// convertAccessPolicyToXMLStructs converts between AccessPolicyDetails which is a struct better for API usage to the -// AccessPolicy struct which will get converted to XML. -func convertAccessPolicyToXMLStructs(id string, startTime time.Time, expiryTime time.Time, permissions string) SignedIdentifier { - return SignedIdentifier{ - ID: id, - AccessPolicy: AccessPolicyDetailsXML{ - StartTime: startTime.UTC().Round(time.Second), - ExpiryTime: expiryTime.UTC().Round(time.Second), - Permission: permissions, - }, - } -} - -func updatePermissions(permissions, permission string) bool { - return strings.Contains(permissions, permission) -} diff --git a/storage/table.go b/storage/table.go deleted file mode 100644 index 5cbc13ff122d..000000000000 --- a/storage/table.go +++ /dev/null @@ -1,258 +0,0 @@ -package storage - -import ( - "bytes" - "encoding/json" - "fmt" - "io" - "net/http" - "net/url" - "strconv" - "time" -) - -// TableServiceClient contains operations for Microsoft Azure Table Storage -// Service. -type TableServiceClient struct { - client Client - auth authentication -} - -// AzureTable is the typedef of the Azure Table name -type AzureTable string - -const ( - tablesURIPath = "/Tables" -) - -type createTableRequest struct { - TableName string `json:"TableName"` -} - -// TableAccessPolicy are used for SETTING table policies -type TableAccessPolicy struct { - ID string - StartTime time.Time - ExpiryTime time.Time - CanRead bool - CanAppend bool - CanUpdate bool - CanDelete bool -} - -func pathForTable(table AzureTable) string { return fmt.Sprintf("%s", table) } - -func (c *TableServiceClient) getStandardHeaders() map[string]string { - return map[string]string{ - "x-ms-version": "2015-02-21", - "x-ms-date": currentTimeRfc1123Formatted(), - "Accept": "application/json;odata=nometadata", - "Accept-Charset": "UTF-8", - "Content-Type": "application/json", - userAgentHeader: c.client.userAgent, - } -} - -// QueryTables returns the tables created in the -// *TableServiceClient storage account. -func (c *TableServiceClient) QueryTables() ([]AzureTable, error) { - uri := c.client.getEndpoint(tableServiceName, tablesURIPath, url.Values{}) - - headers := c.getStandardHeaders() - headers["Content-Length"] = "0" - - resp, err := c.client.execInternalJSON(http.MethodGet, uri, headers, nil, c.auth) - if err != nil { - return nil, err - } - defer resp.body.Close() - - if err := checkRespCode(resp.statusCode, []int{http.StatusOK}); err != nil { - return nil, err - } - - buf := new(bytes.Buffer) - if _, err := buf.ReadFrom(resp.body); err != nil { - return nil, err - } - - var respArray queryTablesResponse - if err := json.Unmarshal(buf.Bytes(), &respArray); err != nil { - return nil, err - } - - s := make([]AzureTable, len(respArray.TableName)) - for i, elem := range respArray.TableName { - s[i] = AzureTable(elem.TableName) - } - - return s, nil -} - -// CreateTable creates the table given the specific -// name. This function fails if the name is not compliant -// with the specification or the tables already exists. -func (c *TableServiceClient) CreateTable(table AzureTable) error { - uri := c.client.getEndpoint(tableServiceName, tablesURIPath, url.Values{}) - - headers := c.getStandardHeaders() - - req := createTableRequest{TableName: string(table)} - buf := new(bytes.Buffer) - - if err := json.NewEncoder(buf).Encode(req); err != nil { - return err - } - - headers["Content-Length"] = fmt.Sprintf("%d", buf.Len()) - - resp, err := c.client.execInternalJSON(http.MethodPost, uri, headers, buf, c.auth) - - if err != nil { - return err - } - defer resp.body.Close() - - if err := checkRespCode(resp.statusCode, []int{http.StatusCreated}); err != nil { - return err - } - - return nil -} - -// DeleteTable deletes the table given the specific -// name. This function fails if the table is not present. -// Be advised: DeleteTable deletes all the entries -// that may be present. -func (c *TableServiceClient) DeleteTable(table AzureTable) error { - uri := c.client.getEndpoint(tableServiceName, tablesURIPath, url.Values{}) - uri += fmt.Sprintf("('%s')", string(table)) - - headers := c.getStandardHeaders() - - headers["Content-Length"] = "0" - - resp, err := c.client.execInternalJSON(http.MethodDelete, uri, headers, nil, c.auth) - - if err != nil { - return err - } - defer resp.body.Close() - - if err := checkRespCode(resp.statusCode, []int{http.StatusNoContent}); err != nil { - return err - - } - return nil -} - -// SetTablePermissions sets up table ACL permissions as per REST details https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/Set-Table-ACL -func (c *TableServiceClient) SetTablePermissions(table AzureTable, policies []TableAccessPolicy, timeout uint) (err error) { - params := url.Values{"comp": {"acl"}} - - if timeout > 0 { - params.Add("timeout", fmt.Sprint(timeout)) - } - - uri := c.client.getEndpoint(tableServiceName, string(table), params) - headers := c.client.getStandardHeaders() - - body, length, err := generateTableACLPayload(policies) - if err != nil { - return err - } - headers["Content-Length"] = fmt.Sprintf("%v", length) - - resp, err := c.client.execInternalJSON(http.MethodPut, uri, headers, body, c.auth) - if err != nil { - return err - } - defer resp.body.Close() - - if err := checkRespCode(resp.statusCode, []int{http.StatusNoContent}); err != nil { - return err - } - return nil -} - -func generateTableACLPayload(policies []TableAccessPolicy) (io.Reader, int, error) { - sil := SignedIdentifiers{ - SignedIdentifiers: []SignedIdentifier{}, - } - for _, tap := range policies { - permission := generateTablePermissions(&tap) - signedIdentifier := convertAccessPolicyToXMLStructs(tap.ID, tap.StartTime, tap.ExpiryTime, permission) - sil.SignedIdentifiers = append(sil.SignedIdentifiers, signedIdentifier) - } - return xmlMarshal(sil) -} - -// GetTablePermissions gets the table ACL permissions, as per REST details https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/get-table-acl -func (c *TableServiceClient) GetTablePermissions(table AzureTable, timeout int) (permissionResponse []TableAccessPolicy, err error) { - params := url.Values{"comp": {"acl"}} - - if timeout > 0 { - params.Add("timeout", strconv.Itoa(timeout)) - } - - uri := c.client.getEndpoint(tableServiceName, string(table), params) - headers := c.client.getStandardHeaders() - resp, err := c.client.execInternalJSON(http.MethodGet, uri, headers, nil, c.auth) - if err != nil { - return nil, err - } - defer resp.body.Close() - - if err = checkRespCode(resp.statusCode, []int{http.StatusOK}); err != nil { - return nil, err - } - - var ap AccessPolicy - err = xmlUnmarshal(resp.body, &ap.SignedIdentifiersList) - if err != nil { - return nil, err - } - out := updateTableAccessPolicy(ap) - return out, nil -} - -func updateTableAccessPolicy(ap AccessPolicy) []TableAccessPolicy { - out := []TableAccessPolicy{} - for _, policy := range ap.SignedIdentifiersList.SignedIdentifiers { - tap := TableAccessPolicy{ - ID: policy.ID, - StartTime: policy.AccessPolicy.StartTime, - ExpiryTime: policy.AccessPolicy.ExpiryTime, - } - tap.CanRead = updatePermissions(policy.AccessPolicy.Permission, "r") - tap.CanAppend = updatePermissions(policy.AccessPolicy.Permission, "a") - tap.CanUpdate = updatePermissions(policy.AccessPolicy.Permission, "u") - tap.CanDelete = updatePermissions(policy.AccessPolicy.Permission, "d") - - out = append(out, tap) - } - return out -} - -func generateTablePermissions(tap *TableAccessPolicy) (permissions string) { - // generate the permissions string (raud). - // still want the end user API to have bool flags. - permissions = "" - - if tap.CanRead { - permissions += "r" - } - - if tap.CanAppend { - permissions += "a" - } - - if tap.CanUpdate { - permissions += "u" - } - - if tap.CanDelete { - permissions += "d" - } - return permissions -} diff --git a/storage/table_entities.go b/storage/table_entities.go deleted file mode 100644 index 36413a0cffd1..000000000000 --- a/storage/table_entities.go +++ /dev/null @@ -1,354 +0,0 @@ -package storage - -import ( - "bytes" - "encoding/json" - "fmt" - "io" - "net/http" - "net/url" - "reflect" -) - -// Annotating as secure for gas scanning -/* #nosec */ -const ( - partitionKeyNode = "PartitionKey" - rowKeyNode = "RowKey" - tag = "table" - tagIgnore = "-" - continuationTokenPartitionKeyHeader = "X-Ms-Continuation-Nextpartitionkey" - continuationTokenRowHeader = "X-Ms-Continuation-Nextrowkey" - maxTopParameter = 1000 -) - -type queryTablesResponse struct { - TableName []struct { - TableName string `json:"TableName"` - } `json:"value"` -} - -const ( - tableOperationTypeInsert = iota - tableOperationTypeUpdate = iota - tableOperationTypeMerge = iota - tableOperationTypeInsertOrReplace = iota - tableOperationTypeInsertOrMerge = iota -) - -type tableOperation int - -// TableEntity interface specifies -// the functions needed to support -// marshaling and unmarshaling into -// Azure Tables. The struct must only contain -// simple types because Azure Tables do not -// support hierarchy. -type TableEntity interface { - PartitionKey() string - RowKey() string - SetPartitionKey(string) error - SetRowKey(string) error -} - -// ContinuationToken is an opaque (ie not useful to inspect) -// struct that Get... methods can return if there are more -// entries to be returned than the ones already -// returned. Just pass it to the same function to continue -// receiving the remaining entries. -type ContinuationToken struct { - NextPartitionKey string - NextRowKey string -} - -type getTableEntriesResponse struct { - Elements []map[string]interface{} `json:"value"` -} - -// QueryTableEntities queries the specified table and returns the unmarshaled -// entities of type retType. -// top parameter limits the returned entries up to top. Maximum top -// allowed by Azure API is 1000. In case there are more than top entries to be -// returned the function will return a non nil *ContinuationToken. You can call the -// same function again passing the received ContinuationToken as previousContToken -// parameter in order to get the following entries. The query parameter -// is the odata query. To retrieve all the entries pass the empty string. -// The function returns a pointer to a TableEntity slice, the *ContinuationToken -// if there are more entries to be returned and an error in case something went -// wrong. -// -// Example: -// entities, cToken, err = tSvc.QueryTableEntities("table", cToken, reflect.TypeOf(entity), 20, "") -func (c *TableServiceClient) QueryTableEntities(tableName AzureTable, previousContToken *ContinuationToken, retType reflect.Type, top int, query string) ([]TableEntity, *ContinuationToken, error) { - if top > maxTopParameter { - return nil, nil, fmt.Errorf("top accepts at maximum %d elements. Requested %d instead", maxTopParameter, top) - } - - uri := c.client.getEndpoint(tableServiceName, pathForTable(tableName), url.Values{}) - uri += fmt.Sprintf("?$top=%d", top) - if query != "" { - uri += fmt.Sprintf("&$filter=%s", url.QueryEscape(query)) - } - - if previousContToken != nil { - uri += fmt.Sprintf("&NextPartitionKey=%s&NextRowKey=%s", previousContToken.NextPartitionKey, previousContToken.NextRowKey) - } - - headers := c.getStandardHeaders() - - headers["Content-Length"] = "0" - - resp, err := c.client.execInternalJSON(http.MethodGet, uri, headers, nil, c.auth) - - if err != nil { - return nil, nil, err - } - - contToken := extractContinuationTokenFromHeaders(resp.headers) - - defer resp.body.Close() - - if err = checkRespCode(resp.statusCode, []int{http.StatusOK}); err != nil { - return nil, contToken, err - } - - retEntries, err := deserializeEntity(retType, resp.body) - if err != nil { - return nil, contToken, err - } - - return retEntries, contToken, nil -} - -// InsertEntity inserts an entity in the specified table. -// The function fails if there is an entity with the same -// PartitionKey and RowKey in the table. -func (c *TableServiceClient) InsertEntity(table AzureTable, entity TableEntity) error { - sc, err := c.execTable(table, entity, false, http.MethodPost) - if err != nil { - return err - } - - return checkRespCode(sc, []int{http.StatusCreated}) -} - -func (c *TableServiceClient) execTable(table AzureTable, entity TableEntity, specifyKeysInURL bool, method string) (int, error) { - uri := c.client.getEndpoint(tableServiceName, pathForTable(table), url.Values{}) - if specifyKeysInURL { - uri += fmt.Sprintf("(PartitionKey='%s',RowKey='%s')", url.QueryEscape(entity.PartitionKey()), url.QueryEscape(entity.RowKey())) - } - - headers := c.getStandardHeaders() - - var buf bytes.Buffer - - if err := injectPartitionAndRowKeys(entity, &buf); err != nil { - return 0, err - } - - headers["Content-Length"] = fmt.Sprintf("%d", buf.Len()) - - resp, err := c.client.execInternalJSON(method, uri, headers, &buf, c.auth) - - if err != nil { - return 0, err - } - - defer resp.body.Close() - - return resp.statusCode, nil -} - -// UpdateEntity updates the contents of an entity with the -// one passed as parameter. The function fails if there is no entity -// with the same PartitionKey and RowKey in the table. -func (c *TableServiceClient) UpdateEntity(table AzureTable, entity TableEntity) error { - sc, err := c.execTable(table, entity, true, http.MethodPut) - if err != nil { - return err - } - - return checkRespCode(sc, []int{http.StatusNoContent}) -} - -// MergeEntity merges the contents of an entity with the -// one passed as parameter. -// The function fails if there is no entity -// with the same PartitionKey and RowKey in the table. -func (c *TableServiceClient) MergeEntity(table AzureTable, entity TableEntity) error { - sc, err := c.execTable(table, entity, true, "MERGE") - if err != nil { - return err - } - - return checkRespCode(sc, []int{http.StatusNoContent}) -} - -// DeleteEntityWithoutCheck deletes the entity matching by -// PartitionKey and RowKey. There is no check on IfMatch -// parameter so the entity is always deleted. -// The function fails if there is no entity -// with the same PartitionKey and RowKey in the table. -func (c *TableServiceClient) DeleteEntityWithoutCheck(table AzureTable, entity TableEntity) error { - return c.DeleteEntity(table, entity, "*") -} - -// DeleteEntity deletes the entity matching by -// PartitionKey, RowKey and ifMatch field. -// The function fails if there is no entity -// with the same PartitionKey and RowKey in the table or -// the ifMatch is different. -func (c *TableServiceClient) DeleteEntity(table AzureTable, entity TableEntity, ifMatch string) error { - uri := c.client.getEndpoint(tableServiceName, pathForTable(table), url.Values{}) - uri += fmt.Sprintf("(PartitionKey='%s',RowKey='%s')", url.QueryEscape(entity.PartitionKey()), url.QueryEscape(entity.RowKey())) - - headers := c.getStandardHeaders() - - headers["Content-Length"] = "0" - headers["If-Match"] = ifMatch - - resp, err := c.client.execInternalJSON(http.MethodDelete, uri, headers, nil, c.auth) - - if err != nil { - return err - } - defer resp.body.Close() - - if err := checkRespCode(resp.statusCode, []int{http.StatusNoContent}); err != nil { - return err - } - - return nil -} - -// InsertOrReplaceEntity inserts an entity in the specified table -// or replaced the existing one. -func (c *TableServiceClient) InsertOrReplaceEntity(table AzureTable, entity TableEntity) error { - sc, err := c.execTable(table, entity, true, http.MethodPut) - if err != nil { - return err - } - - return checkRespCode(sc, []int{http.StatusNoContent}) -} - -// InsertOrMergeEntity inserts an entity in the specified table -// or merges the existing one. -func (c *TableServiceClient) InsertOrMergeEntity(table AzureTable, entity TableEntity) error { - sc, err := c.execTable(table, entity, true, "MERGE") - if err != nil { - return err - } - - return checkRespCode(sc, []int{http.StatusNoContent}) -} - -func injectPartitionAndRowKeys(entity TableEntity, buf *bytes.Buffer) error { - if err := json.NewEncoder(buf).Encode(entity); err != nil { - return err - } - - dec := make(map[string]interface{}) - if err := json.NewDecoder(buf).Decode(&dec); err != nil { - return err - } - - // Inject PartitionKey and RowKey - dec[partitionKeyNode] = entity.PartitionKey() - dec[rowKeyNode] = entity.RowKey() - - // Remove tagged fields - // The tag is defined in the const section - // This is useful to avoid storing the PartitionKey and RowKey twice. - numFields := reflect.ValueOf(entity).Elem().NumField() - for i := 0; i < numFields; i++ { - f := reflect.ValueOf(entity).Elem().Type().Field(i) - - if f.Tag.Get(tag) == tagIgnore { - // we must look for its JSON name in the dictionary - // as the user can rename it using a tag - jsonName := f.Name - if f.Tag.Get("json") != "" { - jsonName = f.Tag.Get("json") - } - delete(dec, jsonName) - } - } - - buf.Reset() - - if err := json.NewEncoder(buf).Encode(&dec); err != nil { - return err - } - - return nil -} - -func deserializeEntity(retType reflect.Type, reader io.Reader) ([]TableEntity, error) { - buf := new(bytes.Buffer) - - var ret getTableEntriesResponse - if err := json.NewDecoder(reader).Decode(&ret); err != nil { - return nil, err - } - - tEntries := make([]TableEntity, len(ret.Elements)) - - for i, entry := range ret.Elements { - - buf.Reset() - if err := json.NewEncoder(buf).Encode(entry); err != nil { - return nil, err - } - - dec := make(map[string]interface{}) - if err := json.NewDecoder(buf).Decode(&dec); err != nil { - return nil, err - } - - var pKey, rKey string - // strip pk and rk - for key, val := range dec { - switch key { - case partitionKeyNode: - pKey = val.(string) - case rowKeyNode: - rKey = val.(string) - } - } - - delete(dec, partitionKeyNode) - delete(dec, rowKeyNode) - - buf.Reset() - if err := json.NewEncoder(buf).Encode(dec); err != nil { - return nil, err - } - - // Create a empty retType instance - tEntries[i] = reflect.New(retType.Elem()).Interface().(TableEntity) - // Popolate it with the values - if err := json.NewDecoder(buf).Decode(&tEntries[i]); err != nil { - return nil, err - } - - // Reset PartitionKey and RowKey - if err := tEntries[i].SetPartitionKey(pKey); err != nil { - return nil, err - } - if err := tEntries[i].SetRowKey(rKey); err != nil { - return nil, err - } - } - - return tEntries, nil -} - -func extractContinuationTokenFromHeaders(h http.Header) *ContinuationToken { - ct := ContinuationToken{h.Get(continuationTokenPartitionKeyHeader), h.Get(continuationTokenRowHeader)} - - if ct.NextPartitionKey != "" && ct.NextRowKey != "" { - return &ct - } - return nil -} diff --git a/storage/table_test.go b/storage/table_test.go deleted file mode 100644 index 4f7d2e452909..000000000000 --- a/storage/table_test.go +++ /dev/null @@ -1,338 +0,0 @@ -package storage - -import ( - "crypto/rand" - "fmt" - "reflect" - "time" - - chk "gopkg.in/check.v1" -) - -type TableClient struct{} - -func getTableClient(c *chk.C) TableServiceClient { - return getBasicClient(c).GetTableService() -} - -type CustomEntity struct { - Name string `json:"name"` - Surname string `json:"surname"` - Number int - PKey string `json:"pk" table:"-"` - RKey string `json:"rk" table:"-"` -} - -type CustomEntityExtended struct { - *CustomEntity - ExtraField string -} - -func (c *CustomEntity) PartitionKey() string { - return c.PKey -} - -func (c *CustomEntity) RowKey() string { - return c.RKey -} - -func (c *CustomEntity) SetPartitionKey(s string) error { - c.PKey = s - return nil -} - -func (c *CustomEntity) SetRowKey(s string) error { - c.RKey = s - return nil -} - -func (s *StorageBlobSuite) Test_CreateAndDeleteTable(c *chk.C) { - cli := getTableClient(c) - - tn := AzureTable(randTable()) - - err := cli.CreateTable(tn) - c.Assert(err, chk.IsNil) - - err = cli.DeleteTable(tn) - c.Assert(err, chk.IsNil) -} - -func (s *StorageBlobSuite) Test_InsertEntities(c *chk.C) { - cli := getTableClient(c) - - tn := AzureTable(randTable()) - - err := cli.CreateTable(tn) - c.Assert(err, chk.IsNil) - defer cli.DeleteTable(tn) - - ce := &CustomEntity{Name: "Luke", Surname: "Skywalker", Number: 1543, PKey: "pkey"} - - for i := 0; i < 12; i++ { - ce.SetRowKey(fmt.Sprintf("%d", i)) - - err = cli.InsertEntity(tn, ce) - c.Assert(err, chk.IsNil) - } -} - -func (s *StorageBlobSuite) Test_InsertEntitiesRandomTableFails(c *chk.C) { - cli := getTableClient(c) - - tn := AzureTable(randTable()) - - ce := &CustomEntity{Name: "Luke", Surname: "Skywalker", Number: 1543, PKey: "pkey", RKey: "5"} - err := cli.InsertEntity(tn, ce) - c.Assert(err, chk.NotNil) -} - -func (s *StorageBlobSuite) Test_InsertOrReplaceEntities(c *chk.C) { - cli := getTableClient(c) - - tn := AzureTable(randTable()) - - err := cli.CreateTable(tn) - c.Assert(err, chk.IsNil) - defer cli.DeleteTable(tn) - - ce := &CustomEntity{Name: "Darth", Surname: "Skywalker", Number: 60, PKey: "pkey", RKey: "5"} - - err = cli.InsertOrReplaceEntity(tn, ce) - c.Assert(err, chk.IsNil) - - cextra := &CustomEntityExtended{&CustomEntity{PKey: "pkey", RKey: "5"}, "extra"} - err = cli.InsertOrReplaceEntity(tn, cextra) - c.Assert(err, chk.IsNil) -} - -func (s *StorageBlobSuite) Test_InsertOrMergeEntities(c *chk.C) { - cli := getTableClient(c) - - tn := AzureTable(randTable()) - - err := cli.CreateTable(tn) - c.Assert(err, chk.IsNil) - defer cli.DeleteTable(tn) - - ce := &CustomEntity{Name: "Darth", Surname: "Skywalker", Number: 60, PKey: "pkey", RKey: "5"} - - err = cli.InsertOrMergeEntity(tn, ce) - c.Assert(err, chk.IsNil) - - cextra := &CustomEntityExtended{&CustomEntity{PKey: "pkey", RKey: "5"}, "extra"} - err = cli.InsertOrReplaceEntity(tn, cextra) - c.Assert(err, chk.IsNil) -} - -func (s *StorageBlobSuite) Test_InsertAndGetEntities(c *chk.C) { - cli := getTableClient(c) - - tn := AzureTable(randTable()) - - err := cli.CreateTable(tn) - c.Assert(err, chk.IsNil) - defer cli.DeleteTable(tn) - - ce := &CustomEntity{Name: "Darth", Surname: "Skywalker", Number: 60, PKey: "pkey", RKey: "100"} - c.Assert(cli.InsertOrReplaceEntity(tn, ce), chk.IsNil) - - ce.SetRowKey("200") - c.Assert(cli.InsertOrReplaceEntity(tn, ce), chk.IsNil) - - entries, _, err := cli.QueryTableEntities(tn, nil, reflect.TypeOf(ce), 10, "") - c.Assert(err, chk.IsNil) - - c.Assert(len(entries), chk.Equals, 2) - - c.Assert(ce.RowKey(), chk.Equals, entries[1].RowKey()) - - c.Assert(entries[1].(*CustomEntity), chk.DeepEquals, ce) -} - -func (s *StorageBlobSuite) Test_InsertAndQueryEntities(c *chk.C) { - cli := getTableClient(c) - - tn := AzureTable(randTable()) - - err := cli.CreateTable(tn) - c.Assert(err, chk.IsNil) - defer cli.DeleteTable(tn) - - ce := &CustomEntity{Name: "Darth", Surname: "Skywalker", Number: 60, PKey: "pkey", RKey: "100"} - c.Assert(cli.InsertOrReplaceEntity(tn, ce), chk.IsNil) - - ce.SetRowKey("200") - c.Assert(cli.InsertOrReplaceEntity(tn, ce), chk.IsNil) - - entries, _, err := cli.QueryTableEntities(tn, nil, reflect.TypeOf(ce), 10, "RowKey eq '200'") - c.Assert(err, chk.IsNil) - - c.Assert(len(entries), chk.Equals, 1) - - c.Assert(ce.RowKey(), chk.Equals, entries[0].RowKey()) -} - -func (s *StorageBlobSuite) Test_InsertAndDeleteEntities(c *chk.C) { - cli := getTableClient(c) - - tn := AzureTable(randTable()) - - err := cli.CreateTable(tn) - c.Assert(err, chk.IsNil) - defer cli.DeleteTable(tn) - - ce := &CustomEntity{Name: "Test", Surname: "Test2", Number: 0, PKey: "pkey", RKey: "r01"} - c.Assert(cli.InsertOrReplaceEntity(tn, ce), chk.IsNil) - - ce.Number = 1 - ce.SetRowKey("r02") - c.Assert(cli.InsertOrReplaceEntity(tn, ce), chk.IsNil) - - entries, _, err := cli.QueryTableEntities(tn, nil, reflect.TypeOf(ce), 10, "Number eq 1") - c.Assert(err, chk.IsNil) - - c.Assert(len(entries), chk.Equals, 1) - - c.Assert(entries[0].(*CustomEntity), chk.DeepEquals, ce) - - c.Assert(cli.DeleteEntityWithoutCheck(tn, entries[0]), chk.IsNil) - - entries, _, err = cli.QueryTableEntities(tn, nil, reflect.TypeOf(ce), 10, "") - c.Assert(err, chk.IsNil) - - // only 1 entry must be present - c.Assert(len(entries), chk.Equals, 1) -} - -func (s *StorageBlobSuite) Test_ContinuationToken(c *chk.C) { - cli := getTableClient(c) - - tn := AzureTable(randTable()) - - err := cli.CreateTable(tn) - c.Assert(err, chk.IsNil) - defer cli.DeleteTable(tn) - - var ce *CustomEntity - var ceList [5]*CustomEntity - - for i := 0; i < 5; i++ { - ce = &CustomEntity{Name: "Test", Surname: "Test2", Number: i, PKey: "pkey", RKey: fmt.Sprintf("r%d", i)} - ceList[i] = ce - c.Assert(cli.InsertOrReplaceEntity(tn, ce), chk.IsNil) - } - - // retrieve using top = 2. Should return 2 entries, 2 entries and finally - // 1 entry - entries, contToken, err := cli.QueryTableEntities(tn, nil, reflect.TypeOf(ce), 2, "") - c.Assert(err, chk.IsNil) - c.Assert(len(entries), chk.Equals, 2) - c.Assert(entries[0].(*CustomEntity), chk.DeepEquals, ceList[0]) - c.Assert(entries[1].(*CustomEntity), chk.DeepEquals, ceList[1]) - c.Assert(contToken, chk.NotNil) - - entries, contToken, err = cli.QueryTableEntities(tn, contToken, reflect.TypeOf(ce), 2, "") - c.Assert(err, chk.IsNil) - c.Assert(len(entries), chk.Equals, 2) - c.Assert(entries[0].(*CustomEntity), chk.DeepEquals, ceList[2]) - c.Assert(entries[1].(*CustomEntity), chk.DeepEquals, ceList[3]) - c.Assert(contToken, chk.NotNil) - - entries, contToken, err = cli.QueryTableEntities(tn, contToken, reflect.TypeOf(ce), 2, "") - c.Assert(err, chk.IsNil) - c.Assert(len(entries), chk.Equals, 1) - c.Assert(entries[0].(*CustomEntity), chk.DeepEquals, ceList[4]) - c.Assert(contToken, chk.IsNil) -} - -func randTable() string { - const alphanum = "abcdefghijklmnopqrstuvwxyz" - var bytes = make([]byte, 32) - rand.Read(bytes) - for i, b := range bytes { - bytes[i] = alphanum[b%byte(len(alphanum))] - } - return string(bytes) -} - -func appendTablePermission(policies []TableAccessPolicy, ID string, - canRead bool, canAppend bool, canUpdate bool, canDelete bool, - startTime time.Time, expiryTime time.Time) []TableAccessPolicy { - - tap := TableAccessPolicy{ - ID: ID, - StartTime: startTime, - ExpiryTime: expiryTime, - CanRead: canRead, - CanAppend: canAppend, - CanUpdate: canUpdate, - CanDelete: canDelete, - } - policies = append(policies, tap) - return policies -} - -func (s *StorageBlobSuite) TestSetTablePermissionsSuccessfully(c *chk.C) { - cli := getTableClient(c) - tn := AzureTable(randTable()) - err := cli.CreateTable(tn) - c.Assert(err, chk.IsNil) - defer cli.DeleteTable(tn) - - policies := []TableAccessPolicy{} - policies = appendTablePermission(policies, "GolangRocksOnAzure", true, true, true, true, now, now.Add(10*time.Hour)) - - err = cli.SetTablePermissions(tn, policies, 0) - c.Assert(err, chk.IsNil) -} - -func (s *StorageBlobSuite) TestSetTablePermissionsUnsuccessfully(c *chk.C) { - cli := getTableClient(c) - tn := AzureTable("nonexistingtable") - - policies := []TableAccessPolicy{} - policies = appendTablePermission(policies, "GolangRocksOnAzure", true, true, true, true, now, now.Add(10*time.Hour)) - - err := cli.SetTablePermissions(tn, policies, 0) - c.Assert(err, chk.NotNil) -} - -func (s *StorageBlobSuite) TestSetThenGetTablePermissionsSuccessfully(c *chk.C) { - cli := getTableClient(c) - tn := AzureTable(randTable()) - err := cli.CreateTable(tn) - c.Assert(err, chk.IsNil) - defer cli.DeleteTable(tn) - - policies := []TableAccessPolicy{} - policies = appendTablePermission(policies, "GolangRocksOnAzure", true, true, true, true, now, now.Add(10*time.Hour)) - policies = appendTablePermission(policies, "AutoRestIsSuperCool", true, true, false, true, now.Add(20*time.Hour), now.Add(30*time.Hour)) - err = cli.SetTablePermissions(tn, policies, 0) - c.Assert(err, chk.IsNil) - - returnedPolicies, err := cli.GetTablePermissions(tn, 0) - c.Assert(err, chk.IsNil) - - // now check policy set. - c.Assert(returnedPolicies, chk.HasLen, 2) - - for i := range policies { - c.Assert(returnedPolicies[i].ID, chk.Equals, policies[i].ID) - - // test timestamps down the second - // rounding start/expiry time original perms since the returned perms would have been rounded. - // so need rounded vs rounded. - c.Assert(returnedPolicies[i].StartTime.UTC().Round(time.Second).Format(time.RFC1123), - chk.Equals, policies[i].StartTime.UTC().Round(time.Second).Format(time.RFC1123)) - - c.Assert(returnedPolicies[i].ExpiryTime.UTC().Round(time.Second).Format(time.RFC1123), - chk.Equals, policies[i].ExpiryTime.UTC().Round(time.Second).Format(time.RFC1123)) - - c.Assert(returnedPolicies[i].CanRead, chk.Equals, policies[i].CanRead) - c.Assert(returnedPolicies[i].CanAppend, chk.Equals, policies[i].CanAppend) - c.Assert(returnedPolicies[i].CanUpdate, chk.Equals, policies[i].CanUpdate) - c.Assert(returnedPolicies[i].CanDelete, chk.Equals, policies[i].CanDelete) - - } -} diff --git a/storage/util.go b/storage/util.go deleted file mode 100644 index 57ca1b6d937e..000000000000 --- a/storage/util.go +++ /dev/null @@ -1,85 +0,0 @@ -package storage - -import ( - "bytes" - "crypto/hmac" - "crypto/sha256" - "encoding/base64" - "encoding/xml" - "fmt" - "io" - "io/ioutil" - "net/http" - "net/url" - "reflect" - "time" -) - -func (c Client) computeHmac256(message string) string { - h := hmac.New(sha256.New, c.accountKey) - h.Write([]byte(message)) - return base64.StdEncoding.EncodeToString(h.Sum(nil)) -} - -func currentTimeRfc1123Formatted() string { - return timeRfc1123Formatted(time.Now().UTC()) -} - -func timeRfc1123Formatted(t time.Time) string { - return t.Format(http.TimeFormat) -} - -func mergeParams(v1, v2 url.Values) url.Values { - out := url.Values{} - for k, v := range v1 { - out[k] = v - } - for k, v := range v2 { - vals, ok := out[k] - if ok { - vals = append(vals, v...) - out[k] = vals - } else { - out[k] = v - } - } - return out -} - -func prepareBlockListRequest(blocks []Block) string { - s := `` - for _, v := range blocks { - s += fmt.Sprintf("<%s>%s", v.Status, v.ID, v.Status) - } - s += `` - return s -} - -func xmlUnmarshal(body io.Reader, v interface{}) error { - data, err := ioutil.ReadAll(body) - if err != nil { - return err - } - return xml.Unmarshal(data, v) -} - -func xmlMarshal(v interface{}) (io.Reader, int, error) { - b, err := xml.Marshal(v) - if err != nil { - return nil, 0, err - } - return bytes.NewReader(b), len(b), nil -} - -func headersFromStruct(v interface{}) map[string]string { - headers := make(map[string]string) - value := reflect.ValueOf(v) - for i := 0; i < value.NumField(); i++ { - key := value.Type().Field(i).Tag.Get("header") - val := value.Field(i).String() - if key != "" && val != "" { - headers[key] = val - } - } - return headers -} diff --git a/storage/util_test.go b/storage/util_test.go deleted file mode 100644 index a1817d162428..000000000000 --- a/storage/util_test.go +++ /dev/null @@ -1,86 +0,0 @@ -package storage - -import ( - "encoding/xml" - "io/ioutil" - "net/url" - "strings" - "time" - - chk "gopkg.in/check.v1" -) - -func (s *StorageClientSuite) Test_timeRfc1123Formatted(c *chk.C) { - now := time.Now().UTC() - expectedLayout := "Mon, 02 Jan 2006 15:04:05 GMT" - c.Assert(timeRfc1123Formatted(now), chk.Equals, now.Format(expectedLayout)) -} - -func (s *StorageClientSuite) Test_mergeParams(c *chk.C) { - v1 := url.Values{ - "k1": {"v1"}, - "k2": {"v2"}} - v2 := url.Values{ - "k1": {"v11"}, - "k3": {"v3"}} - out := mergeParams(v1, v2) - c.Assert(out.Get("k1"), chk.Equals, "v1") - c.Assert(out.Get("k2"), chk.Equals, "v2") - c.Assert(out.Get("k3"), chk.Equals, "v3") - c.Assert(out["k1"], chk.DeepEquals, []string{"v1", "v11"}) -} - -func (s *StorageClientSuite) Test_prepareBlockListRequest(c *chk.C) { - empty := []Block{} - expected := `` - c.Assert(prepareBlockListRequest(empty), chk.DeepEquals, expected) - - blocks := []Block{{"foo", BlockStatusLatest}, {"bar", BlockStatusUncommitted}} - expected = `foobar` - c.Assert(prepareBlockListRequest(blocks), chk.DeepEquals, expected) -} - -func (s *StorageClientSuite) Test_xmlUnmarshal(c *chk.C) { - xml := ` - - myblob - ` - var blob Blob - body := ioutil.NopCloser(strings.NewReader(xml)) - c.Assert(xmlUnmarshal(body, &blob), chk.IsNil) - c.Assert(blob.Name, chk.Equals, "myblob") -} - -func (s *StorageClientSuite) Test_xmlMarshal(c *chk.C) { - type t struct { - XMLName xml.Name `xml:"S"` - Name string `xml:"Name"` - } - - b := t{Name: "myblob"} - expected := `myblob` - r, i, err := xmlMarshal(b) - c.Assert(err, chk.IsNil) - o, err := ioutil.ReadAll(r) - c.Assert(err, chk.IsNil) - out := string(o) - c.Assert(out, chk.Equals, expected) - c.Assert(i, chk.Equals, len(expected)) -} - -func (s *StorageClientSuite) Test_headersFromStruct(c *chk.C) { - type t struct { - header1 string `header:"HEADER1"` - header2 string `header:"HEADER2"` - } - - h := t{header1: "value1", header2: "value2"} - expected := map[string]string{ - "HEADER1": "value1", - "HEADER2": "value2", - } - - out := headersFromStruct(h) - - c.Assert(out, chk.DeepEquals, expected) -} diff --git a/storage/version.go b/storage/version.go deleted file mode 100644 index 575eb1429c9e..000000000000 --- a/storage/version.go +++ /dev/null @@ -1,5 +0,0 @@ -package storage - -var ( - sdkVersion = "8.1.0-beta" -)