From d15493eb1f48731a52664167e8d3315ee3390266 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Thu, 16 Dec 2021 08:20:45 +0000 Subject: [PATCH] CodeGen from PR 17099 in Azure/azure-rest-api-specs [Go]Track2 modify readme.go.md 11 (#17099) * [Go]Track2 modify readme.go.md 11 * add go multiapi * remove addons * add directive * fix * beta to preview output-folder --- .../armcustomproviders/CHANGELOG.md | 5 + .../armcustomproviders/LICENSE.txt | 21 + .../armcustomproviders/README.md | 75 +++ .../armcustomproviders/autorest.md | 13 + .../armcustomproviders/build.go | 7 + .../customproviders/armcustomproviders/ci.yml | 27 ++ .../customproviders/armcustomproviders/go.mod | 8 + .../customproviders/armcustomproviders/go.sum | 37 ++ .../armcustomproviders/go_mod_tidy_hack.go | 13 + .../zz_generated_associations_client.go | 289 ++++++++++++ .../zz_generated_constants.go | 100 ++++ ...generated_customresourceprovider_client.go | 437 ++++++++++++++++++ .../armcustomproviders/zz_generated_models.go | 335 ++++++++++++++ .../zz_generated_operations_client.go | 89 ++++ .../armcustomproviders/zz_generated_pagers.go | 233 ++++++++++ .../zz_generated_pollers.go | 187 ++++++++ .../zz_generated_response_types.go | 296 ++++++++++++ 17 files changed, 2172 insertions(+) create mode 100644 sdk/resourcemanager/customproviders/armcustomproviders/CHANGELOG.md create mode 100644 sdk/resourcemanager/customproviders/armcustomproviders/LICENSE.txt create mode 100644 sdk/resourcemanager/customproviders/armcustomproviders/README.md create mode 100644 sdk/resourcemanager/customproviders/armcustomproviders/autorest.md create mode 100644 sdk/resourcemanager/customproviders/armcustomproviders/build.go create mode 100644 sdk/resourcemanager/customproviders/armcustomproviders/ci.yml create mode 100644 sdk/resourcemanager/customproviders/armcustomproviders/go.mod create mode 100644 sdk/resourcemanager/customproviders/armcustomproviders/go.sum create mode 100644 sdk/resourcemanager/customproviders/armcustomproviders/go_mod_tidy_hack.go create mode 100644 sdk/resourcemanager/customproviders/armcustomproviders/zz_generated_associations_client.go create mode 100644 sdk/resourcemanager/customproviders/armcustomproviders/zz_generated_constants.go create mode 100644 sdk/resourcemanager/customproviders/armcustomproviders/zz_generated_customresourceprovider_client.go create mode 100644 sdk/resourcemanager/customproviders/armcustomproviders/zz_generated_models.go create mode 100644 sdk/resourcemanager/customproviders/armcustomproviders/zz_generated_operations_client.go create mode 100644 sdk/resourcemanager/customproviders/armcustomproviders/zz_generated_pagers.go create mode 100644 sdk/resourcemanager/customproviders/armcustomproviders/zz_generated_pollers.go create mode 100644 sdk/resourcemanager/customproviders/armcustomproviders/zz_generated_response_types.go diff --git a/sdk/resourcemanager/customproviders/armcustomproviders/CHANGELOG.md b/sdk/resourcemanager/customproviders/armcustomproviders/CHANGELOG.md new file mode 100644 index 000000000000..3e7a62d35c00 --- /dev/null +++ b/sdk/resourcemanager/customproviders/armcustomproviders/CHANGELOG.md @@ -0,0 +1,5 @@ +# Release History + +## 0.1.0 (2021-12-16) + +- Init release. \ No newline at end of file diff --git a/sdk/resourcemanager/customproviders/armcustomproviders/LICENSE.txt b/sdk/resourcemanager/customproviders/armcustomproviders/LICENSE.txt new file mode 100644 index 000000000000..dc0c2ffb3dc1 --- /dev/null +++ b/sdk/resourcemanager/customproviders/armcustomproviders/LICENSE.txt @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) Microsoft Corporation. All rights reserved. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/sdk/resourcemanager/customproviders/armcustomproviders/README.md b/sdk/resourcemanager/customproviders/armcustomproviders/README.md new file mode 100644 index 000000000000..90bb97541ec4 --- /dev/null +++ b/sdk/resourcemanager/customproviders/armcustomproviders/README.md @@ -0,0 +1,75 @@ +# Azure Customproviders Module for Go + +[![PkgGoDev](https://pkg.go.dev/badge/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/customproviders/armcustomproviders)](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/customproviders/armcustomproviders) + +The `armcustomproviders` module provides operations for working with Azure Customproviders. + +[Source code](https://github.com/Azure/azure-sdk-for-go/tree/main/sdk/resourcemanager/customproviders/armcustomproviders) + +# Getting started + +## Prerequisites + +- an [Azure subscription](https://azure.microsoft.com/free/) +- Go 1.16 or above + +## Install the package + +This project uses [Go modules](https://github.com/golang/go/wiki/Modules) for versioning and dependency management. + +Install the Azure Customproviders module: + +```sh +go get github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/customproviders/armcustomproviders +``` + +## Authorization + +When creating a client, you will need to provide a credential for authenticating with Azure Customproviders. The `azidentity` module provides facilities for various ways of authenticating with Azure including client/secret, certificate, managed identity, and more. + +```go +cred, err := azidentity.NewDefaultAzureCredential(nil) +``` + +For more information on authentication, please see the documentation for `azidentity` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity). + +## Clients + +Azure Customproviders modules consist of one or more clients. A client groups a set of related APIs, providing access to its functionality within the specified subscription. Create one or more clients to access the APIs you require using your credential. + +```go +client := armcustomproviders.NewCustomResourceProviderClient(, cred, nil) +``` + +You can use `ClientOptions` in package `github.com/Azure/azure-sdk-for-go/sdk/azcore/arm` to set endpoint to connect with public and sovereign clouds as well as Azure Stack. For more information, please see the documentation for `azcore` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore). + +```go +options = arm.ClientOptions{ + Host: arm.AzureChina, +} +client := armcustomproviders.NewCustomResourceProviderClient(, cred, &options) +``` + +## Provide Feedback + +If you encounter bugs or have suggestions, please +[open an issue](https://github.com/Azure/azure-sdk-for-go/issues) and assign the `Customproviders` label. + +# Contributing + +This project welcomes contributions and suggestions. Most contributions require +you to agree to a Contributor License Agreement (CLA) declaring that you have +the right to, and actually do, grant us the rights to use your contribution. +For details, visit [https://cla.microsoft.com](https://cla.microsoft.com). + +When you submit a pull request, a CLA-bot will automatically determine whether +you need to provide a CLA and decorate the PR appropriately (e.g., label, +comment). Simply follow the instructions provided by the bot. You will only +need to do this once across all repos using our CLA. + +This project has adopted the +[Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). +For more information, see the +[Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) +or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any +additional questions or comments. \ No newline at end of file diff --git a/sdk/resourcemanager/customproviders/armcustomproviders/autorest.md b/sdk/resourcemanager/customproviders/armcustomproviders/autorest.md new file mode 100644 index 000000000000..418451d526e9 --- /dev/null +++ b/sdk/resourcemanager/customproviders/armcustomproviders/autorest.md @@ -0,0 +1,13 @@ +### AutoRest Configuration + +> see https://aka.ms/autorest + +``` yaml +azure-arm: true +require: +- /home/vsts/work/1/s/azure-rest-api-specs/specification/customproviders/resource-manager/readme.md +- /home/vsts/work/1/s/azure-rest-api-specs/specification/customproviders/resource-manager/readme.go.md +license-header: MICROSOFT_MIT_NO_VERSION +module-version: 0.1.0 + +``` \ No newline at end of file diff --git a/sdk/resourcemanager/customproviders/armcustomproviders/build.go b/sdk/resourcemanager/customproviders/armcustomproviders/build.go new file mode 100644 index 000000000000..ae775341ee8f --- /dev/null +++ b/sdk/resourcemanager/customproviders/armcustomproviders/build.go @@ -0,0 +1,7 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. + +// This file enables 'go generate' to regenerate this specific SDK +//go:generate pwsh.exe ../../../../eng/scripts/build.ps1 -skipBuild -cleanGenerated -format -tidy -generate resourcemanager/customproviders/armcustomproviders + +package armcustomproviders diff --git a/sdk/resourcemanager/customproviders/armcustomproviders/ci.yml b/sdk/resourcemanager/customproviders/armcustomproviders/ci.yml new file mode 100644 index 000000000000..c2190b47a464 --- /dev/null +++ b/sdk/resourcemanager/customproviders/armcustomproviders/ci.yml @@ -0,0 +1,27 @@ +# NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. +trigger: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/resourcemanager/customproviders/armcustomproviders/ + +pr: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/resourcemanager/customproviders/armcustomproviders/ + +stages: +- template: /eng/pipelines/templates/jobs/archetype-sdk-client.yml + parameters: + ServiceDirectory: 'resourcemanager/customproviders/armcustomproviders' diff --git a/sdk/resourcemanager/customproviders/armcustomproviders/go.mod b/sdk/resourcemanager/customproviders/armcustomproviders/go.mod new file mode 100644 index 000000000000..e1ef5e5caed9 --- /dev/null +++ b/sdk/resourcemanager/customproviders/armcustomproviders/go.mod @@ -0,0 +1,8 @@ +module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/customproviders/armcustomproviders + +go 1.16 + +require ( + github.com/Azure/azure-sdk-for-go v60.1.0+incompatible + github.com/Azure/azure-sdk-for-go/sdk/azcore v0.20.0 +) diff --git a/sdk/resourcemanager/customproviders/armcustomproviders/go.sum b/sdk/resourcemanager/customproviders/armcustomproviders/go.sum new file mode 100644 index 000000000000..960c6c966a3f --- /dev/null +++ b/sdk/resourcemanager/customproviders/armcustomproviders/go.sum @@ -0,0 +1,37 @@ +github.com/Azure/azure-sdk-for-go v60.1.0+incompatible h1:j6y8ddurcaiyLfwBwPmJFaunp6BDzyQTuAgMrm1r++o= +github.com/Azure/azure-sdk-for-go v60.1.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= +github.com/Azure/azure-sdk-for-go/sdk/azcore v0.20.0 h1:KQgdWmEOmaJKxaUUZwHAYh12t+b+ZJf8q3friycK1kA= +github.com/Azure/azure-sdk-for-go/sdk/azcore v0.20.0/go.mod h1:ZPW/Z0kLCTdDZaDbYTetxc9Cxl/2lNqxYHYNOF2bti0= +github.com/Azure/azure-sdk-for-go/sdk/internal v0.8.1 h1:BUYIbDf/mMZ8945v3QkG3OuqGVyS4Iek0AOLwdRAYoc= +github.com/Azure/azure-sdk-for-go/sdk/internal v0.8.1/go.mod h1:KLF4gFr6DcKFZwSuH8w8yEK6DpFl3LP5rhdvAb7Yz5I= +github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/dnaeon/go-vcr v1.1.0/go.mod h1:M7tiix8f0r6mKKJ3Yq/kqU1OYf3MnfmBWVbPx/yU9ko= +github.com/modocache/gover v0.0.0-20171022184752-b58185e213c5/go.mod h1:caMODM3PzxT8aQXRPkAt8xlV/e7d7w8GM5g0fa5F0D8= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= +github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20201010224723-4f7140c49acb/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/net v0.0.0-20210610132358-84b48f89b13b h1:k+E048sYJHyVnsr1GDrRZWQ32D2C7lWs9JRc0bel53A= +golang.org/x/net v0.0.0-20210610132358-84b48f89b13b/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.6 h1:aRYxNxv6iGQlyVaZmk6ZgYEDa+Jg18DxebPSrd6bg1M= +golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/sdk/resourcemanager/customproviders/armcustomproviders/go_mod_tidy_hack.go b/sdk/resourcemanager/customproviders/armcustomproviders/go_mod_tidy_hack.go new file mode 100644 index 000000000000..04b717670a6d --- /dev/null +++ b/sdk/resourcemanager/customproviders/armcustomproviders/go_mod_tidy_hack.go @@ -0,0 +1,13 @@ +//go:build modhack +// +build modhack + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. + +// This file, and the github.com/Azure/azure-sdk-for-go import, won't actually become part of +// the resultant binary. + +package armcustomproviders + +// Necessary for safely adding multi-module repo. See: https://github.com/golang/go/wiki/Modules#is-it-possible-to-add-a-module-to-a-multi-module-repository +import _ "github.com/Azure/azure-sdk-for-go" diff --git a/sdk/resourcemanager/customproviders/armcustomproviders/zz_generated_associations_client.go b/sdk/resourcemanager/customproviders/armcustomproviders/zz_generated_associations_client.go new file mode 100644 index 000000000000..5ac8b41b96c6 --- /dev/null +++ b/sdk/resourcemanager/customproviders/armcustomproviders/zz_generated_associations_client.go @@ -0,0 +1,289 @@ +//go:build go1.16 +// +build go1.16 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armcustomproviders + +import ( + "context" + "errors" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// AssociationsClient contains the methods for the Associations group. +// Don't use this type directly, use NewAssociationsClient() instead. +type AssociationsClient struct { + ep string + pl runtime.Pipeline +} + +// NewAssociationsClient creates a new instance of AssociationsClient with the specified values. +func NewAssociationsClient(credential azcore.TokenCredential, options *arm.ClientOptions) *AssociationsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &AssociationsClient{ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} +} + +// BeginCreateOrUpdate - Create or update an association. +// If the operation fails it returns the *ErrorResponse error type. +func (client *AssociationsClient) BeginCreateOrUpdate(ctx context.Context, scope string, associationName string, association Association, options *AssociationsBeginCreateOrUpdateOptions) (AssociationsCreateOrUpdatePollerResponse, error) { + resp, err := client.createOrUpdate(ctx, scope, associationName, association, options) + if err != nil { + return AssociationsCreateOrUpdatePollerResponse{}, err + } + result := AssociationsCreateOrUpdatePollerResponse{ + RawResponse: resp, + } + pt, err := armruntime.NewPoller("AssociationsClient.CreateOrUpdate", "", resp, client.pl, client.createOrUpdateHandleError) + if err != nil { + return AssociationsCreateOrUpdatePollerResponse{}, err + } + result.Poller = &AssociationsCreateOrUpdatePoller{ + pt: pt, + } + return result, nil +} + +// CreateOrUpdate - Create or update an association. +// If the operation fails it returns the *ErrorResponse error type. +func (client *AssociationsClient) createOrUpdate(ctx context.Context, scope string, associationName string, association Association, options *AssociationsBeginCreateOrUpdateOptions) (*http.Response, error) { + req, err := client.createOrUpdateCreateRequest(ctx, scope, associationName, association, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return nil, client.createOrUpdateHandleError(resp) + } + return resp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *AssociationsClient) createOrUpdateCreateRequest(ctx context.Context, scope string, associationName string, association Association, options *AssociationsBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/{scope}/providers/Microsoft.CustomProviders/associations/{associationName}" + urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) + if associationName == "" { + return nil, errors.New("parameter associationName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{associationName}", url.PathEscape(associationName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2018-09-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, runtime.MarshalAsJSON(req, association) +} + +// createOrUpdateHandleError handles the CreateOrUpdate error response. +func (client *AssociationsClient) createOrUpdateHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := ErrorResponse{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// BeginDelete - Delete an association. +// If the operation fails it returns the *ErrorResponse error type. +func (client *AssociationsClient) BeginDelete(ctx context.Context, scope string, associationName string, options *AssociationsBeginDeleteOptions) (AssociationsDeletePollerResponse, error) { + resp, err := client.deleteOperation(ctx, scope, associationName, options) + if err != nil { + return AssociationsDeletePollerResponse{}, err + } + result := AssociationsDeletePollerResponse{ + RawResponse: resp, + } + pt, err := armruntime.NewPoller("AssociationsClient.Delete", "", resp, client.pl, client.deleteHandleError) + if err != nil { + return AssociationsDeletePollerResponse{}, err + } + result.Poller = &AssociationsDeletePoller{ + pt: pt, + } + return result, nil +} + +// Delete - Delete an association. +// If the operation fails it returns the *ErrorResponse error type. +func (client *AssociationsClient) deleteOperation(ctx context.Context, scope string, associationName string, options *AssociationsBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, scope, associationName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + return nil, client.deleteHandleError(resp) + } + return resp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *AssociationsClient) deleteCreateRequest(ctx context.Context, scope string, associationName string, options *AssociationsBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/{scope}/providers/Microsoft.CustomProviders/associations/{associationName}" + urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) + if associationName == "" { + return nil, errors.New("parameter associationName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{associationName}", url.PathEscape(associationName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2018-09-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// deleteHandleError handles the Delete error response. +func (client *AssociationsClient) deleteHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := ErrorResponse{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// Get - Get an association. +// If the operation fails it returns the *ErrorResponse error type. +func (client *AssociationsClient) Get(ctx context.Context, scope string, associationName string, options *AssociationsGetOptions) (AssociationsGetResponse, error) { + req, err := client.getCreateRequest(ctx, scope, associationName, options) + if err != nil { + return AssociationsGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return AssociationsGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return AssociationsGetResponse{}, client.getHandleError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *AssociationsClient) getCreateRequest(ctx context.Context, scope string, associationName string, options *AssociationsGetOptions) (*policy.Request, error) { + urlPath := "/{scope}/providers/Microsoft.CustomProviders/associations/{associationName}" + urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) + if associationName == "" { + return nil, errors.New("parameter associationName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{associationName}", url.PathEscape(associationName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2018-09-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *AssociationsClient) getHandleResponse(resp *http.Response) (AssociationsGetResponse, error) { + result := AssociationsGetResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.Association); err != nil { + return AssociationsGetResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// getHandleError handles the Get error response. +func (client *AssociationsClient) getHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := ErrorResponse{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// ListAll - Gets all association for the given scope. +// If the operation fails it returns the *ErrorResponse error type. +func (client *AssociationsClient) ListAll(scope string, options *AssociationsListAllOptions) *AssociationsListAllPager { + return &AssociationsListAllPager{ + client: client, + requester: func(ctx context.Context) (*policy.Request, error) { + return client.listAllCreateRequest(ctx, scope, options) + }, + advancer: func(ctx context.Context, resp AssociationsListAllResponse) (*policy.Request, error) { + return runtime.NewRequest(ctx, http.MethodGet, *resp.AssociationsList.NextLink) + }, + } +} + +// listAllCreateRequest creates the ListAll request. +func (client *AssociationsClient) listAllCreateRequest(ctx context.Context, scope string, options *AssociationsListAllOptions) (*policy.Request, error) { + urlPath := "/{scope}/providers/Microsoft.CustomProviders/associations" + urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2018-09-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// listAllHandleResponse handles the ListAll response. +func (client *AssociationsClient) listAllHandleResponse(resp *http.Response) (AssociationsListAllResponse, error) { + result := AssociationsListAllResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.AssociationsList); err != nil { + return AssociationsListAllResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// listAllHandleError handles the ListAll error response. +func (client *AssociationsClient) listAllHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := ErrorResponse{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} diff --git a/sdk/resourcemanager/customproviders/armcustomproviders/zz_generated_constants.go b/sdk/resourcemanager/customproviders/armcustomproviders/zz_generated_constants.go new file mode 100644 index 000000000000..3107eee6e8bb --- /dev/null +++ b/sdk/resourcemanager/customproviders/armcustomproviders/zz_generated_constants.go @@ -0,0 +1,100 @@ +//go:build go1.16 +// +build go1.16 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armcustomproviders + +const ( + module = "armcustomproviders" + version = "v0.1.0" +) + +// ActionRouting - The routing types that are supported for action requests. +type ActionRouting string + +const ( + ActionRoutingProxy ActionRouting = "Proxy" +) + +// PossibleActionRoutingValues returns the possible values for the ActionRouting const type. +func PossibleActionRoutingValues() []ActionRouting { + return []ActionRouting{ + ActionRoutingProxy, + } +} + +// ToPtr returns a *ActionRouting pointing to the current value. +func (c ActionRouting) ToPtr() *ActionRouting { + return &c +} + +// ProvisioningState - The provisioning state of the resource provider. +type ProvisioningState string + +const ( + ProvisioningStateAccepted ProvisioningState = "Accepted" + ProvisioningStateDeleting ProvisioningState = "Deleting" + ProvisioningStateFailed ProvisioningState = "Failed" + ProvisioningStateRunning ProvisioningState = "Running" + ProvisioningStateSucceeded ProvisioningState = "Succeeded" +) + +// PossibleProvisioningStateValues returns the possible values for the ProvisioningState const type. +func PossibleProvisioningStateValues() []ProvisioningState { + return []ProvisioningState{ + ProvisioningStateAccepted, + ProvisioningStateDeleting, + ProvisioningStateFailed, + ProvisioningStateRunning, + ProvisioningStateSucceeded, + } +} + +// ToPtr returns a *ProvisioningState pointing to the current value. +func (c ProvisioningState) ToPtr() *ProvisioningState { + return &c +} + +// ResourceTypeRouting - The routing types that are supported for resource requests. +type ResourceTypeRouting string + +const ( + ResourceTypeRoutingProxy ResourceTypeRouting = "Proxy" + ResourceTypeRoutingProxyCache ResourceTypeRouting = "Proxy,Cache" +) + +// PossibleResourceTypeRoutingValues returns the possible values for the ResourceTypeRouting const type. +func PossibleResourceTypeRoutingValues() []ResourceTypeRouting { + return []ResourceTypeRouting{ + ResourceTypeRoutingProxy, + ResourceTypeRoutingProxyCache, + } +} + +// ToPtr returns a *ResourceTypeRouting pointing to the current value. +func (c ResourceTypeRouting) ToPtr() *ResourceTypeRouting { + return &c +} + +// ValidationType - The type of validation to run against a matching request. +type ValidationType string + +const ( + ValidationTypeSwagger ValidationType = "Swagger" +) + +// PossibleValidationTypeValues returns the possible values for the ValidationType const type. +func PossibleValidationTypeValues() []ValidationType { + return []ValidationType{ + ValidationTypeSwagger, + } +} + +// ToPtr returns a *ValidationType pointing to the current value. +func (c ValidationType) ToPtr() *ValidationType { + return &c +} diff --git a/sdk/resourcemanager/customproviders/armcustomproviders/zz_generated_customresourceprovider_client.go b/sdk/resourcemanager/customproviders/armcustomproviders/zz_generated_customresourceprovider_client.go new file mode 100644 index 000000000000..846c4f43c7c7 --- /dev/null +++ b/sdk/resourcemanager/customproviders/armcustomproviders/zz_generated_customresourceprovider_client.go @@ -0,0 +1,437 @@ +//go:build go1.16 +// +build go1.16 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armcustomproviders + +import ( + "context" + "errors" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// CustomResourceProviderClient contains the methods for the CustomResourceProvider group. +// Don't use this type directly, use NewCustomResourceProviderClient() instead. +type CustomResourceProviderClient struct { + ep string + pl runtime.Pipeline + subscriptionID string +} + +// NewCustomResourceProviderClient creates a new instance of CustomResourceProviderClient with the specified values. +func NewCustomResourceProviderClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *CustomResourceProviderClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &CustomResourceProviderClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} +} + +// BeginCreateOrUpdate - Creates or updates the custom resource provider. +// If the operation fails it returns the *ErrorResponse error type. +func (client *CustomResourceProviderClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, resourceProviderName string, resourceProvider CustomRPManifest, options *CustomResourceProviderBeginCreateOrUpdateOptions) (CustomResourceProviderCreateOrUpdatePollerResponse, error) { + resp, err := client.createOrUpdate(ctx, resourceGroupName, resourceProviderName, resourceProvider, options) + if err != nil { + return CustomResourceProviderCreateOrUpdatePollerResponse{}, err + } + result := CustomResourceProviderCreateOrUpdatePollerResponse{ + RawResponse: resp, + } + pt, err := armruntime.NewPoller("CustomResourceProviderClient.CreateOrUpdate", "", resp, client.pl, client.createOrUpdateHandleError) + if err != nil { + return CustomResourceProviderCreateOrUpdatePollerResponse{}, err + } + result.Poller = &CustomResourceProviderCreateOrUpdatePoller{ + pt: pt, + } + return result, nil +} + +// CreateOrUpdate - Creates or updates the custom resource provider. +// If the operation fails it returns the *ErrorResponse error type. +func (client *CustomResourceProviderClient) createOrUpdate(ctx context.Context, resourceGroupName string, resourceProviderName string, resourceProvider CustomRPManifest, options *CustomResourceProviderBeginCreateOrUpdateOptions) (*http.Response, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, resourceProviderName, resourceProvider, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return nil, client.createOrUpdateHandleError(resp) + } + return resp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *CustomResourceProviderClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, resourceProviderName string, resourceProvider CustomRPManifest, options *CustomResourceProviderBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomProviders/resourceProviders/{resourceProviderName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if resourceProviderName == "" { + return nil, errors.New("parameter resourceProviderName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceProviderName}", url.PathEscape(resourceProviderName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2018-09-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, runtime.MarshalAsJSON(req, resourceProvider) +} + +// createOrUpdateHandleError handles the CreateOrUpdate error response. +func (client *CustomResourceProviderClient) createOrUpdateHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := ErrorResponse{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// BeginDelete - Deletes the custom resource provider. +// If the operation fails it returns the *ErrorResponse error type. +func (client *CustomResourceProviderClient) BeginDelete(ctx context.Context, resourceGroupName string, resourceProviderName string, options *CustomResourceProviderBeginDeleteOptions) (CustomResourceProviderDeletePollerResponse, error) { + resp, err := client.deleteOperation(ctx, resourceGroupName, resourceProviderName, options) + if err != nil { + return CustomResourceProviderDeletePollerResponse{}, err + } + result := CustomResourceProviderDeletePollerResponse{ + RawResponse: resp, + } + pt, err := armruntime.NewPoller("CustomResourceProviderClient.Delete", "", resp, client.pl, client.deleteHandleError) + if err != nil { + return CustomResourceProviderDeletePollerResponse{}, err + } + result.Poller = &CustomResourceProviderDeletePoller{ + pt: pt, + } + return result, nil +} + +// Delete - Deletes the custom resource provider. +// If the operation fails it returns the *ErrorResponse error type. +func (client *CustomResourceProviderClient) deleteOperation(ctx context.Context, resourceGroupName string, resourceProviderName string, options *CustomResourceProviderBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, resourceProviderName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + return nil, client.deleteHandleError(resp) + } + return resp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *CustomResourceProviderClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, resourceProviderName string, options *CustomResourceProviderBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomProviders/resourceProviders/{resourceProviderName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if resourceProviderName == "" { + return nil, errors.New("parameter resourceProviderName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceProviderName}", url.PathEscape(resourceProviderName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2018-09-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// deleteHandleError handles the Delete error response. +func (client *CustomResourceProviderClient) deleteHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := ErrorResponse{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// Get - Gets the custom resource provider manifest. +// If the operation fails it returns the *ErrorResponse error type. +func (client *CustomResourceProviderClient) Get(ctx context.Context, resourceGroupName string, resourceProviderName string, options *CustomResourceProviderGetOptions) (CustomResourceProviderGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, resourceProviderName, options) + if err != nil { + return CustomResourceProviderGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return CustomResourceProviderGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return CustomResourceProviderGetResponse{}, client.getHandleError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *CustomResourceProviderClient) getCreateRequest(ctx context.Context, resourceGroupName string, resourceProviderName string, options *CustomResourceProviderGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomProviders/resourceProviders/{resourceProviderName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if resourceProviderName == "" { + return nil, errors.New("parameter resourceProviderName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceProviderName}", url.PathEscape(resourceProviderName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2018-09-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *CustomResourceProviderClient) getHandleResponse(resp *http.Response) (CustomResourceProviderGetResponse, error) { + result := CustomResourceProviderGetResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.CustomRPManifest); err != nil { + return CustomResourceProviderGetResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// getHandleError handles the Get error response. +func (client *CustomResourceProviderClient) getHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := ErrorResponse{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// ListByResourceGroup - Gets all the custom resource providers within a resource group. +// If the operation fails it returns the *ErrorResponse error type. +func (client *CustomResourceProviderClient) ListByResourceGroup(resourceGroupName string, options *CustomResourceProviderListByResourceGroupOptions) *CustomResourceProviderListByResourceGroupPager { + return &CustomResourceProviderListByResourceGroupPager{ + client: client, + requester: func(ctx context.Context) (*policy.Request, error) { + return client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) + }, + advancer: func(ctx context.Context, resp CustomResourceProviderListByResourceGroupResponse) (*policy.Request, error) { + return runtime.NewRequest(ctx, http.MethodGet, *resp.ListByCustomRPManifest.NextLink) + }, + } +} + +// listByResourceGroupCreateRequest creates the ListByResourceGroup request. +func (client *CustomResourceProviderClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *CustomResourceProviderListByResourceGroupOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomProviders/resourceProviders" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2018-09-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// listByResourceGroupHandleResponse handles the ListByResourceGroup response. +func (client *CustomResourceProviderClient) listByResourceGroupHandleResponse(resp *http.Response) (CustomResourceProviderListByResourceGroupResponse, error) { + result := CustomResourceProviderListByResourceGroupResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.ListByCustomRPManifest); err != nil { + return CustomResourceProviderListByResourceGroupResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// listByResourceGroupHandleError handles the ListByResourceGroup error response. +func (client *CustomResourceProviderClient) listByResourceGroupHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := ErrorResponse{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// ListBySubscription - Gets all the custom resource providers within a subscription. +// If the operation fails it returns the *ErrorResponse error type. +func (client *CustomResourceProviderClient) ListBySubscription(options *CustomResourceProviderListBySubscriptionOptions) *CustomResourceProviderListBySubscriptionPager { + return &CustomResourceProviderListBySubscriptionPager{ + client: client, + requester: func(ctx context.Context) (*policy.Request, error) { + return client.listBySubscriptionCreateRequest(ctx, options) + }, + advancer: func(ctx context.Context, resp CustomResourceProviderListBySubscriptionResponse) (*policy.Request, error) { + return runtime.NewRequest(ctx, http.MethodGet, *resp.ListByCustomRPManifest.NextLink) + }, + } +} + +// listBySubscriptionCreateRequest creates the ListBySubscription request. +func (client *CustomResourceProviderClient) listBySubscriptionCreateRequest(ctx context.Context, options *CustomResourceProviderListBySubscriptionOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.CustomProviders/resourceProviders" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2018-09-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// listBySubscriptionHandleResponse handles the ListBySubscription response. +func (client *CustomResourceProviderClient) listBySubscriptionHandleResponse(resp *http.Response) (CustomResourceProviderListBySubscriptionResponse, error) { + result := CustomResourceProviderListBySubscriptionResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.ListByCustomRPManifest); err != nil { + return CustomResourceProviderListBySubscriptionResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// listBySubscriptionHandleError handles the ListBySubscription error response. +func (client *CustomResourceProviderClient) listBySubscriptionHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := ErrorResponse{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// Update - Updates an existing custom resource provider. The only value that can be updated via PATCH currently is the tags. +// If the operation fails it returns the *ErrorResponse error type. +func (client *CustomResourceProviderClient) Update(ctx context.Context, resourceGroupName string, resourceProviderName string, patchableResource ResourceProvidersUpdate, options *CustomResourceProviderUpdateOptions) (CustomResourceProviderUpdateResponse, error) { + req, err := client.updateCreateRequest(ctx, resourceGroupName, resourceProviderName, patchableResource, options) + if err != nil { + return CustomResourceProviderUpdateResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return CustomResourceProviderUpdateResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return CustomResourceProviderUpdateResponse{}, client.updateHandleError(resp) + } + return client.updateHandleResponse(resp) +} + +// updateCreateRequest creates the Update request. +func (client *CustomResourceProviderClient) updateCreateRequest(ctx context.Context, resourceGroupName string, resourceProviderName string, patchableResource ResourceProvidersUpdate, options *CustomResourceProviderUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomProviders/resourceProviders/{resourceProviderName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if resourceProviderName == "" { + return nil, errors.New("parameter resourceProviderName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceProviderName}", url.PathEscape(resourceProviderName)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2018-09-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, runtime.MarshalAsJSON(req, patchableResource) +} + +// updateHandleResponse handles the Update response. +func (client *CustomResourceProviderClient) updateHandleResponse(resp *http.Response) (CustomResourceProviderUpdateResponse, error) { + result := CustomResourceProviderUpdateResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.CustomRPManifest); err != nil { + return CustomResourceProviderUpdateResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// updateHandleError handles the Update error response. +func (client *CustomResourceProviderClient) updateHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := ErrorResponse{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} diff --git a/sdk/resourcemanager/customproviders/armcustomproviders/zz_generated_models.go b/sdk/resourcemanager/customproviders/armcustomproviders/zz_generated_models.go new file mode 100644 index 000000000000..ec46a49b0e39 --- /dev/null +++ b/sdk/resourcemanager/customproviders/armcustomproviders/zz_generated_models.go @@ -0,0 +1,335 @@ +//go:build go1.16 +// +build go1.16 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armcustomproviders + +import ( + "encoding/json" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" +) + +// Association - The resource definition of this association. +type Association struct { + // The properties of the association. + Properties *AssociationProperties `json:"properties,omitempty"` + + // READ-ONLY; The association id. + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; The association name. + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; The association type. + Type *string `json:"type,omitempty" azure:"ro"` +} + +// AssociationProperties - The properties of the association. +type AssociationProperties struct { + // The REST resource instance of the target resource for this association. + TargetResourceID *string `json:"targetResourceId,omitempty"` + + // READ-ONLY; The provisioning state of the association. + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` +} + +// AssociationsBeginCreateOrUpdateOptions contains the optional parameters for the Associations.BeginCreateOrUpdate method. +type AssociationsBeginCreateOrUpdateOptions struct { + // placeholder for future optional parameters +} + +// AssociationsBeginDeleteOptions contains the optional parameters for the Associations.BeginDelete method. +type AssociationsBeginDeleteOptions struct { + // placeholder for future optional parameters +} + +// AssociationsGetOptions contains the optional parameters for the Associations.Get method. +type AssociationsGetOptions struct { + // placeholder for future optional parameters +} + +// AssociationsList - List of associations. +type AssociationsList struct { + // The URL to use for getting the next set of results. + NextLink *string `json:"nextLink,omitempty"` + + // The array of associations. + Value []*Association `json:"value,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type AssociationsList. +func (a AssociationsList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", a.NextLink) + populate(objectMap, "value", a.Value) + return json.Marshal(objectMap) +} + +// AssociationsListAllOptions contains the optional parameters for the Associations.ListAll method. +type AssociationsListAllOptions struct { + // placeholder for future optional parameters +} + +// CustomRPActionRouteDefinition - The route definition for an action implemented by the custom resource provider. +type CustomRPActionRouteDefinition struct { + CustomRPRouteDefinition + // The routing types that are supported for action requests. + RoutingType *ActionRouting `json:"routingType,omitempty"` +} + +// CustomRPManifest - A manifest file that defines the custom resource provider resources. +type CustomRPManifest struct { + Resource + // The manifest for the custom resource provider + Properties *CustomRPManifestProperties `json:"properties,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type CustomRPManifest. +func (c CustomRPManifest) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + c.Resource.marshalInternal(objectMap) + populate(objectMap, "properties", c.Properties) + return json.Marshal(objectMap) +} + +// CustomRPManifestProperties - The manifest for the custom resource provider +type CustomRPManifestProperties struct { + // A list of actions that the custom resource provider implements. + Actions []*CustomRPActionRouteDefinition `json:"actions,omitempty"` + + // A list of resource types that the custom resource provider implements. + ResourceTypes []*CustomRPResourceTypeRouteDefinition `json:"resourceTypes,omitempty"` + + // A list of validations to run on the custom resource provider's requests. + Validations []*CustomRPValidations `json:"validations,omitempty"` + + // READ-ONLY; The provisioning state of the resource provider. + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` +} + +// MarshalJSON implements the json.Marshaller interface for type CustomRPManifestProperties. +func (c CustomRPManifestProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "actions", c.Actions) + populate(objectMap, "provisioningState", c.ProvisioningState) + populate(objectMap, "resourceTypes", c.ResourceTypes) + populate(objectMap, "validations", c.Validations) + return json.Marshal(objectMap) +} + +// CustomRPResourceTypeRouteDefinition - The route definition for a resource implemented by the custom resource provider. +type CustomRPResourceTypeRouteDefinition struct { + CustomRPRouteDefinition + // The routing types that are supported for resource requests. + RoutingType *ResourceTypeRouting `json:"routingType,omitempty"` +} + +// CustomRPRouteDefinition - A route definition that defines an action or resource that can be interacted with through the custom resource provider. +type CustomRPRouteDefinition struct { + // REQUIRED; The route definition endpoint URI that the custom resource provider will proxy requests to. This can be in the form of a flat URI (e.g. 'https://testendpoint/') + // or can specify to route via a path + // (e.g. 'https://testendpoint/{requestPath}') + Endpoint *string `json:"endpoint,omitempty"` + + // REQUIRED; The name of the route definition. This becomes the name for the ARM extension (e.g. + // '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomProviders/resourceProviders/{resourceProviderName}/{name}') + Name *string `json:"name,omitempty"` +} + +// CustomRPValidations - A validation to apply on custom resource provider requests. +type CustomRPValidations struct { + // REQUIRED; A link to the validation specification. The specification must be hosted on raw.githubusercontent.com. + Specification *string `json:"specification,omitempty"` + + // The type of validation to run against a matching request. + ValidationType *ValidationType `json:"validationType,omitempty"` +} + +// CustomResourceProviderBeginCreateOrUpdateOptions contains the optional parameters for the CustomResourceProvider.BeginCreateOrUpdate method. +type CustomResourceProviderBeginCreateOrUpdateOptions struct { + // placeholder for future optional parameters +} + +// CustomResourceProviderBeginDeleteOptions contains the optional parameters for the CustomResourceProvider.BeginDelete method. +type CustomResourceProviderBeginDeleteOptions struct { + // placeholder for future optional parameters +} + +// CustomResourceProviderGetOptions contains the optional parameters for the CustomResourceProvider.Get method. +type CustomResourceProviderGetOptions struct { + // placeholder for future optional parameters +} + +// CustomResourceProviderListByResourceGroupOptions contains the optional parameters for the CustomResourceProvider.ListByResourceGroup method. +type CustomResourceProviderListByResourceGroupOptions struct { + // placeholder for future optional parameters +} + +// CustomResourceProviderListBySubscriptionOptions contains the optional parameters for the CustomResourceProvider.ListBySubscription method. +type CustomResourceProviderListBySubscriptionOptions struct { + // placeholder for future optional parameters +} + +// CustomResourceProviderUpdateOptions contains the optional parameters for the CustomResourceProvider.Update method. +type CustomResourceProviderUpdateOptions struct { + // placeholder for future optional parameters +} + +// ErrorDefinition - Error definition. +type ErrorDefinition struct { + // READ-ONLY; Service specific error code which serves as the substatus for the HTTP error code. + Code *string `json:"code,omitempty" azure:"ro"` + + // READ-ONLY; Internal error details. + Details []*ErrorDefinition `json:"details,omitempty" azure:"ro"` + + // READ-ONLY; Description of the error. + Message *string `json:"message,omitempty" azure:"ro"` +} + +// MarshalJSON implements the json.Marshaller interface for type ErrorDefinition. +func (e ErrorDefinition) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "code", e.Code) + populate(objectMap, "details", e.Details) + populate(objectMap, "message", e.Message) + return json.Marshal(objectMap) +} + +// ErrorResponse - Error response. +// Implements the error and azcore.HTTPResponse interfaces. +type ErrorResponse struct { + raw string + // The error details. + InnerError *ErrorDefinition `json:"error,omitempty"` +} + +// Error implements the error interface for type ErrorResponse. +// The contents of the error text are not contractual and subject to change. +func (e ErrorResponse) Error() string { + return e.raw +} + +// ListByCustomRPManifest - List of custom resource providers. +type ListByCustomRPManifest struct { + // The URL to use for getting the next set of results. + NextLink *string `json:"nextLink,omitempty"` + + // The array of custom resource provider manifests. + Value []*CustomRPManifest `json:"value,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type ListByCustomRPManifest. +func (l ListByCustomRPManifest) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", l.NextLink) + populate(objectMap, "value", l.Value) + return json.Marshal(objectMap) +} + +// OperationsListOptions contains the optional parameters for the Operations.List method. +type OperationsListOptions struct { + // placeholder for future optional parameters +} + +// Resource - The resource definition. +type Resource struct { + // REQUIRED; Resource location + Location *string `json:"location,omitempty"` + + // Resource tags + Tags map[string]*string `json:"tags,omitempty"` + + // READ-ONLY; Resource Id + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; Resource name + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; Resource type + Type *string `json:"type,omitempty" azure:"ro"` +} + +// MarshalJSON implements the json.Marshaller interface for type Resource. +func (r Resource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + r.marshalInternal(objectMap) + return json.Marshal(objectMap) +} + +func (r Resource) marshalInternal(objectMap map[string]interface{}) { + populate(objectMap, "id", r.ID) + populate(objectMap, "location", r.Location) + populate(objectMap, "name", r.Name) + populate(objectMap, "tags", r.Tags) + populate(objectMap, "type", r.Type) +} + +// ResourceProviderOperation - Supported operations of this resource provider. +type ResourceProviderOperation struct { + // Display metadata associated with the operation. + Display *ResourceProviderOperationDisplay `json:"display,omitempty"` + + // Operation name, in format of {provider}/{resource}/{operation} + Name *string `json:"name,omitempty"` +} + +// ResourceProviderOperationDisplay - Display metadata associated with the operation. +type ResourceProviderOperationDisplay struct { + // Description of this operation. + Description *string `json:"description,omitempty"` + + // Type of operation: get, read, delete, etc. + Operation *string `json:"operation,omitempty"` + + // Resource provider: Microsoft Custom Providers. + Provider *string `json:"provider,omitempty"` + + // Resource on which the operation is performed. + Resource *string `json:"resource,omitempty"` +} + +// ResourceProviderOperationList - Results of the request to list operations. +type ResourceProviderOperationList struct { + // The URL to use for getting the next set of results. + NextLink *string `json:"nextLink,omitempty"` + + // List of operations supported by this resource provider. + Value []*ResourceProviderOperation `json:"value,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type ResourceProviderOperationList. +func (r ResourceProviderOperationList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", r.NextLink) + populate(objectMap, "value", r.Value) + return json.Marshal(objectMap) +} + +// ResourceProvidersUpdate - custom resource provider update information. +type ResourceProvidersUpdate struct { + // Resource tags + Tags map[string]*string `json:"tags,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type ResourceProvidersUpdate. +func (r ResourceProvidersUpdate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "tags", r.Tags) + return json.Marshal(objectMap) +} + +func populate(m map[string]interface{}, k string, v interface{}) { + if v == nil { + return + } else if azcore.IsNullValue(v) { + m[k] = nil + } else if !reflect.ValueOf(v).IsNil() { + m[k] = v + } +} diff --git a/sdk/resourcemanager/customproviders/armcustomproviders/zz_generated_operations_client.go b/sdk/resourcemanager/customproviders/armcustomproviders/zz_generated_operations_client.go new file mode 100644 index 000000000000..0a0a46c2761c --- /dev/null +++ b/sdk/resourcemanager/customproviders/armcustomproviders/zz_generated_operations_client.go @@ -0,0 +1,89 @@ +//go:build go1.16 +// +build go1.16 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armcustomproviders + +import ( + "context" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" +) + +// OperationsClient contains the methods for the Operations group. +// Don't use this type directly, use NewOperationsClient() instead. +type OperationsClient struct { + ep string + pl runtime.Pipeline +} + +// NewOperationsClient creates a new instance of OperationsClient with the specified values. +func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientOptions) *OperationsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &OperationsClient{ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} +} + +// List - The list of operations provided by Microsoft CustomProviders. +// If the operation fails it returns the *ErrorResponse error type. +func (client *OperationsClient) List(options *OperationsListOptions) *OperationsListPager { + return &OperationsListPager{ + client: client, + requester: func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, options) + }, + advancer: func(ctx context.Context, resp OperationsListResponse) (*policy.Request, error) { + return runtime.NewRequest(ctx, http.MethodGet, *resp.ResourceProviderOperationList.NextLink) + }, + } +} + +// listCreateRequest creates the List request. +func (client *OperationsClient) listCreateRequest(ctx context.Context, options *OperationsListOptions) (*policy.Request, error) { + urlPath := "/providers/Microsoft.CustomProviders/operations" + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2018-09-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// listHandleResponse handles the List response. +func (client *OperationsClient) listHandleResponse(resp *http.Response) (OperationsListResponse, error) { + result := OperationsListResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.ResourceProviderOperationList); err != nil { + return OperationsListResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// listHandleError handles the List error response. +func (client *OperationsClient) listHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := ErrorResponse{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} diff --git a/sdk/resourcemanager/customproviders/armcustomproviders/zz_generated_pagers.go b/sdk/resourcemanager/customproviders/armcustomproviders/zz_generated_pagers.go new file mode 100644 index 000000000000..2fcc9443072e --- /dev/null +++ b/sdk/resourcemanager/customproviders/armcustomproviders/zz_generated_pagers.go @@ -0,0 +1,233 @@ +//go:build go1.16 +// +build go1.16 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armcustomproviders + +import ( + "context" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "reflect" +) + +// AssociationsListAllPager provides operations for iterating over paged responses. +type AssociationsListAllPager struct { + client *AssociationsClient + current AssociationsListAllResponse + err error + requester func(context.Context) (*policy.Request, error) + advancer func(context.Context, AssociationsListAllResponse) (*policy.Request, error) +} + +// Err returns the last error encountered while paging. +func (p *AssociationsListAllPager) Err() error { + return p.err +} + +// NextPage returns true if the pager advanced to the next page. +// Returns false if there are no more pages or an error occurred. +func (p *AssociationsListAllPager) NextPage(ctx context.Context) bool { + var req *policy.Request + var err error + if !reflect.ValueOf(p.current).IsZero() { + if p.current.AssociationsList.NextLink == nil || len(*p.current.AssociationsList.NextLink) == 0 { + return false + } + req, err = p.advancer(ctx, p.current) + } else { + req, err = p.requester(ctx) + } + if err != nil { + p.err = err + return false + } + resp, err := p.client.pl.Do(req) + if err != nil { + p.err = err + return false + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + p.err = p.client.listAllHandleError(resp) + return false + } + result, err := p.client.listAllHandleResponse(resp) + if err != nil { + p.err = err + return false + } + p.current = result + return true +} + +// PageResponse returns the current AssociationsListAllResponse page. +func (p *AssociationsListAllPager) PageResponse() AssociationsListAllResponse { + return p.current +} + +// CustomResourceProviderListByResourceGroupPager provides operations for iterating over paged responses. +type CustomResourceProviderListByResourceGroupPager struct { + client *CustomResourceProviderClient + current CustomResourceProviderListByResourceGroupResponse + err error + requester func(context.Context) (*policy.Request, error) + advancer func(context.Context, CustomResourceProviderListByResourceGroupResponse) (*policy.Request, error) +} + +// Err returns the last error encountered while paging. +func (p *CustomResourceProviderListByResourceGroupPager) Err() error { + return p.err +} + +// NextPage returns true if the pager advanced to the next page. +// Returns false if there are no more pages or an error occurred. +func (p *CustomResourceProviderListByResourceGroupPager) NextPage(ctx context.Context) bool { + var req *policy.Request + var err error + if !reflect.ValueOf(p.current).IsZero() { + if p.current.ListByCustomRPManifest.NextLink == nil || len(*p.current.ListByCustomRPManifest.NextLink) == 0 { + return false + } + req, err = p.advancer(ctx, p.current) + } else { + req, err = p.requester(ctx) + } + if err != nil { + p.err = err + return false + } + resp, err := p.client.pl.Do(req) + if err != nil { + p.err = err + return false + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + p.err = p.client.listByResourceGroupHandleError(resp) + return false + } + result, err := p.client.listByResourceGroupHandleResponse(resp) + if err != nil { + p.err = err + return false + } + p.current = result + return true +} + +// PageResponse returns the current CustomResourceProviderListByResourceGroupResponse page. +func (p *CustomResourceProviderListByResourceGroupPager) PageResponse() CustomResourceProviderListByResourceGroupResponse { + return p.current +} + +// CustomResourceProviderListBySubscriptionPager provides operations for iterating over paged responses. +type CustomResourceProviderListBySubscriptionPager struct { + client *CustomResourceProviderClient + current CustomResourceProviderListBySubscriptionResponse + err error + requester func(context.Context) (*policy.Request, error) + advancer func(context.Context, CustomResourceProviderListBySubscriptionResponse) (*policy.Request, error) +} + +// Err returns the last error encountered while paging. +func (p *CustomResourceProviderListBySubscriptionPager) Err() error { + return p.err +} + +// NextPage returns true if the pager advanced to the next page. +// Returns false if there are no more pages or an error occurred. +func (p *CustomResourceProviderListBySubscriptionPager) NextPage(ctx context.Context) bool { + var req *policy.Request + var err error + if !reflect.ValueOf(p.current).IsZero() { + if p.current.ListByCustomRPManifest.NextLink == nil || len(*p.current.ListByCustomRPManifest.NextLink) == 0 { + return false + } + req, err = p.advancer(ctx, p.current) + } else { + req, err = p.requester(ctx) + } + if err != nil { + p.err = err + return false + } + resp, err := p.client.pl.Do(req) + if err != nil { + p.err = err + return false + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + p.err = p.client.listBySubscriptionHandleError(resp) + return false + } + result, err := p.client.listBySubscriptionHandleResponse(resp) + if err != nil { + p.err = err + return false + } + p.current = result + return true +} + +// PageResponse returns the current CustomResourceProviderListBySubscriptionResponse page. +func (p *CustomResourceProviderListBySubscriptionPager) PageResponse() CustomResourceProviderListBySubscriptionResponse { + return p.current +} + +// OperationsListPager provides operations for iterating over paged responses. +type OperationsListPager struct { + client *OperationsClient + current OperationsListResponse + err error + requester func(context.Context) (*policy.Request, error) + advancer func(context.Context, OperationsListResponse) (*policy.Request, error) +} + +// Err returns the last error encountered while paging. +func (p *OperationsListPager) Err() error { + return p.err +} + +// NextPage returns true if the pager advanced to the next page. +// Returns false if there are no more pages or an error occurred. +func (p *OperationsListPager) NextPage(ctx context.Context) bool { + var req *policy.Request + var err error + if !reflect.ValueOf(p.current).IsZero() { + if p.current.ResourceProviderOperationList.NextLink == nil || len(*p.current.ResourceProviderOperationList.NextLink) == 0 { + return false + } + req, err = p.advancer(ctx, p.current) + } else { + req, err = p.requester(ctx) + } + if err != nil { + p.err = err + return false + } + resp, err := p.client.pl.Do(req) + if err != nil { + p.err = err + return false + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + p.err = p.client.listHandleError(resp) + return false + } + result, err := p.client.listHandleResponse(resp) + if err != nil { + p.err = err + return false + } + p.current = result + return true +} + +// PageResponse returns the current OperationsListResponse page. +func (p *OperationsListPager) PageResponse() OperationsListResponse { + return p.current +} diff --git a/sdk/resourcemanager/customproviders/armcustomproviders/zz_generated_pollers.go b/sdk/resourcemanager/customproviders/armcustomproviders/zz_generated_pollers.go new file mode 100644 index 000000000000..9f7d39ffc497 --- /dev/null +++ b/sdk/resourcemanager/customproviders/armcustomproviders/zz_generated_pollers.go @@ -0,0 +1,187 @@ +//go:build go1.16 +// +build go1.16 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armcustomproviders + +import ( + "context" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "net/http" +) + +// AssociationsCreateOrUpdatePoller provides polling facilities until the operation reaches a terminal state. +type AssociationsCreateOrUpdatePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *AssociationsCreateOrUpdatePoller) Done() bool { + return p.pt.Done() +} + +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *AssociationsCreateOrUpdatePoller) Poll(ctx context.Context) (*http.Response, error) { + return p.pt.Poll(ctx) +} + +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final AssociationsCreateOrUpdateResponse will be returned. +func (p *AssociationsCreateOrUpdatePoller) FinalResponse(ctx context.Context) (AssociationsCreateOrUpdateResponse, error) { + respType := AssociationsCreateOrUpdateResponse{} + resp, err := p.pt.FinalResponse(ctx, &respType.Association) + if err != nil { + return AssociationsCreateOrUpdateResponse{}, err + } + respType.RawResponse = resp + return respType, nil +} + +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *AssociationsCreateOrUpdatePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// AssociationsDeletePoller provides polling facilities until the operation reaches a terminal state. +type AssociationsDeletePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *AssociationsDeletePoller) Done() bool { + return p.pt.Done() +} + +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *AssociationsDeletePoller) Poll(ctx context.Context) (*http.Response, error) { + return p.pt.Poll(ctx) +} + +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final AssociationsDeleteResponse will be returned. +func (p *AssociationsDeletePoller) FinalResponse(ctx context.Context) (AssociationsDeleteResponse, error) { + respType := AssociationsDeleteResponse{} + resp, err := p.pt.FinalResponse(ctx, nil) + if err != nil { + return AssociationsDeleteResponse{}, err + } + respType.RawResponse = resp + return respType, nil +} + +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *AssociationsDeletePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// CustomResourceProviderCreateOrUpdatePoller provides polling facilities until the operation reaches a terminal state. +type CustomResourceProviderCreateOrUpdatePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *CustomResourceProviderCreateOrUpdatePoller) Done() bool { + return p.pt.Done() +} + +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *CustomResourceProviderCreateOrUpdatePoller) Poll(ctx context.Context) (*http.Response, error) { + return p.pt.Poll(ctx) +} + +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final CustomResourceProviderCreateOrUpdateResponse will be returned. +func (p *CustomResourceProviderCreateOrUpdatePoller) FinalResponse(ctx context.Context) (CustomResourceProviderCreateOrUpdateResponse, error) { + respType := CustomResourceProviderCreateOrUpdateResponse{} + resp, err := p.pt.FinalResponse(ctx, &respType.CustomRPManifest) + if err != nil { + return CustomResourceProviderCreateOrUpdateResponse{}, err + } + respType.RawResponse = resp + return respType, nil +} + +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *CustomResourceProviderCreateOrUpdatePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// CustomResourceProviderDeletePoller provides polling facilities until the operation reaches a terminal state. +type CustomResourceProviderDeletePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *CustomResourceProviderDeletePoller) Done() bool { + return p.pt.Done() +} + +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *CustomResourceProviderDeletePoller) Poll(ctx context.Context) (*http.Response, error) { + return p.pt.Poll(ctx) +} + +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final CustomResourceProviderDeleteResponse will be returned. +func (p *CustomResourceProviderDeletePoller) FinalResponse(ctx context.Context) (CustomResourceProviderDeleteResponse, error) { + respType := CustomResourceProviderDeleteResponse{} + resp, err := p.pt.FinalResponse(ctx, nil) + if err != nil { + return CustomResourceProviderDeleteResponse{}, err + } + respType.RawResponse = resp + return respType, nil +} + +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *CustomResourceProviderDeletePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} diff --git a/sdk/resourcemanager/customproviders/armcustomproviders/zz_generated_response_types.go b/sdk/resourcemanager/customproviders/armcustomproviders/zz_generated_response_types.go new file mode 100644 index 000000000000..d2e8dd7d6481 --- /dev/null +++ b/sdk/resourcemanager/customproviders/armcustomproviders/zz_generated_response_types.go @@ -0,0 +1,296 @@ +//go:build go1.16 +// +build go1.16 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armcustomproviders + +import ( + "context" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "net/http" + "time" +) + +// AssociationsCreateOrUpdatePollerResponse contains the response from method Associations.CreateOrUpdate. +type AssociationsCreateOrUpdatePollerResponse struct { + // Poller contains an initialized poller. + Poller *AssociationsCreateOrUpdatePoller + + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. +func (l AssociationsCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (AssociationsCreateOrUpdateResponse, error) { + respType := AssociationsCreateOrUpdateResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.Association) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a AssociationsCreateOrUpdatePollerResponse from the provided client and resume token. +func (l *AssociationsCreateOrUpdatePollerResponse) Resume(ctx context.Context, client *AssociationsClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("AssociationsClient.CreateOrUpdate", token, client.pl, client.createOrUpdateHandleError) + if err != nil { + return err + } + poller := &AssociationsCreateOrUpdatePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// AssociationsCreateOrUpdateResponse contains the response from method Associations.CreateOrUpdate. +type AssociationsCreateOrUpdateResponse struct { + AssociationsCreateOrUpdateResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// AssociationsCreateOrUpdateResult contains the result from method Associations.CreateOrUpdate. +type AssociationsCreateOrUpdateResult struct { + Association +} + +// AssociationsDeletePollerResponse contains the response from method Associations.Delete. +type AssociationsDeletePollerResponse struct { + // Poller contains an initialized poller. + Poller *AssociationsDeletePoller + + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. +func (l AssociationsDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (AssociationsDeleteResponse, error) { + respType := AssociationsDeleteResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a AssociationsDeletePollerResponse from the provided client and resume token. +func (l *AssociationsDeletePollerResponse) Resume(ctx context.Context, client *AssociationsClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("AssociationsClient.Delete", token, client.pl, client.deleteHandleError) + if err != nil { + return err + } + poller := &AssociationsDeletePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// AssociationsDeleteResponse contains the response from method Associations.Delete. +type AssociationsDeleteResponse struct { + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// AssociationsGetResponse contains the response from method Associations.Get. +type AssociationsGetResponse struct { + AssociationsGetResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// AssociationsGetResult contains the result from method Associations.Get. +type AssociationsGetResult struct { + Association +} + +// AssociationsListAllResponse contains the response from method Associations.ListAll. +type AssociationsListAllResponse struct { + AssociationsListAllResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// AssociationsListAllResult contains the result from method Associations.ListAll. +type AssociationsListAllResult struct { + AssociationsList +} + +// CustomResourceProviderCreateOrUpdatePollerResponse contains the response from method CustomResourceProvider.CreateOrUpdate. +type CustomResourceProviderCreateOrUpdatePollerResponse struct { + // Poller contains an initialized poller. + Poller *CustomResourceProviderCreateOrUpdatePoller + + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. +func (l CustomResourceProviderCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (CustomResourceProviderCreateOrUpdateResponse, error) { + respType := CustomResourceProviderCreateOrUpdateResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.CustomRPManifest) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a CustomResourceProviderCreateOrUpdatePollerResponse from the provided client and resume token. +func (l *CustomResourceProviderCreateOrUpdatePollerResponse) Resume(ctx context.Context, client *CustomResourceProviderClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("CustomResourceProviderClient.CreateOrUpdate", token, client.pl, client.createOrUpdateHandleError) + if err != nil { + return err + } + poller := &CustomResourceProviderCreateOrUpdatePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// CustomResourceProviderCreateOrUpdateResponse contains the response from method CustomResourceProvider.CreateOrUpdate. +type CustomResourceProviderCreateOrUpdateResponse struct { + CustomResourceProviderCreateOrUpdateResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// CustomResourceProviderCreateOrUpdateResult contains the result from method CustomResourceProvider.CreateOrUpdate. +type CustomResourceProviderCreateOrUpdateResult struct { + CustomRPManifest +} + +// CustomResourceProviderDeletePollerResponse contains the response from method CustomResourceProvider.Delete. +type CustomResourceProviderDeletePollerResponse struct { + // Poller contains an initialized poller. + Poller *CustomResourceProviderDeletePoller + + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. +func (l CustomResourceProviderDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (CustomResourceProviderDeleteResponse, error) { + respType := CustomResourceProviderDeleteResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a CustomResourceProviderDeletePollerResponse from the provided client and resume token. +func (l *CustomResourceProviderDeletePollerResponse) Resume(ctx context.Context, client *CustomResourceProviderClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("CustomResourceProviderClient.Delete", token, client.pl, client.deleteHandleError) + if err != nil { + return err + } + poller := &CustomResourceProviderDeletePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// CustomResourceProviderDeleteResponse contains the response from method CustomResourceProvider.Delete. +type CustomResourceProviderDeleteResponse struct { + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// CustomResourceProviderGetResponse contains the response from method CustomResourceProvider.Get. +type CustomResourceProviderGetResponse struct { + CustomResourceProviderGetResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// CustomResourceProviderGetResult contains the result from method CustomResourceProvider.Get. +type CustomResourceProviderGetResult struct { + CustomRPManifest +} + +// CustomResourceProviderListByResourceGroupResponse contains the response from method CustomResourceProvider.ListByResourceGroup. +type CustomResourceProviderListByResourceGroupResponse struct { + CustomResourceProviderListByResourceGroupResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// CustomResourceProviderListByResourceGroupResult contains the result from method CustomResourceProvider.ListByResourceGroup. +type CustomResourceProviderListByResourceGroupResult struct { + ListByCustomRPManifest +} + +// CustomResourceProviderListBySubscriptionResponse contains the response from method CustomResourceProvider.ListBySubscription. +type CustomResourceProviderListBySubscriptionResponse struct { + CustomResourceProviderListBySubscriptionResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// CustomResourceProviderListBySubscriptionResult contains the result from method CustomResourceProvider.ListBySubscription. +type CustomResourceProviderListBySubscriptionResult struct { + ListByCustomRPManifest +} + +// CustomResourceProviderUpdateResponse contains the response from method CustomResourceProvider.Update. +type CustomResourceProviderUpdateResponse struct { + CustomResourceProviderUpdateResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// CustomResourceProviderUpdateResult contains the result from method CustomResourceProvider.Update. +type CustomResourceProviderUpdateResult struct { + CustomRPManifest +} + +// OperationsListResponse contains the response from method Operations.List. +type OperationsListResponse struct { + OperationsListResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// OperationsListResult contains the result from method Operations.List. +type OperationsListResult struct { + ResourceProviderOperationList +}