From afecd1ffc14d3b9fd63e83c51f377c97ff7b51c5 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Fri, 10 Dec 2021 03:01:18 +0000 Subject: [PATCH] CodeGen from PR 16971 in Azure/azure-rest-api-specs Track2 modify readme.go.md 7 (#16971) --- .../netapp/armnetapp/CHANGELOG.md | 5 + .../netapp/armnetapp/LICENSE.txt | 21 + .../netapp/armnetapp/README.md | 75 + .../netapp/armnetapp/autorest.md | 13 + sdk/resourcemanager/netapp/armnetapp/build.go | 7 + sdk/resourcemanager/netapp/armnetapp/ci.yml | 27 + sdk/resourcemanager/netapp/armnetapp/go.mod | 8 + sdk/resourcemanager/netapp/armnetapp/go.sum | 37 + .../netapp/armnetapp/go_mod_tidy_hack.go | 13 + .../zz_generated_accountbackups_client.go | 252 ++ .../armnetapp/zz_generated_accounts_client.go | 442 +++ .../zz_generated_backuppolicies_client.go | 410 +++ .../armnetapp/zz_generated_backups_client.go | 597 ++++ .../armnetapp/zz_generated_constants.go | 483 ++++ .../netapp/armnetapp/zz_generated_models.go | 2417 +++++++++++++++++ .../zz_generated_netappresource_client.go | 222 ++ ...erated_netappresourcequotalimits_client.go | 166 ++ .../zz_generated_operations_client.go | 91 + .../netapp/armnetapp/zz_generated_pagers.go | 233 ++ .../netapp/armnetapp/zz_generated_pollers.go | 1305 +++++++++ .../armnetapp/zz_generated_pools_client.go | 407 +++ .../armnetapp/zz_generated_response_types.go | 1852 +++++++++++++ .../zz_generated_snapshotpolicies_client.go | 467 ++++ .../zz_generated_snapshots_client.go | 450 +++ .../armnetapp/zz_generated_time_rfc3339.go | 85 + .../armnetapp/zz_generated_vaults_client.go | 106 + .../zz_generated_volumegroups_client.go | 331 +++ .../armnetapp/zz_generated_volumes_client.go | 1080 ++++++++ 28 files changed, 11602 insertions(+) create mode 100644 sdk/resourcemanager/netapp/armnetapp/CHANGELOG.md create mode 100644 sdk/resourcemanager/netapp/armnetapp/LICENSE.txt create mode 100644 sdk/resourcemanager/netapp/armnetapp/README.md create mode 100644 sdk/resourcemanager/netapp/armnetapp/autorest.md create mode 100644 sdk/resourcemanager/netapp/armnetapp/build.go create mode 100644 sdk/resourcemanager/netapp/armnetapp/ci.yml create mode 100644 sdk/resourcemanager/netapp/armnetapp/go.mod create mode 100644 sdk/resourcemanager/netapp/armnetapp/go.sum create mode 100644 sdk/resourcemanager/netapp/armnetapp/go_mod_tidy_hack.go create mode 100644 sdk/resourcemanager/netapp/armnetapp/zz_generated_accountbackups_client.go create mode 100644 sdk/resourcemanager/netapp/armnetapp/zz_generated_accounts_client.go create mode 100644 sdk/resourcemanager/netapp/armnetapp/zz_generated_backuppolicies_client.go create mode 100644 sdk/resourcemanager/netapp/armnetapp/zz_generated_backups_client.go create mode 100644 sdk/resourcemanager/netapp/armnetapp/zz_generated_constants.go create mode 100644 sdk/resourcemanager/netapp/armnetapp/zz_generated_models.go create mode 100644 sdk/resourcemanager/netapp/armnetapp/zz_generated_netappresource_client.go create mode 100644 sdk/resourcemanager/netapp/armnetapp/zz_generated_netappresourcequotalimits_client.go create mode 100644 sdk/resourcemanager/netapp/armnetapp/zz_generated_operations_client.go create mode 100644 sdk/resourcemanager/netapp/armnetapp/zz_generated_pagers.go create mode 100644 sdk/resourcemanager/netapp/armnetapp/zz_generated_pollers.go create mode 100644 sdk/resourcemanager/netapp/armnetapp/zz_generated_pools_client.go create mode 100644 sdk/resourcemanager/netapp/armnetapp/zz_generated_response_types.go create mode 100644 sdk/resourcemanager/netapp/armnetapp/zz_generated_snapshotpolicies_client.go create mode 100644 sdk/resourcemanager/netapp/armnetapp/zz_generated_snapshots_client.go create mode 100644 sdk/resourcemanager/netapp/armnetapp/zz_generated_time_rfc3339.go create mode 100644 sdk/resourcemanager/netapp/armnetapp/zz_generated_vaults_client.go create mode 100644 sdk/resourcemanager/netapp/armnetapp/zz_generated_volumegroups_client.go create mode 100644 sdk/resourcemanager/netapp/armnetapp/zz_generated_volumes_client.go diff --git a/sdk/resourcemanager/netapp/armnetapp/CHANGELOG.md b/sdk/resourcemanager/netapp/armnetapp/CHANGELOG.md new file mode 100644 index 000000000000..17b9dceace74 --- /dev/null +++ b/sdk/resourcemanager/netapp/armnetapp/CHANGELOG.md @@ -0,0 +1,5 @@ +# Release History + +## 0.1.0 (2021-12-10) + +- Init release. \ No newline at end of file diff --git a/sdk/resourcemanager/netapp/armnetapp/LICENSE.txt b/sdk/resourcemanager/netapp/armnetapp/LICENSE.txt new file mode 100644 index 000000000000..dc0c2ffb3dc1 --- /dev/null +++ b/sdk/resourcemanager/netapp/armnetapp/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/netapp/armnetapp/README.md b/sdk/resourcemanager/netapp/armnetapp/README.md new file mode 100644 index 000000000000..ddca7409886c --- /dev/null +++ b/sdk/resourcemanager/netapp/armnetapp/README.md @@ -0,0 +1,75 @@ +# Azure Netapp Module for Go + +[![PkgGoDev](https://pkg.go.dev/badge/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/netapp/armnetapp)](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/netapp/armnetapp) + +The `armnetapp` module provides operations for working with Azure Netapp. + +[Source code](https://github.com/Azure/azure-sdk-for-go/tree/main/sdk/resourcemanager/netapp/armnetapp) + +# Getting started + +## Prerequisites + +- an [Azure subscription](https://azure.microsoft.com/free/) +- Go 1.13 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 Netapp module: + +```sh +go get github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/netapp/armnetapp +``` + +## Authorization + +When creating a client, you will need to provide a credential for authenticating with Azure Netapp. 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 Netapp 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 := armnetapp.NewBackupsClient(, 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 := armnetapp.NewBackupsClient(, 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 `Netapp` 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/netapp/armnetapp/autorest.md b/sdk/resourcemanager/netapp/armnetapp/autorest.md new file mode 100644 index 000000000000..ebcd5d8d00fa --- /dev/null +++ b/sdk/resourcemanager/netapp/armnetapp/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/netapp/resource-manager/readme.md +- /home/vsts/work/1/s/azure-rest-api-specs/specification/netapp/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/netapp/armnetapp/build.go b/sdk/resourcemanager/netapp/armnetapp/build.go new file mode 100644 index 000000000000..d44aaf02ae9e --- /dev/null +++ b/sdk/resourcemanager/netapp/armnetapp/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/netapp/armnetapp + +package armnetapp diff --git a/sdk/resourcemanager/netapp/armnetapp/ci.yml b/sdk/resourcemanager/netapp/armnetapp/ci.yml new file mode 100644 index 000000000000..93f3f51f8374 --- /dev/null +++ b/sdk/resourcemanager/netapp/armnetapp/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/netapp/armnetapp/ + +pr: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/resourcemanager/netapp/armnetapp/ + +stages: +- template: /eng/pipelines/templates/jobs/archetype-sdk-client.yml + parameters: + ServiceDirectory: 'resourcemanager/netapp/armnetapp' diff --git a/sdk/resourcemanager/netapp/armnetapp/go.mod b/sdk/resourcemanager/netapp/armnetapp/go.mod new file mode 100644 index 000000000000..e6755a0c2dfe --- /dev/null +++ b/sdk/resourcemanager/netapp/armnetapp/go.mod @@ -0,0 +1,8 @@ +module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/netapp/armnetapp + +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/netapp/armnetapp/go.sum b/sdk/resourcemanager/netapp/armnetapp/go.sum new file mode 100644 index 000000000000..960c6c966a3f --- /dev/null +++ b/sdk/resourcemanager/netapp/armnetapp/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/netapp/armnetapp/go_mod_tidy_hack.go b/sdk/resourcemanager/netapp/armnetapp/go_mod_tidy_hack.go new file mode 100644 index 000000000000..22a15d3113f4 --- /dev/null +++ b/sdk/resourcemanager/netapp/armnetapp/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 armnetapp + +// 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/netapp/armnetapp/zz_generated_accountbackups_client.go b/sdk/resourcemanager/netapp/armnetapp/zz_generated_accountbackups_client.go new file mode 100644 index 000000000000..54d929459faf --- /dev/null +++ b/sdk/resourcemanager/netapp/armnetapp/zz_generated_accountbackups_client.go @@ -0,0 +1,252 @@ +//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 armnetapp + +import ( + "context" + "errors" + "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" +) + +// AccountBackupsClient contains the methods for the AccountBackups group. +// Don't use this type directly, use NewAccountBackupsClient() instead. +type AccountBackupsClient struct { + ep string + pl runtime.Pipeline + subscriptionID string +} + +// NewAccountBackupsClient creates a new instance of AccountBackupsClient with the specified values. +func NewAccountBackupsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *AccountBackupsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &AccountBackupsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} +} + +// BeginDelete - Delete the specified Backup for a Netapp Account +// If the operation fails it returns a generic error. +func (client *AccountBackupsClient) BeginDelete(ctx context.Context, resourceGroupName string, accountName string, backupName string, options *AccountBackupsBeginDeleteOptions) (AccountBackupsDeletePollerResponse, error) { + resp, err := client.deleteOperation(ctx, resourceGroupName, accountName, backupName, options) + if err != nil { + return AccountBackupsDeletePollerResponse{}, err + } + result := AccountBackupsDeletePollerResponse{ + RawResponse: resp, + } + pt, err := armruntime.NewPoller("AccountBackupsClient.Delete", "location", resp, client.pl, client.deleteHandleError) + if err != nil { + return AccountBackupsDeletePollerResponse{}, err + } + result.Poller = &AccountBackupsDeletePoller{ + pt: pt, + } + return result, nil +} + +// Delete - Delete the specified Backup for a Netapp Account +// If the operation fails it returns a generic error. +func (client *AccountBackupsClient) deleteOperation(ctx context.Context, resourceGroupName string, accountName string, backupName string, options *AccountBackupsBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, accountName, backupName, 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 *AccountBackupsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, accountName string, backupName string, options *AccountBackupsBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/accountBackups/{backupName}" + 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 accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if backupName == "" { + return nil, errors.New("parameter backupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{backupName}", url.PathEscape(backupName)) + 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", "2021-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + return req, nil +} + +// deleteHandleError handles the Delete error response. +func (client *AccountBackupsClient) deleteHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + if len(body) == 0 { + return runtime.NewResponseError(errors.New(resp.Status), resp) + } + return runtime.NewResponseError(errors.New(string(body)), resp) +} + +// Get - Gets the specified backup for a Netapp Account +// If the operation fails it returns a generic error. +func (client *AccountBackupsClient) Get(ctx context.Context, resourceGroupName string, accountName string, backupName string, options *AccountBackupsGetOptions) (AccountBackupsGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, accountName, backupName, options) + if err != nil { + return AccountBackupsGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return AccountBackupsGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return AccountBackupsGetResponse{}, client.getHandleError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *AccountBackupsClient) getCreateRequest(ctx context.Context, resourceGroupName string, accountName string, backupName string, options *AccountBackupsGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/accountBackups/{backupName}" + 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 accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if backupName == "" { + return nil, errors.New("parameter backupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{backupName}", url.PathEscape(backupName)) + 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", "2021-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *AccountBackupsClient) getHandleResponse(resp *http.Response) (AccountBackupsGetResponse, error) { + result := AccountBackupsGetResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.Backup); err != nil { + return AccountBackupsGetResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// getHandleError handles the Get error response. +func (client *AccountBackupsClient) getHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + if len(body) == 0 { + return runtime.NewResponseError(errors.New(resp.Status), resp) + } + return runtime.NewResponseError(errors.New(string(body)), resp) +} + +// List - List all Backups for a Netapp Account +// If the operation fails it returns a generic error. +func (client *AccountBackupsClient) List(ctx context.Context, resourceGroupName string, accountName string, options *AccountBackupsListOptions) (AccountBackupsListResponse, error) { + req, err := client.listCreateRequest(ctx, resourceGroupName, accountName, options) + if err != nil { + return AccountBackupsListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return AccountBackupsListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return AccountBackupsListResponse{}, client.listHandleError(resp) + } + return client.listHandleResponse(resp) +} + +// listCreateRequest creates the List request. +func (client *AccountBackupsClient) listCreateRequest(ctx context.Context, resourceGroupName string, accountName string, options *AccountBackupsListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/accountBackups" + 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 accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + 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", "2021-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// listHandleResponse handles the List response. +func (client *AccountBackupsClient) listHandleResponse(resp *http.Response) (AccountBackupsListResponse, error) { + result := AccountBackupsListResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.BackupsList); err != nil { + return AccountBackupsListResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// listHandleError handles the List error response. +func (client *AccountBackupsClient) listHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + if len(body) == 0 { + return runtime.NewResponseError(errors.New(resp.Status), resp) + } + return runtime.NewResponseError(errors.New(string(body)), resp) +} diff --git a/sdk/resourcemanager/netapp/armnetapp/zz_generated_accounts_client.go b/sdk/resourcemanager/netapp/armnetapp/zz_generated_accounts_client.go new file mode 100644 index 000000000000..f45ce9c4c889 --- /dev/null +++ b/sdk/resourcemanager/netapp/armnetapp/zz_generated_accounts_client.go @@ -0,0 +1,442 @@ +//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 armnetapp + +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" +) + +// AccountsClient contains the methods for the Accounts group. +// Don't use this type directly, use NewAccountsClient() instead. +type AccountsClient struct { + ep string + pl runtime.Pipeline + subscriptionID string +} + +// NewAccountsClient creates a new instance of AccountsClient with the specified values. +func NewAccountsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *AccountsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &AccountsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} +} + +// BeginCreateOrUpdate - Create or update the specified NetApp account within the resource group +// If the operation fails it returns a generic error. +func (client *AccountsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, accountName string, body NetAppAccount, options *AccountsBeginCreateOrUpdateOptions) (AccountsCreateOrUpdatePollerResponse, error) { + resp, err := client.createOrUpdate(ctx, resourceGroupName, accountName, body, options) + if err != nil { + return AccountsCreateOrUpdatePollerResponse{}, err + } + result := AccountsCreateOrUpdatePollerResponse{ + RawResponse: resp, + } + pt, err := armruntime.NewPoller("AccountsClient.CreateOrUpdate", "azure-async-operation", resp, client.pl, client.createOrUpdateHandleError) + if err != nil { + return AccountsCreateOrUpdatePollerResponse{}, err + } + result.Poller = &AccountsCreateOrUpdatePoller{ + pt: pt, + } + return result, nil +} + +// CreateOrUpdate - Create or update the specified NetApp account within the resource group +// If the operation fails it returns a generic error. +func (client *AccountsClient) createOrUpdate(ctx context.Context, resourceGroupName string, accountName string, body NetAppAccount, options *AccountsBeginCreateOrUpdateOptions) (*http.Response, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, accountName, body, 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 *AccountsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, accountName string, body NetAppAccount, options *AccountsBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}" + 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 accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + 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", "2021-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, runtime.MarshalAsJSON(req, body) +} + +// createOrUpdateHandleError handles the CreateOrUpdate error response. +func (client *AccountsClient) createOrUpdateHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + if len(body) == 0 { + return runtime.NewResponseError(errors.New(resp.Status), resp) + } + return runtime.NewResponseError(errors.New(string(body)), resp) +} + +// BeginDelete - Delete the specified NetApp account +// If the operation fails it returns a generic error. +func (client *AccountsClient) BeginDelete(ctx context.Context, resourceGroupName string, accountName string, options *AccountsBeginDeleteOptions) (AccountsDeletePollerResponse, error) { + resp, err := client.deleteOperation(ctx, resourceGroupName, accountName, options) + if err != nil { + return AccountsDeletePollerResponse{}, err + } + result := AccountsDeletePollerResponse{ + RawResponse: resp, + } + pt, err := armruntime.NewPoller("AccountsClient.Delete", "location", resp, client.pl, client.deleteHandleError) + if err != nil { + return AccountsDeletePollerResponse{}, err + } + result.Poller = &AccountsDeletePoller{ + pt: pt, + } + return result, nil +} + +// Delete - Delete the specified NetApp account +// If the operation fails it returns a generic error. +func (client *AccountsClient) deleteOperation(ctx context.Context, resourceGroupName string, accountName string, options *AccountsBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, accountName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusAccepted, http.StatusNoContent) { + return nil, client.deleteHandleError(resp) + } + return resp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *AccountsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, accountName string, options *AccountsBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}" + 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 accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + 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", "2021-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + return req, nil +} + +// deleteHandleError handles the Delete error response. +func (client *AccountsClient) deleteHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + if len(body) == 0 { + return runtime.NewResponseError(errors.New(resp.Status), resp) + } + return runtime.NewResponseError(errors.New(string(body)), resp) +} + +// Get - Get the NetApp account +// If the operation fails it returns a generic error. +func (client *AccountsClient) Get(ctx context.Context, resourceGroupName string, accountName string, options *AccountsGetOptions) (AccountsGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, accountName, options) + if err != nil { + return AccountsGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return AccountsGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return AccountsGetResponse{}, client.getHandleError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *AccountsClient) getCreateRequest(ctx context.Context, resourceGroupName string, accountName string, options *AccountsGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}" + 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 accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + 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", "2021-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *AccountsClient) getHandleResponse(resp *http.Response) (AccountsGetResponse, error) { + result := AccountsGetResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.NetAppAccount); err != nil { + return AccountsGetResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// getHandleError handles the Get error response. +func (client *AccountsClient) getHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + if len(body) == 0 { + return runtime.NewResponseError(errors.New(resp.Status), resp) + } + return runtime.NewResponseError(errors.New(string(body)), resp) +} + +// List - List and describe all NetApp accounts in the resource group. +// If the operation fails it returns a generic error. +func (client *AccountsClient) List(resourceGroupName string, options *AccountsListOptions) *AccountsListPager { + return &AccountsListPager{ + client: client, + requester: func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, resourceGroupName, options) + }, + advancer: func(ctx context.Context, resp AccountsListResponse) (*policy.Request, error) { + return runtime.NewRequest(ctx, http.MethodGet, *resp.NetAppAccountList.NextLink) + }, + } +} + +// listCreateRequest creates the List request. +func (client *AccountsClient) listCreateRequest(ctx context.Context, resourceGroupName string, options *AccountsListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts" + 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", "2021-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// listHandleResponse handles the List response. +func (client *AccountsClient) listHandleResponse(resp *http.Response) (AccountsListResponse, error) { + result := AccountsListResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.NetAppAccountList); err != nil { + return AccountsListResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// listHandleError handles the List error response. +func (client *AccountsClient) listHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + if len(body) == 0 { + return runtime.NewResponseError(errors.New(resp.Status), resp) + } + return runtime.NewResponseError(errors.New(string(body)), resp) +} + +// ListBySubscription - List and describe all NetApp accounts in the subscription. +// If the operation fails it returns a generic error. +func (client *AccountsClient) ListBySubscription(options *AccountsListBySubscriptionOptions) *AccountsListBySubscriptionPager { + return &AccountsListBySubscriptionPager{ + client: client, + requester: func(ctx context.Context) (*policy.Request, error) { + return client.listBySubscriptionCreateRequest(ctx, options) + }, + advancer: func(ctx context.Context, resp AccountsListBySubscriptionResponse) (*policy.Request, error) { + return runtime.NewRequest(ctx, http.MethodGet, *resp.NetAppAccountList.NextLink) + }, + } +} + +// listBySubscriptionCreateRequest creates the ListBySubscription request. +func (client *AccountsClient) listBySubscriptionCreateRequest(ctx context.Context, options *AccountsListBySubscriptionOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.NetApp/netAppAccounts" + 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", "2021-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// listBySubscriptionHandleResponse handles the ListBySubscription response. +func (client *AccountsClient) listBySubscriptionHandleResponse(resp *http.Response) (AccountsListBySubscriptionResponse, error) { + result := AccountsListBySubscriptionResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.NetAppAccountList); err != nil { + return AccountsListBySubscriptionResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// listBySubscriptionHandleError handles the ListBySubscription error response. +func (client *AccountsClient) listBySubscriptionHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + if len(body) == 0 { + return runtime.NewResponseError(errors.New(resp.Status), resp) + } + return runtime.NewResponseError(errors.New(string(body)), resp) +} + +// BeginUpdate - Patch the specified NetApp account +// If the operation fails it returns the *CloudError error type. +func (client *AccountsClient) BeginUpdate(ctx context.Context, resourceGroupName string, accountName string, body NetAppAccountPatch, options *AccountsBeginUpdateOptions) (AccountsUpdatePollerResponse, error) { + resp, err := client.update(ctx, resourceGroupName, accountName, body, options) + if err != nil { + return AccountsUpdatePollerResponse{}, err + } + result := AccountsUpdatePollerResponse{ + RawResponse: resp, + } + pt, err := armruntime.NewPoller("AccountsClient.Update", "location", resp, client.pl, client.updateHandleError) + if err != nil { + return AccountsUpdatePollerResponse{}, err + } + result.Poller = &AccountsUpdatePoller{ + pt: pt, + } + return result, nil +} + +// Update - Patch the specified NetApp account +// If the operation fails it returns the *CloudError error type. +func (client *AccountsClient) update(ctx context.Context, resourceGroupName string, accountName string, body NetAppAccountPatch, options *AccountsBeginUpdateOptions) (*http.Response, error) { + req, err := client.updateCreateRequest(ctx, resourceGroupName, accountName, body, 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) { + return nil, client.updateHandleError(resp) + } + return resp, nil +} + +// updateCreateRequest creates the Update request. +func (client *AccountsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, accountName string, body NetAppAccountPatch, options *AccountsBeginUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}" + 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 accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + 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", "2021-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, runtime.MarshalAsJSON(req, body) +} + +// updateHandleError handles the Update error response. +func (client *AccountsClient) updateHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := CloudError{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/netapp/armnetapp/zz_generated_backuppolicies_client.go b/sdk/resourcemanager/netapp/armnetapp/zz_generated_backuppolicies_client.go new file mode 100644 index 000000000000..971bd4722059 --- /dev/null +++ b/sdk/resourcemanager/netapp/armnetapp/zz_generated_backuppolicies_client.go @@ -0,0 +1,410 @@ +//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 armnetapp + +import ( + "context" + "errors" + "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" +) + +// BackupPoliciesClient contains the methods for the BackupPolicies group. +// Don't use this type directly, use NewBackupPoliciesClient() instead. +type BackupPoliciesClient struct { + ep string + pl runtime.Pipeline + subscriptionID string +} + +// NewBackupPoliciesClient creates a new instance of BackupPoliciesClient with the specified values. +func NewBackupPoliciesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *BackupPoliciesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &BackupPoliciesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} +} + +// BeginCreate - Create a backup policy for Netapp Account +// If the operation fails it returns a generic error. +func (client *BackupPoliciesClient) BeginCreate(ctx context.Context, resourceGroupName string, accountName string, backupPolicyName string, body BackupPolicy, options *BackupPoliciesBeginCreateOptions) (BackupPoliciesCreatePollerResponse, error) { + resp, err := client.create(ctx, resourceGroupName, accountName, backupPolicyName, body, options) + if err != nil { + return BackupPoliciesCreatePollerResponse{}, err + } + result := BackupPoliciesCreatePollerResponse{ + RawResponse: resp, + } + pt, err := armruntime.NewPoller("BackupPoliciesClient.Create", "azure-async-operation", resp, client.pl, client.createHandleError) + if err != nil { + return BackupPoliciesCreatePollerResponse{}, err + } + result.Poller = &BackupPoliciesCreatePoller{ + pt: pt, + } + return result, nil +} + +// Create - Create a backup policy for Netapp Account +// If the operation fails it returns a generic error. +func (client *BackupPoliciesClient) create(ctx context.Context, resourceGroupName string, accountName string, backupPolicyName string, body BackupPolicy, options *BackupPoliciesBeginCreateOptions) (*http.Response, error) { + req, err := client.createCreateRequest(ctx, resourceGroupName, accountName, backupPolicyName, body, 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, http.StatusAccepted) { + return nil, client.createHandleError(resp) + } + return resp, nil +} + +// createCreateRequest creates the Create request. +func (client *BackupPoliciesClient) createCreateRequest(ctx context.Context, resourceGroupName string, accountName string, backupPolicyName string, body BackupPolicy, options *BackupPoliciesBeginCreateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/backupPolicies/{backupPolicyName}" + 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 accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if backupPolicyName == "" { + return nil, errors.New("parameter backupPolicyName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{backupPolicyName}", url.PathEscape(backupPolicyName)) + 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", "2021-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, runtime.MarshalAsJSON(req, body) +} + +// createHandleError handles the Create error response. +func (client *BackupPoliciesClient) createHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + if len(body) == 0 { + return runtime.NewResponseError(errors.New(resp.Status), resp) + } + return runtime.NewResponseError(errors.New(string(body)), resp) +} + +// BeginDelete - Delete backup policy +// If the operation fails it returns a generic error. +func (client *BackupPoliciesClient) BeginDelete(ctx context.Context, resourceGroupName string, accountName string, backupPolicyName string, options *BackupPoliciesBeginDeleteOptions) (BackupPoliciesDeletePollerResponse, error) { + resp, err := client.deleteOperation(ctx, resourceGroupName, accountName, backupPolicyName, options) + if err != nil { + return BackupPoliciesDeletePollerResponse{}, err + } + result := BackupPoliciesDeletePollerResponse{ + RawResponse: resp, + } + pt, err := armruntime.NewPoller("BackupPoliciesClient.Delete", "location", resp, client.pl, client.deleteHandleError) + if err != nil { + return BackupPoliciesDeletePollerResponse{}, err + } + result.Poller = &BackupPoliciesDeletePoller{ + pt: pt, + } + return result, nil +} + +// Delete - Delete backup policy +// If the operation fails it returns a generic error. +func (client *BackupPoliciesClient) deleteOperation(ctx context.Context, resourceGroupName string, accountName string, backupPolicyName string, options *BackupPoliciesBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, accountName, backupPolicyName, 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 *BackupPoliciesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, accountName string, backupPolicyName string, options *BackupPoliciesBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/backupPolicies/{backupPolicyName}" + 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 accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if backupPolicyName == "" { + return nil, errors.New("parameter backupPolicyName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{backupPolicyName}", url.PathEscape(backupPolicyName)) + 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", "2021-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + return req, nil +} + +// deleteHandleError handles the Delete error response. +func (client *BackupPoliciesClient) deleteHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + if len(body) == 0 { + return runtime.NewResponseError(errors.New(resp.Status), resp) + } + return runtime.NewResponseError(errors.New(string(body)), resp) +} + +// Get - Get a particular backup Policy +// If the operation fails it returns a generic error. +func (client *BackupPoliciesClient) Get(ctx context.Context, resourceGroupName string, accountName string, backupPolicyName string, options *BackupPoliciesGetOptions) (BackupPoliciesGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, accountName, backupPolicyName, options) + if err != nil { + return BackupPoliciesGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return BackupPoliciesGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return BackupPoliciesGetResponse{}, client.getHandleError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *BackupPoliciesClient) getCreateRequest(ctx context.Context, resourceGroupName string, accountName string, backupPolicyName string, options *BackupPoliciesGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/backupPolicies/{backupPolicyName}" + 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 accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if backupPolicyName == "" { + return nil, errors.New("parameter backupPolicyName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{backupPolicyName}", url.PathEscape(backupPolicyName)) + 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", "2021-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *BackupPoliciesClient) getHandleResponse(resp *http.Response) (BackupPoliciesGetResponse, error) { + result := BackupPoliciesGetResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.BackupPolicy); err != nil { + return BackupPoliciesGetResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// getHandleError handles the Get error response. +func (client *BackupPoliciesClient) getHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + if len(body) == 0 { + return runtime.NewResponseError(errors.New(resp.Status), resp) + } + return runtime.NewResponseError(errors.New(string(body)), resp) +} + +// List - List backup policies for Netapp Account +// If the operation fails it returns a generic error. +func (client *BackupPoliciesClient) List(ctx context.Context, resourceGroupName string, accountName string, options *BackupPoliciesListOptions) (BackupPoliciesListResponse, error) { + req, err := client.listCreateRequest(ctx, resourceGroupName, accountName, options) + if err != nil { + return BackupPoliciesListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return BackupPoliciesListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return BackupPoliciesListResponse{}, client.listHandleError(resp) + } + return client.listHandleResponse(resp) +} + +// listCreateRequest creates the List request. +func (client *BackupPoliciesClient) listCreateRequest(ctx context.Context, resourceGroupName string, accountName string, options *BackupPoliciesListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/backupPolicies" + 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 accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + 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", "2021-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// listHandleResponse handles the List response. +func (client *BackupPoliciesClient) listHandleResponse(resp *http.Response) (BackupPoliciesListResponse, error) { + result := BackupPoliciesListResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.BackupPoliciesList); err != nil { + return BackupPoliciesListResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// listHandleError handles the List error response. +func (client *BackupPoliciesClient) listHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + if len(body) == 0 { + return runtime.NewResponseError(errors.New(resp.Status), resp) + } + return runtime.NewResponseError(errors.New(string(body)), resp) +} + +// BeginUpdate - Patch a backup policy for Netapp Account +// If the operation fails it returns a generic error. +func (client *BackupPoliciesClient) BeginUpdate(ctx context.Context, resourceGroupName string, accountName string, backupPolicyName string, body BackupPolicyPatch, options *BackupPoliciesBeginUpdateOptions) (BackupPoliciesUpdatePollerResponse, error) { + resp, err := client.update(ctx, resourceGroupName, accountName, backupPolicyName, body, options) + if err != nil { + return BackupPoliciesUpdatePollerResponse{}, err + } + result := BackupPoliciesUpdatePollerResponse{ + RawResponse: resp, + } + pt, err := armruntime.NewPoller("BackupPoliciesClient.Update", "azure-async-operation", resp, client.pl, client.updateHandleError) + if err != nil { + return BackupPoliciesUpdatePollerResponse{}, err + } + result.Poller = &BackupPoliciesUpdatePoller{ + pt: pt, + } + return result, nil +} + +// Update - Patch a backup policy for Netapp Account +// If the operation fails it returns a generic error. +func (client *BackupPoliciesClient) update(ctx context.Context, resourceGroupName string, accountName string, backupPolicyName string, body BackupPolicyPatch, options *BackupPoliciesBeginUpdateOptions) (*http.Response, error) { + req, err := client.updateCreateRequest(ctx, resourceGroupName, accountName, backupPolicyName, body, 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) { + return nil, client.updateHandleError(resp) + } + return resp, nil +} + +// updateCreateRequest creates the Update request. +func (client *BackupPoliciesClient) updateCreateRequest(ctx context.Context, resourceGroupName string, accountName string, backupPolicyName string, body BackupPolicyPatch, options *BackupPoliciesBeginUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/backupPolicies/{backupPolicyName}" + 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 accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if backupPolicyName == "" { + return nil, errors.New("parameter backupPolicyName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{backupPolicyName}", url.PathEscape(backupPolicyName)) + 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", "2021-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, runtime.MarshalAsJSON(req, body) +} + +// updateHandleError handles the Update error response. +func (client *BackupPoliciesClient) updateHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + if len(body) == 0 { + return runtime.NewResponseError(errors.New(resp.Status), resp) + } + return runtime.NewResponseError(errors.New(string(body)), resp) +} diff --git a/sdk/resourcemanager/netapp/armnetapp/zz_generated_backups_client.go b/sdk/resourcemanager/netapp/armnetapp/zz_generated_backups_client.go new file mode 100644 index 000000000000..bb8408bae715 --- /dev/null +++ b/sdk/resourcemanager/netapp/armnetapp/zz_generated_backups_client.go @@ -0,0 +1,597 @@ +//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 armnetapp + +import ( + "context" + "errors" + "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" +) + +// BackupsClient contains the methods for the Backups group. +// Don't use this type directly, use NewBackupsClient() instead. +type BackupsClient struct { + ep string + pl runtime.Pipeline + subscriptionID string +} + +// NewBackupsClient creates a new instance of BackupsClient with the specified values. +func NewBackupsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *BackupsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &BackupsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} +} + +// BeginCreate - Create a backup for the volume +// If the operation fails it returns a generic error. +func (client *BackupsClient) BeginCreate(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, backupName string, body Backup, options *BackupsBeginCreateOptions) (BackupsCreatePollerResponse, error) { + resp, err := client.create(ctx, resourceGroupName, accountName, poolName, volumeName, backupName, body, options) + if err != nil { + return BackupsCreatePollerResponse{}, err + } + result := BackupsCreatePollerResponse{ + RawResponse: resp, + } + pt, err := armruntime.NewPoller("BackupsClient.Create", "location", resp, client.pl, client.createHandleError) + if err != nil { + return BackupsCreatePollerResponse{}, err + } + result.Poller = &BackupsCreatePoller{ + pt: pt, + } + return result, nil +} + +// Create - Create a backup for the volume +// If the operation fails it returns a generic error. +func (client *BackupsClient) create(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, backupName string, body Backup, options *BackupsBeginCreateOptions) (*http.Response, error) { + req, err := client.createCreateRequest(ctx, resourceGroupName, accountName, poolName, volumeName, backupName, body, 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, http.StatusAccepted) { + return nil, client.createHandleError(resp) + } + return resp, nil +} + +// createCreateRequest creates the Create request. +func (client *BackupsClient) createCreateRequest(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, backupName string, body Backup, options *BackupsBeginCreateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/backups/{backupName}" + 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 accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if poolName == "" { + return nil, errors.New("parameter poolName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{poolName}", url.PathEscape(poolName)) + if volumeName == "" { + return nil, errors.New("parameter volumeName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{volumeName}", url.PathEscape(volumeName)) + if backupName == "" { + return nil, errors.New("parameter backupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{backupName}", url.PathEscape(backupName)) + 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", "2021-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, runtime.MarshalAsJSON(req, body) +} + +// createHandleError handles the Create error response. +func (client *BackupsClient) createHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + if len(body) == 0 { + return runtime.NewResponseError(errors.New(resp.Status), resp) + } + return runtime.NewResponseError(errors.New(string(body)), resp) +} + +// BeginDelete - Delete a backup of the volume +// If the operation fails it returns a generic error. +func (client *BackupsClient) BeginDelete(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, backupName string, options *BackupsBeginDeleteOptions) (BackupsDeletePollerResponse, error) { + resp, err := client.deleteOperation(ctx, resourceGroupName, accountName, poolName, volumeName, backupName, options) + if err != nil { + return BackupsDeletePollerResponse{}, err + } + result := BackupsDeletePollerResponse{ + RawResponse: resp, + } + pt, err := armruntime.NewPoller("BackupsClient.Delete", "location", resp, client.pl, client.deleteHandleError) + if err != nil { + return BackupsDeletePollerResponse{}, err + } + result.Poller = &BackupsDeletePoller{ + pt: pt, + } + return result, nil +} + +// Delete - Delete a backup of the volume +// If the operation fails it returns a generic error. +func (client *BackupsClient) deleteOperation(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, backupName string, options *BackupsBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, accountName, poolName, volumeName, backupName, 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 *BackupsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, backupName string, options *BackupsBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/backups/{backupName}" + 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 accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if poolName == "" { + return nil, errors.New("parameter poolName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{poolName}", url.PathEscape(poolName)) + if volumeName == "" { + return nil, errors.New("parameter volumeName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{volumeName}", url.PathEscape(volumeName)) + if backupName == "" { + return nil, errors.New("parameter backupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{backupName}", url.PathEscape(backupName)) + 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", "2021-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + return req, nil +} + +// deleteHandleError handles the Delete error response. +func (client *BackupsClient) deleteHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + if len(body) == 0 { + return runtime.NewResponseError(errors.New(resp.Status), resp) + } + return runtime.NewResponseError(errors.New(string(body)), resp) +} + +// Get - Gets the specified backup of the volume +// If the operation fails it returns a generic error. +func (client *BackupsClient) Get(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, backupName string, options *BackupsGetOptions) (BackupsGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, accountName, poolName, volumeName, backupName, options) + if err != nil { + return BackupsGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return BackupsGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return BackupsGetResponse{}, client.getHandleError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *BackupsClient) getCreateRequest(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, backupName string, options *BackupsGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/backups/{backupName}" + 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 accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if poolName == "" { + return nil, errors.New("parameter poolName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{poolName}", url.PathEscape(poolName)) + if volumeName == "" { + return nil, errors.New("parameter volumeName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{volumeName}", url.PathEscape(volumeName)) + if backupName == "" { + return nil, errors.New("parameter backupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{backupName}", url.PathEscape(backupName)) + 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", "2021-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *BackupsClient) getHandleResponse(resp *http.Response) (BackupsGetResponse, error) { + result := BackupsGetResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.Backup); err != nil { + return BackupsGetResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// getHandleError handles the Get error response. +func (client *BackupsClient) getHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + if len(body) == 0 { + return runtime.NewResponseError(errors.New(resp.Status), resp) + } + return runtime.NewResponseError(errors.New(string(body)), resp) +} + +// GetStatus - Get the status of the backup for a volume +// If the operation fails it returns a generic error. +func (client *BackupsClient) GetStatus(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, options *BackupsGetStatusOptions) (BackupsGetStatusResponse, error) { + req, err := client.getStatusCreateRequest(ctx, resourceGroupName, accountName, poolName, volumeName, options) + if err != nil { + return BackupsGetStatusResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return BackupsGetStatusResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return BackupsGetStatusResponse{}, client.getStatusHandleError(resp) + } + return client.getStatusHandleResponse(resp) +} + +// getStatusCreateRequest creates the GetStatus request. +func (client *BackupsClient) getStatusCreateRequest(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, options *BackupsGetStatusOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/backupStatus" + 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 accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if poolName == "" { + return nil, errors.New("parameter poolName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{poolName}", url.PathEscape(poolName)) + if volumeName == "" { + return nil, errors.New("parameter volumeName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{volumeName}", url.PathEscape(volumeName)) + 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", "2021-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// getStatusHandleResponse handles the GetStatus response. +func (client *BackupsClient) getStatusHandleResponse(resp *http.Response) (BackupsGetStatusResponse, error) { + result := BackupsGetStatusResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.BackupStatus); err != nil { + return BackupsGetStatusResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// getStatusHandleError handles the GetStatus error response. +func (client *BackupsClient) getStatusHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + if len(body) == 0 { + return runtime.NewResponseError(errors.New(resp.Status), resp) + } + return runtime.NewResponseError(errors.New(string(body)), resp) +} + +// GetVolumeRestoreStatus - Get the status of the restore for a volume +// If the operation fails it returns a generic error. +func (client *BackupsClient) GetVolumeRestoreStatus(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, options *BackupsGetVolumeRestoreStatusOptions) (BackupsGetVolumeRestoreStatusResponse, error) { + req, err := client.getVolumeRestoreStatusCreateRequest(ctx, resourceGroupName, accountName, poolName, volumeName, options) + if err != nil { + return BackupsGetVolumeRestoreStatusResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return BackupsGetVolumeRestoreStatusResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return BackupsGetVolumeRestoreStatusResponse{}, client.getVolumeRestoreStatusHandleError(resp) + } + return client.getVolumeRestoreStatusHandleResponse(resp) +} + +// getVolumeRestoreStatusCreateRequest creates the GetVolumeRestoreStatus request. +func (client *BackupsClient) getVolumeRestoreStatusCreateRequest(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, options *BackupsGetVolumeRestoreStatusOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/restoreStatus" + 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 accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if poolName == "" { + return nil, errors.New("parameter poolName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{poolName}", url.PathEscape(poolName)) + if volumeName == "" { + return nil, errors.New("parameter volumeName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{volumeName}", url.PathEscape(volumeName)) + 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", "2021-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// getVolumeRestoreStatusHandleResponse handles the GetVolumeRestoreStatus response. +func (client *BackupsClient) getVolumeRestoreStatusHandleResponse(resp *http.Response) (BackupsGetVolumeRestoreStatusResponse, error) { + result := BackupsGetVolumeRestoreStatusResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.RestoreStatus); err != nil { + return BackupsGetVolumeRestoreStatusResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// getVolumeRestoreStatusHandleError handles the GetVolumeRestoreStatus error response. +func (client *BackupsClient) getVolumeRestoreStatusHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + if len(body) == 0 { + return runtime.NewResponseError(errors.New(resp.Status), resp) + } + return runtime.NewResponseError(errors.New(string(body)), resp) +} + +// List - List all backups for a volume +// If the operation fails it returns a generic error. +func (client *BackupsClient) List(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, options *BackupsListOptions) (BackupsListResponse, error) { + req, err := client.listCreateRequest(ctx, resourceGroupName, accountName, poolName, volumeName, options) + if err != nil { + return BackupsListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return BackupsListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return BackupsListResponse{}, client.listHandleError(resp) + } + return client.listHandleResponse(resp) +} + +// listCreateRequest creates the List request. +func (client *BackupsClient) listCreateRequest(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, options *BackupsListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/backups" + 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 accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if poolName == "" { + return nil, errors.New("parameter poolName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{poolName}", url.PathEscape(poolName)) + if volumeName == "" { + return nil, errors.New("parameter volumeName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{volumeName}", url.PathEscape(volumeName)) + 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", "2021-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// listHandleResponse handles the List response. +func (client *BackupsClient) listHandleResponse(resp *http.Response) (BackupsListResponse, error) { + result := BackupsListResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.BackupsList); err != nil { + return BackupsListResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// listHandleError handles the List error response. +func (client *BackupsClient) listHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + if len(body) == 0 { + return runtime.NewResponseError(errors.New(resp.Status), resp) + } + return runtime.NewResponseError(errors.New(string(body)), resp) +} + +// BeginUpdate - Patch a backup for the volume +// If the operation fails it returns a generic error. +func (client *BackupsClient) BeginUpdate(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, backupName string, options *BackupsBeginUpdateOptions) (BackupsUpdatePollerResponse, error) { + resp, err := client.update(ctx, resourceGroupName, accountName, poolName, volumeName, backupName, options) + if err != nil { + return BackupsUpdatePollerResponse{}, err + } + result := BackupsUpdatePollerResponse{ + RawResponse: resp, + } + pt, err := armruntime.NewPoller("BackupsClient.Update", "location", resp, client.pl, client.updateHandleError) + if err != nil { + return BackupsUpdatePollerResponse{}, err + } + result.Poller = &BackupsUpdatePoller{ + pt: pt, + } + return result, nil +} + +// Update - Patch a backup for the volume +// If the operation fails it returns a generic error. +func (client *BackupsClient) update(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, backupName string, options *BackupsBeginUpdateOptions) (*http.Response, error) { + req, err := client.updateCreateRequest(ctx, resourceGroupName, accountName, poolName, volumeName, backupName, 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) { + return nil, client.updateHandleError(resp) + } + return resp, nil +} + +// updateCreateRequest creates the Update request. +func (client *BackupsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, backupName string, options *BackupsBeginUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/backups/{backupName}" + 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 accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if poolName == "" { + return nil, errors.New("parameter poolName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{poolName}", url.PathEscape(poolName)) + if volumeName == "" { + return nil, errors.New("parameter volumeName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{volumeName}", url.PathEscape(volumeName)) + if backupName == "" { + return nil, errors.New("parameter backupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{backupName}", url.PathEscape(backupName)) + 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", "2021-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + if options != nil && options.Body != nil { + return req, runtime.MarshalAsJSON(req, *options.Body) + } + return req, nil +} + +// updateHandleError handles the Update error response. +func (client *BackupsClient) updateHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + if len(body) == 0 { + return runtime.NewResponseError(errors.New(resp.Status), resp) + } + return runtime.NewResponseError(errors.New(string(body)), resp) +} diff --git a/sdk/resourcemanager/netapp/armnetapp/zz_generated_constants.go b/sdk/resourcemanager/netapp/armnetapp/zz_generated_constants.go new file mode 100644 index 000000000000..89d082b0c973 --- /dev/null +++ b/sdk/resourcemanager/netapp/armnetapp/zz_generated_constants.go @@ -0,0 +1,483 @@ +//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 armnetapp + +const ( + module = "armnetapp" + version = "v0.1.0" +) + +// ActiveDirectoryStatus - Status of the Active Directory +type ActiveDirectoryStatus string + +const ( + // ActiveDirectoryStatusCreated - Active Directory created but not in use + ActiveDirectoryStatusCreated ActiveDirectoryStatus = "Created" + // ActiveDirectoryStatusDeleted - Active Directory Deleted + ActiveDirectoryStatusDeleted ActiveDirectoryStatus = "Deleted" + // ActiveDirectoryStatusError - Error with the Active Directory + ActiveDirectoryStatusError ActiveDirectoryStatus = "Error" + // ActiveDirectoryStatusInUse - Active Directory in use by SMB Volume + ActiveDirectoryStatusInUse ActiveDirectoryStatus = "InUse" + // ActiveDirectoryStatusUpdating - Active Directory Updating + ActiveDirectoryStatusUpdating ActiveDirectoryStatus = "Updating" +) + +// PossibleActiveDirectoryStatusValues returns the possible values for the ActiveDirectoryStatus const type. +func PossibleActiveDirectoryStatusValues() []ActiveDirectoryStatus { + return []ActiveDirectoryStatus{ + ActiveDirectoryStatusCreated, + ActiveDirectoryStatusDeleted, + ActiveDirectoryStatusError, + ActiveDirectoryStatusInUse, + ActiveDirectoryStatusUpdating, + } +} + +// ToPtr returns a *ActiveDirectoryStatus pointing to the current value. +func (c ActiveDirectoryStatus) ToPtr() *ActiveDirectoryStatus { + return &c +} + +// ApplicationType - Application Type +type ApplicationType string + +const ( + ApplicationTypeSAPHANA ApplicationType = "SAP-HANA" +) + +// PossibleApplicationTypeValues returns the possible values for the ApplicationType const type. +func PossibleApplicationTypeValues() []ApplicationType { + return []ApplicationType{ + ApplicationTypeSAPHANA, + } +} + +// ToPtr returns a *ApplicationType pointing to the current value. +func (c ApplicationType) ToPtr() *ApplicationType { + return &c +} + +// AvsDataStore - Specifies whether the volume is enabled for Azure VMware Solution (AVS) datastore purpose +type AvsDataStore string + +const ( + // AvsDataStoreDisabled - avsDataStore is disabled + AvsDataStoreDisabled AvsDataStore = "Disabled" + // AvsDataStoreEnabled - avsDataStore is enabled + AvsDataStoreEnabled AvsDataStore = "Enabled" +) + +// PossibleAvsDataStoreValues returns the possible values for the AvsDataStore const type. +func PossibleAvsDataStoreValues() []AvsDataStore { + return []AvsDataStore{ + AvsDataStoreDisabled, + AvsDataStoreEnabled, + } +} + +// ToPtr returns a *AvsDataStore pointing to the current value. +func (c AvsDataStore) ToPtr() *AvsDataStore { + return &c +} + +// BackupType - Type of backup Manual or Scheduled +type BackupType string + +const ( + // BackupTypeManual - Manual backup + BackupTypeManual BackupType = "Manual" + // BackupTypeScheduled - Scheduled backup + BackupTypeScheduled BackupType = "Scheduled" +) + +// PossibleBackupTypeValues returns the possible values for the BackupType const type. +func PossibleBackupTypeValues() []BackupType { + return []BackupType{ + BackupTypeManual, + BackupTypeScheduled, + } +} + +// ToPtr returns a *BackupType pointing to the current value. +func (c BackupType) ToPtr() *BackupType { + return &c +} + +// CheckNameResourceTypes - Resource type used for verification. +type CheckNameResourceTypes string + +const ( + CheckNameResourceTypesMicrosoftNetAppNetAppAccounts CheckNameResourceTypes = "Microsoft.NetApp/netAppAccounts" + CheckNameResourceTypesMicrosoftNetAppNetAppAccountsCapacityPools CheckNameResourceTypes = "Microsoft.NetApp/netAppAccounts/capacityPools" + CheckNameResourceTypesMicrosoftNetAppNetAppAccountsCapacityPoolsVolumes CheckNameResourceTypes = "Microsoft.NetApp/netAppAccounts/capacityPools/volumes" + CheckNameResourceTypesMicrosoftNetAppNetAppAccountsCapacityPoolsVolumesSnapshots CheckNameResourceTypes = "Microsoft.NetApp/netAppAccounts/capacityPools/volumes/snapshots" +) + +// PossibleCheckNameResourceTypesValues returns the possible values for the CheckNameResourceTypes const type. +func PossibleCheckNameResourceTypesValues() []CheckNameResourceTypes { + return []CheckNameResourceTypes{ + CheckNameResourceTypesMicrosoftNetAppNetAppAccounts, + CheckNameResourceTypesMicrosoftNetAppNetAppAccountsCapacityPools, + CheckNameResourceTypesMicrosoftNetAppNetAppAccountsCapacityPoolsVolumes, + CheckNameResourceTypesMicrosoftNetAppNetAppAccountsCapacityPoolsVolumesSnapshots, + } +} + +// ToPtr returns a *CheckNameResourceTypes pointing to the current value. +func (c CheckNameResourceTypes) ToPtr() *CheckNameResourceTypes { + return &c +} + +// CheckQuotaNameResourceTypes - Resource type used for verification. +type CheckQuotaNameResourceTypes string + +const ( + CheckQuotaNameResourceTypesMicrosoftNetAppNetAppAccounts CheckQuotaNameResourceTypes = "Microsoft.NetApp/netAppAccounts" + CheckQuotaNameResourceTypesMicrosoftNetAppNetAppAccountsCapacityPools CheckQuotaNameResourceTypes = "Microsoft.NetApp/netAppAccounts/capacityPools" + CheckQuotaNameResourceTypesMicrosoftNetAppNetAppAccountsCapacityPoolsVolumes CheckQuotaNameResourceTypes = "Microsoft.NetApp/netAppAccounts/capacityPools/volumes" + CheckQuotaNameResourceTypesMicrosoftNetAppNetAppAccountsCapacityPoolsVolumesSnapshots CheckQuotaNameResourceTypes = "Microsoft.NetApp/netAppAccounts/capacityPools/volumes/snapshots" +) + +// PossibleCheckQuotaNameResourceTypesValues returns the possible values for the CheckQuotaNameResourceTypes const type. +func PossibleCheckQuotaNameResourceTypesValues() []CheckQuotaNameResourceTypes { + return []CheckQuotaNameResourceTypes{ + CheckQuotaNameResourceTypesMicrosoftNetAppNetAppAccounts, + CheckQuotaNameResourceTypesMicrosoftNetAppNetAppAccountsCapacityPools, + CheckQuotaNameResourceTypesMicrosoftNetAppNetAppAccountsCapacityPoolsVolumes, + CheckQuotaNameResourceTypesMicrosoftNetAppNetAppAccountsCapacityPoolsVolumesSnapshots, + } +} + +// ToPtr returns a *CheckQuotaNameResourceTypes pointing to the current value. +func (c CheckQuotaNameResourceTypes) ToPtr() *CheckQuotaNameResourceTypes { + return &c +} + +// ChownMode - This parameter specifies who is authorized to change the ownership of a file. restricted - Only root user can change the ownership of the +// file. unrestricted - Non-root users can change ownership of +// files that they own. +type ChownMode string + +const ( + ChownModeRestricted ChownMode = "Restricted" + ChownModeUnrestricted ChownMode = "Unrestricted" +) + +// PossibleChownModeValues returns the possible values for the ChownMode const type. +func PossibleChownModeValues() []ChownMode { + return []ChownMode{ + ChownModeRestricted, + ChownModeUnrestricted, + } +} + +// ToPtr returns a *ChownMode pointing to the current value. +func (c ChownMode) ToPtr() *ChownMode { + return &c +} + +// CreatedByType - The type of identity that created the resource. +type CreatedByType string + +const ( + CreatedByTypeApplication CreatedByType = "Application" + CreatedByTypeKey CreatedByType = "Key" + CreatedByTypeManagedIdentity CreatedByType = "ManagedIdentity" + CreatedByTypeUser CreatedByType = "User" +) + +// PossibleCreatedByTypeValues returns the possible values for the CreatedByType const type. +func PossibleCreatedByTypeValues() []CreatedByType { + return []CreatedByType{ + CreatedByTypeApplication, + CreatedByTypeKey, + CreatedByTypeManagedIdentity, + CreatedByTypeUser, + } +} + +// ToPtr returns a *CreatedByType pointing to the current value. +func (c CreatedByType) ToPtr() *CreatedByType { + return &c +} + +// EncryptionType - Encryption type of the capacity pool, set encryption type for data at rest for this pool and all volumes in it. This value can only +// be set when creating new pool. +type EncryptionType string + +const ( + // EncryptionTypeDouble - EncryptionType Double, volumes will use double encryption at rest + EncryptionTypeDouble EncryptionType = "Double" + // EncryptionTypeSingle - EncryptionType Single, volumes will use single encryption at rest + EncryptionTypeSingle EncryptionType = "Single" +) + +// PossibleEncryptionTypeValues returns the possible values for the EncryptionType const type. +func PossibleEncryptionTypeValues() []EncryptionType { + return []EncryptionType{ + EncryptionTypeDouble, + EncryptionTypeSingle, + } +} + +// ToPtr returns a *EncryptionType pointing to the current value. +func (c EncryptionType) ToPtr() *EncryptionType { + return &c +} + +// EndpointType - Indicates whether the local volume is the source or destination for the Volume Replication +type EndpointType string + +const ( + EndpointTypeDst EndpointType = "dst" + EndpointTypeSrc EndpointType = "src" +) + +// PossibleEndpointTypeValues returns the possible values for the EndpointType const type. +func PossibleEndpointTypeValues() []EndpointType { + return []EndpointType{ + EndpointTypeDst, + EndpointTypeSrc, + } +} + +// ToPtr returns a *EndpointType pointing to the current value. +func (c EndpointType) ToPtr() *EndpointType { + return &c +} + +// InAvailabilityReasonType - Invalid indicates the name provided does not match Azure App Service naming requirements. AlreadyExists indicates that the +// name is already in use and is therefore unavailable. +type InAvailabilityReasonType string + +const ( + InAvailabilityReasonTypeAlreadyExists InAvailabilityReasonType = "AlreadyExists" + InAvailabilityReasonTypeInvalid InAvailabilityReasonType = "Invalid" +) + +// PossibleInAvailabilityReasonTypeValues returns the possible values for the InAvailabilityReasonType const type. +func PossibleInAvailabilityReasonTypeValues() []InAvailabilityReasonType { + return []InAvailabilityReasonType{ + InAvailabilityReasonTypeAlreadyExists, + InAvailabilityReasonTypeInvalid, + } +} + +// ToPtr returns a *InAvailabilityReasonType pointing to the current value. +func (c InAvailabilityReasonType) ToPtr() *InAvailabilityReasonType { + return &c +} + +type MetricAggregationType string + +const ( + MetricAggregationTypeAverage MetricAggregationType = "Average" +) + +// PossibleMetricAggregationTypeValues returns the possible values for the MetricAggregationType const type. +func PossibleMetricAggregationTypeValues() []MetricAggregationType { + return []MetricAggregationType{ + MetricAggregationTypeAverage, + } +} + +// ToPtr returns a *MetricAggregationType pointing to the current value. +func (c MetricAggregationType) ToPtr() *MetricAggregationType { + return &c +} + +// MirrorState - The status of the replication +type MirrorState string + +const ( + MirrorStateBroken MirrorState = "Broken" + MirrorStateMirrored MirrorState = "Mirrored" + MirrorStateUninitialized MirrorState = "Uninitialized" +) + +// PossibleMirrorStateValues returns the possible values for the MirrorState const type. +func PossibleMirrorStateValues() []MirrorState { + return []MirrorState{ + MirrorStateBroken, + MirrorStateMirrored, + MirrorStateUninitialized, + } +} + +// ToPtr returns a *MirrorState pointing to the current value. +func (c MirrorState) ToPtr() *MirrorState { + return &c +} + +// NetworkFeatures - Basic network, or Standard features available to the volume. +type NetworkFeatures string + +const ( + // NetworkFeaturesBasic - Basic network feature. + NetworkFeaturesBasic NetworkFeatures = "Basic" + // NetworkFeaturesStandard - Standard network feature. + NetworkFeaturesStandard NetworkFeatures = "Standard" +) + +// PossibleNetworkFeaturesValues returns the possible values for the NetworkFeatures const type. +func PossibleNetworkFeaturesValues() []NetworkFeatures { + return []NetworkFeatures{ + NetworkFeaturesBasic, + NetworkFeaturesStandard, + } +} + +// ToPtr returns a *NetworkFeatures pointing to the current value. +func (c NetworkFeatures) ToPtr() *NetworkFeatures { + return &c +} + +// QosType - The qos type of the pool +type QosType string + +const ( + // QosTypeAuto - qos type Auto + QosTypeAuto QosType = "Auto" + // QosTypeManual - qos type Manual + QosTypeManual QosType = "Manual" +) + +// PossibleQosTypeValues returns the possible values for the QosType const type. +func PossibleQosTypeValues() []QosType { + return []QosType{ + QosTypeAuto, + QosTypeManual, + } +} + +// ToPtr returns a *QosType pointing to the current value. +func (c QosType) ToPtr() *QosType { + return &c +} + +// RelationshipStatus - Status of the mirror relationship +type RelationshipStatus string + +const ( + RelationshipStatusIdle RelationshipStatus = "Idle" + RelationshipStatusTransferring RelationshipStatus = "Transferring" +) + +// PossibleRelationshipStatusValues returns the possible values for the RelationshipStatus const type. +func PossibleRelationshipStatusValues() []RelationshipStatus { + return []RelationshipStatus{ + RelationshipStatusIdle, + RelationshipStatusTransferring, + } +} + +// ToPtr returns a *RelationshipStatus pointing to the current value. +func (c RelationshipStatus) ToPtr() *RelationshipStatus { + return &c +} + +// ReplicationSchedule - Schedule +type ReplicationSchedule string + +const ( + ReplicationSchedule10Minutely ReplicationSchedule = "_10minutely" + ReplicationScheduleDaily ReplicationSchedule = "daily" + ReplicationScheduleHourly ReplicationSchedule = "hourly" +) + +// PossibleReplicationScheduleValues returns the possible values for the ReplicationSchedule const type. +func PossibleReplicationScheduleValues() []ReplicationSchedule { + return []ReplicationSchedule{ + ReplicationSchedule10Minutely, + ReplicationScheduleDaily, + ReplicationScheduleHourly, + } +} + +// ToPtr returns a *ReplicationSchedule pointing to the current value. +func (c ReplicationSchedule) ToPtr() *ReplicationSchedule { + return &c +} + +// SecurityStyle - The security style of volume, default unix, defaults to ntfs for dual protocol or CIFS protocol +type SecurityStyle string + +const ( + SecurityStyleNtfs SecurityStyle = "ntfs" + SecurityStyleUnix SecurityStyle = "unix" +) + +// PossibleSecurityStyleValues returns the possible values for the SecurityStyle const type. +func PossibleSecurityStyleValues() []SecurityStyle { + return []SecurityStyle{ + SecurityStyleNtfs, + SecurityStyleUnix, + } +} + +// ToPtr returns a *SecurityStyle pointing to the current value. +func (c SecurityStyle) ToPtr() *SecurityStyle { + return &c +} + +// ServiceLevel - The service level of the file system +type ServiceLevel string + +const ( + // ServiceLevelPremium - Premium service level + ServiceLevelPremium ServiceLevel = "Premium" + // ServiceLevelStandard - Standard service level + ServiceLevelStandard ServiceLevel = "Standard" + // ServiceLevelStandardZRS - Zone redundant storage service level + ServiceLevelStandardZRS ServiceLevel = "StandardZRS" + // ServiceLevelUltra - Ultra service level + ServiceLevelUltra ServiceLevel = "Ultra" +) + +// PossibleServiceLevelValues returns the possible values for the ServiceLevel const type. +func PossibleServiceLevelValues() []ServiceLevel { + return []ServiceLevel{ + ServiceLevelPremium, + ServiceLevelStandard, + ServiceLevelStandardZRS, + ServiceLevelUltra, + } +} + +// ToPtr returns a *ServiceLevel pointing to the current value. +func (c ServiceLevel) ToPtr() *ServiceLevel { + return &c +} + +// VolumeStorageToNetworkProximity - Provides storage to network proximity information for the volume. +type VolumeStorageToNetworkProximity string + +const ( + // VolumeStorageToNetworkProximityDefault - Basic storage to network connectivity. + VolumeStorageToNetworkProximityDefault VolumeStorageToNetworkProximity = "Default" + // VolumeStorageToNetworkProximityT1 - Standard T1 storage to network connectivity. + VolumeStorageToNetworkProximityT1 VolumeStorageToNetworkProximity = "T1" + // VolumeStorageToNetworkProximityT2 - Standard T2 storage to network connectivity. + VolumeStorageToNetworkProximityT2 VolumeStorageToNetworkProximity = "T2" +) + +// PossibleVolumeStorageToNetworkProximityValues returns the possible values for the VolumeStorageToNetworkProximity const type. +func PossibleVolumeStorageToNetworkProximityValues() []VolumeStorageToNetworkProximity { + return []VolumeStorageToNetworkProximity{ + VolumeStorageToNetworkProximityDefault, + VolumeStorageToNetworkProximityT1, + VolumeStorageToNetworkProximityT2, + } +} + +// ToPtr returns a *VolumeStorageToNetworkProximity pointing to the current value. +func (c VolumeStorageToNetworkProximity) ToPtr() *VolumeStorageToNetworkProximity { + return &c +} diff --git a/sdk/resourcemanager/netapp/armnetapp/zz_generated_models.go b/sdk/resourcemanager/netapp/armnetapp/zz_generated_models.go new file mode 100644 index 000000000000..5367b3f43385 --- /dev/null +++ b/sdk/resourcemanager/netapp/armnetapp/zz_generated_models.go @@ -0,0 +1,2417 @@ +//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 armnetapp + +import ( + "encoding/json" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" + "time" +) + +// AccountBackupsBeginDeleteOptions contains the optional parameters for the AccountBackups.BeginDelete method. +type AccountBackupsBeginDeleteOptions struct { + // placeholder for future optional parameters +} + +// AccountBackupsGetOptions contains the optional parameters for the AccountBackups.Get method. +type AccountBackupsGetOptions struct { + // placeholder for future optional parameters +} + +// AccountBackupsListOptions contains the optional parameters for the AccountBackups.List method. +type AccountBackupsListOptions struct { + // placeholder for future optional parameters +} + +// AccountEncryption - Encryption settings +type AccountEncryption struct { + // Encryption Key Source. Possible values are: 'Microsoft.NetApp'. + KeySource *string `json:"keySource,omitempty"` +} + +// AccountProperties - NetApp account properties +type AccountProperties struct { + // Active Directories + ActiveDirectories []*ActiveDirectory `json:"activeDirectories,omitempty"` + + // Encryption settings + Encryption *AccountEncryption `json:"encryption,omitempty"` + + // READ-ONLY; Azure lifecycle management + ProvisioningState *string `json:"provisioningState,omitempty" azure:"ro"` +} + +// MarshalJSON implements the json.Marshaller interface for type AccountProperties. +func (a AccountProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "activeDirectories", a.ActiveDirectories) + populate(objectMap, "encryption", a.Encryption) + populate(objectMap, "provisioningState", a.ProvisioningState) + return json.Marshal(objectMap) +} + +// AccountsBeginCreateOrUpdateOptions contains the optional parameters for the Accounts.BeginCreateOrUpdate method. +type AccountsBeginCreateOrUpdateOptions struct { + // placeholder for future optional parameters +} + +// AccountsBeginDeleteOptions contains the optional parameters for the Accounts.BeginDelete method. +type AccountsBeginDeleteOptions struct { + // placeholder for future optional parameters +} + +// AccountsBeginUpdateOptions contains the optional parameters for the Accounts.BeginUpdate method. +type AccountsBeginUpdateOptions struct { + // placeholder for future optional parameters +} + +// AccountsGetOptions contains the optional parameters for the Accounts.Get method. +type AccountsGetOptions struct { + // placeholder for future optional parameters +} + +// AccountsListBySubscriptionOptions contains the optional parameters for the Accounts.ListBySubscription method. +type AccountsListBySubscriptionOptions struct { + // placeholder for future optional parameters +} + +// AccountsListOptions contains the optional parameters for the Accounts.List method. +type AccountsListOptions struct { + // placeholder for future optional parameters +} + +// ActiveDirectory - Active Directory +type ActiveDirectory struct { + // Id of the Active Directory + ActiveDirectoryID *string `json:"activeDirectoryId,omitempty"` + + // Name of the active directory machine. This optional parameter is used only while creating kerberos volume + AdName *string `json:"adName,omitempty"` + + // Users to be added to the Built-in Administrators active directory group. A list of unique usernames without domain specifier + Administrators []*string `json:"administrators,omitempty"` + + // If enabled, AES encryption will be enabled for SMB communication. + AesEncryption *bool `json:"aesEncryption,omitempty"` + + // If enabled, NFS client local users can also (in addition to LDAP users) access the NFS volumes. + AllowLocalNfsUsersWithLdap *bool `json:"allowLocalNfsUsersWithLdap,omitempty"` + + // Users to be added to the Built-in Backup Operator active directory group. A list of unique usernames without domain specifier + BackupOperators []*string `json:"backupOperators,omitempty"` + + // Comma separated list of DNS server IP addresses (IPv4 only) for the Active Directory domain + DNS *string `json:"dns,omitempty"` + + // Name of the Active Directory domain + Domain *string `json:"domain,omitempty"` + + // If enabled, Traffic between the SMB server to Domain Controller (DC) will be encrypted. + EncryptDCConnections *bool `json:"encryptDCConnections,omitempty"` + + // kdc server IP addresses for the active directory machine. This optional parameter is used only while creating kerberos volume. + KdcIP *string `json:"kdcIP,omitempty"` + + // Specifies whether or not the LDAP traffic needs to be secured via TLS. + LdapOverTLS *bool `json:"ldapOverTLS,omitempty"` + + // Specifies whether or not the LDAP traffic needs to be signed. + LdapSigning *bool `json:"ldapSigning,omitempty"` + + // The Organizational Unit (OU) within the Windows Active Directory + OrganizationalUnit *string `json:"organizationalUnit,omitempty"` + + // Plain text password of Active Directory domain administrator, value is masked in the response + Password *string `json:"password,omitempty"` + + // Domain Users in the Active directory to be given SeSecurityPrivilege privilege (Needed for SMB Continuously available shares for SQL). A list of unique + // usernames without domain specifier + SecurityOperators []*string `json:"securityOperators,omitempty"` + + // When LDAP over SSL/TLS is enabled, the LDAP client is required to have base64 encoded Active Directory Certificate Service's self-signed root CA certificate, + // this optional parameter is used only for + // dual protocol with LDAP user-mapping volumes. + ServerRootCACertificate *string `json:"serverRootCACertificate,omitempty"` + + // The Active Directory site the service will limit Domain Controller discovery to + Site *string `json:"site,omitempty"` + + // NetBIOS name of the SMB server. This name will be registered as a computer account in the AD and used to mount volumes + SmbServerName *string `json:"smbServerName,omitempty"` + + // Username of Active Directory domain administrator + Username *string `json:"username,omitempty"` + + // READ-ONLY; Status of the Active Directory + Status *ActiveDirectoryStatus `json:"status,omitempty" azure:"ro"` + + // READ-ONLY; Any details in regards to the Status of the Active Directory + StatusDetails *string `json:"statusDetails,omitempty" azure:"ro"` +} + +// MarshalJSON implements the json.Marshaller interface for type ActiveDirectory. +func (a ActiveDirectory) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "activeDirectoryId", a.ActiveDirectoryID) + populate(objectMap, "adName", a.AdName) + populate(objectMap, "administrators", a.Administrators) + populate(objectMap, "aesEncryption", a.AesEncryption) + populate(objectMap, "allowLocalNfsUsersWithLdap", a.AllowLocalNfsUsersWithLdap) + populate(objectMap, "backupOperators", a.BackupOperators) + populate(objectMap, "dns", a.DNS) + populate(objectMap, "domain", a.Domain) + populate(objectMap, "encryptDCConnections", a.EncryptDCConnections) + populate(objectMap, "kdcIP", a.KdcIP) + populate(objectMap, "ldapOverTLS", a.LdapOverTLS) + populate(objectMap, "ldapSigning", a.LdapSigning) + populate(objectMap, "organizationalUnit", a.OrganizationalUnit) + populate(objectMap, "password", a.Password) + populate(objectMap, "securityOperators", a.SecurityOperators) + populate(objectMap, "serverRootCACertificate", a.ServerRootCACertificate) + populate(objectMap, "site", a.Site) + populate(objectMap, "smbServerName", a.SmbServerName) + populate(objectMap, "status", a.Status) + populate(objectMap, "statusDetails", a.StatusDetails) + populate(objectMap, "username", a.Username) + return json.Marshal(objectMap) +} + +// AuthorizeRequest - Authorize request +type AuthorizeRequest struct { + // Resource id of the remote volume + RemoteVolumeResourceID *string `json:"remoteVolumeResourceId,omitempty"` +} + +// Backup of a Volume +type Backup struct { + // REQUIRED; Resource location + Location *string `json:"location,omitempty"` + + // REQUIRED; Backup Properties + Properties *BackupProperties `json:"properties,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"` +} + +// BackupPatch - Backup patch +type BackupPatch struct { + // Backup Properties + Properties *BackupProperties `json:"properties,omitempty"` + + // Resource tags + Tags map[string]*string `json:"tags,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type BackupPatch. +func (b BackupPatch) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "properties", b.Properties) + populate(objectMap, "tags", b.Tags) + return json.Marshal(objectMap) +} + +// BackupPoliciesBeginCreateOptions contains the optional parameters for the BackupPolicies.BeginCreate method. +type BackupPoliciesBeginCreateOptions struct { + // placeholder for future optional parameters +} + +// BackupPoliciesBeginDeleteOptions contains the optional parameters for the BackupPolicies.BeginDelete method. +type BackupPoliciesBeginDeleteOptions struct { + // placeholder for future optional parameters +} + +// BackupPoliciesBeginUpdateOptions contains the optional parameters for the BackupPolicies.BeginUpdate method. +type BackupPoliciesBeginUpdateOptions struct { + // placeholder for future optional parameters +} + +// BackupPoliciesGetOptions contains the optional parameters for the BackupPolicies.Get method. +type BackupPoliciesGetOptions struct { + // placeholder for future optional parameters +} + +// BackupPoliciesList - List of Backup Policies +type BackupPoliciesList struct { + // A list of backup policies + Value []*BackupPolicy `json:"value,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type BackupPoliciesList. +func (b BackupPoliciesList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "value", b.Value) + return json.Marshal(objectMap) +} + +// BackupPoliciesListOptions contains the optional parameters for the BackupPolicies.List method. +type BackupPoliciesListOptions struct { + // placeholder for future optional parameters +} + +// BackupPolicy - Backup policy information +type BackupPolicy struct { + // REQUIRED; Resource location + Location *string `json:"location,omitempty"` + + // REQUIRED; Backup policy Properties + Properties *BackupPolicyProperties `json:"properties,omitempty"` + + // Resource tags + Tags map[string]*string `json:"tags,omitempty"` + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty" azure:"ro"` + + // 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 BackupPolicy. +func (b BackupPolicy) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", b.Etag) + populate(objectMap, "id", b.ID) + populate(objectMap, "location", b.Location) + populate(objectMap, "name", b.Name) + populate(objectMap, "properties", b.Properties) + populate(objectMap, "tags", b.Tags) + populate(objectMap, "type", b.Type) + return json.Marshal(objectMap) +} + +// BackupPolicyDetails - Backup policy properties +type BackupPolicyDetails struct { + // Resource location + Location *string `json:"location,omitempty"` + + // Backup policy Properties + Properties *BackupPolicyProperties `json:"properties,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 BackupPolicyDetails. +func (b BackupPolicyDetails) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", b.ID) + populate(objectMap, "location", b.Location) + populate(objectMap, "name", b.Name) + populate(objectMap, "properties", b.Properties) + populate(objectMap, "tags", b.Tags) + populate(objectMap, "type", b.Type) + return json.Marshal(objectMap) +} + +// BackupPolicyPatch - Backup policy Details for create and update +type BackupPolicyPatch struct { + // Resource location + Location *string `json:"location,omitempty"` + + // Backup policy Properties + Properties *BackupPolicyProperties `json:"properties,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 BackupPolicyPatch. +func (b BackupPolicyPatch) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", b.ID) + populate(objectMap, "location", b.Location) + populate(objectMap, "name", b.Name) + populate(objectMap, "properties", b.Properties) + populate(objectMap, "tags", b.Tags) + populate(objectMap, "type", b.Type) + return json.Marshal(objectMap) +} + +// BackupPolicyProperties - Backup policy properties +type BackupPolicyProperties struct { + // Daily backups count to keep + DailyBackupsToKeep *int32 `json:"dailyBackupsToKeep,omitempty"` + + // The property to decide policy is enabled or not + Enabled *bool `json:"enabled,omitempty"` + + // Monthly backups count to keep + MonthlyBackupsToKeep *int32 `json:"monthlyBackupsToKeep,omitempty"` + + // Weekly backups count to keep + WeeklyBackupsToKeep *int32 `json:"weeklyBackupsToKeep,omitempty"` + + // READ-ONLY; Backup Policy Resource ID + BackupPolicyID *string `json:"backupPolicyId,omitempty" azure:"ro"` + + // READ-ONLY; Azure lifecycle management + ProvisioningState *string `json:"provisioningState,omitempty" azure:"ro"` + + // READ-ONLY; A list of volumes assigned to this policy + VolumeBackups []*VolumeBackups `json:"volumeBackups,omitempty" azure:"ro"` + + // READ-ONLY; Volumes using current backup policy + VolumesAssigned *int32 `json:"volumesAssigned,omitempty" azure:"ro"` +} + +// MarshalJSON implements the json.Marshaller interface for type BackupPolicyProperties. +func (b BackupPolicyProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "backupPolicyId", b.BackupPolicyID) + populate(objectMap, "dailyBackupsToKeep", b.DailyBackupsToKeep) + populate(objectMap, "enabled", b.Enabled) + populate(objectMap, "monthlyBackupsToKeep", b.MonthlyBackupsToKeep) + populate(objectMap, "provisioningState", b.ProvisioningState) + populate(objectMap, "volumeBackups", b.VolumeBackups) + populate(objectMap, "volumesAssigned", b.VolumesAssigned) + populate(objectMap, "weeklyBackupsToKeep", b.WeeklyBackupsToKeep) + return json.Marshal(objectMap) +} + +// BackupProperties - Backup properties +type BackupProperties struct { + // Label for backup + Label *string `json:"label,omitempty"` + + // Manual backup an already existing snapshot. This will always be false for scheduled backups and true/false for manual backups + UseExistingSnapshot *bool `json:"useExistingSnapshot,omitempty"` + + // READ-ONLY; UUID v4 used to identify the Backup + BackupID *string `json:"backupId,omitempty" azure:"ro"` + + // READ-ONLY; Type of backup Manual or Scheduled + BackupType *BackupType `json:"backupType,omitempty" azure:"ro"` + + // READ-ONLY; The creation date of the backup + CreationDate *time.Time `json:"creationDate,omitempty" azure:"ro"` + + // READ-ONLY; Failure reason + FailureReason *string `json:"failureReason,omitempty" azure:"ro"` + + // READ-ONLY; Azure lifecycle management + ProvisioningState *string `json:"provisioningState,omitempty" azure:"ro"` + + // READ-ONLY; Size of backup + Size *int64 `json:"size,omitempty" azure:"ro"` + + // READ-ONLY; Volume name + VolumeName *string `json:"volumeName,omitempty" azure:"ro"` +} + +// MarshalJSON implements the json.Marshaller interface for type BackupProperties. +func (b BackupProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "backupId", b.BackupID) + populate(objectMap, "backupType", b.BackupType) + populateTimeRFC3339(objectMap, "creationDate", b.CreationDate) + populate(objectMap, "failureReason", b.FailureReason) + populate(objectMap, "label", b.Label) + populate(objectMap, "provisioningState", b.ProvisioningState) + populate(objectMap, "size", b.Size) + populate(objectMap, "useExistingSnapshot", b.UseExistingSnapshot) + populate(objectMap, "volumeName", b.VolumeName) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type BackupProperties. +func (b *BackupProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "backupId": + err = unpopulate(val, &b.BackupID) + delete(rawMsg, key) + case "backupType": + err = unpopulate(val, &b.BackupType) + delete(rawMsg, key) + case "creationDate": + err = unpopulateTimeRFC3339(val, &b.CreationDate) + delete(rawMsg, key) + case "failureReason": + err = unpopulate(val, &b.FailureReason) + delete(rawMsg, key) + case "label": + err = unpopulate(val, &b.Label) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, &b.ProvisioningState) + delete(rawMsg, key) + case "size": + err = unpopulate(val, &b.Size) + delete(rawMsg, key) + case "useExistingSnapshot": + err = unpopulate(val, &b.UseExistingSnapshot) + delete(rawMsg, key) + case "volumeName": + err = unpopulate(val, &b.VolumeName) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// BackupStatus - Backup status +type BackupStatus struct { + // READ-ONLY; Displays error message if the backup is in an error state + ErrorMessage *string `json:"errorMessage,omitempty" azure:"ro"` + + // READ-ONLY; Backup health status + Healthy *bool `json:"healthy,omitempty" azure:"ro"` + + // READ-ONLY; Displays the last transfer size + LastTransferSize *int64 `json:"lastTransferSize,omitempty" azure:"ro"` + + // READ-ONLY; Displays the last transfer type + LastTransferType *string `json:"lastTransferType,omitempty" azure:"ro"` + + // READ-ONLY; The status of the backup + MirrorState *MirrorState `json:"mirrorState,omitempty" azure:"ro"` + + // READ-ONLY; Status of the backup mirror relationship + RelationshipStatus *RelationshipStatus `json:"relationshipStatus,omitempty" azure:"ro"` + + // READ-ONLY; Displays the total bytes transferred + TotalTransferBytes *int64 `json:"totalTransferBytes,omitempty" azure:"ro"` + + // READ-ONLY; Reason for the unhealthy backup relationship + UnhealthyReason *string `json:"unhealthyReason,omitempty" azure:"ro"` +} + +// BackupsBeginCreateOptions contains the optional parameters for the Backups.BeginCreate method. +type BackupsBeginCreateOptions struct { + // placeholder for future optional parameters +} + +// BackupsBeginDeleteOptions contains the optional parameters for the Backups.BeginDelete method. +type BackupsBeginDeleteOptions struct { + // placeholder for future optional parameters +} + +// BackupsBeginUpdateOptions contains the optional parameters for the Backups.BeginUpdate method. +type BackupsBeginUpdateOptions struct { + // Backup object supplied in the body of the operation. + Body *BackupPatch +} + +// BackupsGetOptions contains the optional parameters for the Backups.Get method. +type BackupsGetOptions struct { + // placeholder for future optional parameters +} + +// BackupsGetStatusOptions contains the optional parameters for the Backups.GetStatus method. +type BackupsGetStatusOptions struct { + // placeholder for future optional parameters +} + +// BackupsGetVolumeRestoreStatusOptions contains the optional parameters for the Backups.GetVolumeRestoreStatus method. +type BackupsGetVolumeRestoreStatusOptions struct { + // placeholder for future optional parameters +} + +// BackupsList - List of Backups +type BackupsList struct { + // A list of Backups + Value []*Backup `json:"value,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type BackupsList. +func (b BackupsList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "value", b.Value) + return json.Marshal(objectMap) +} + +// BackupsListOptions contains the optional parameters for the Backups.List method. +type BackupsListOptions struct { + // placeholder for future optional parameters +} + +// BreakReplicationRequest - Break replication request +type BreakReplicationRequest struct { + // If replication is in status transferring and you want to force break the replication, set to true + ForceBreakReplication *bool `json:"forceBreakReplication,omitempty"` +} + +// CapacityPool - Capacity pool resource +type CapacityPool struct { + // REQUIRED; Resource location + Location *string `json:"location,omitempty"` + + // REQUIRED; Capacity pool properties + Properties *PoolProperties `json:"properties,omitempty"` + + // Resource tags + Tags map[string]*string `json:"tags,omitempty"` + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty" azure:"ro"` + + // 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 CapacityPool. +func (c CapacityPool) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", c.Etag) + populate(objectMap, "id", c.ID) + populate(objectMap, "location", c.Location) + populate(objectMap, "name", c.Name) + populate(objectMap, "properties", c.Properties) + populate(objectMap, "tags", c.Tags) + populate(objectMap, "type", c.Type) + return json.Marshal(objectMap) +} + +// CapacityPoolList - List of capacity pool resources +type CapacityPoolList struct { + // URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` + + // List of Capacity pools + Value []*CapacityPool `json:"value,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type CapacityPoolList. +func (c CapacityPoolList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", c.NextLink) + populate(objectMap, "value", c.Value) + return json.Marshal(objectMap) +} + +// CapacityPoolPatch - Capacity pool patch resource +type CapacityPoolPatch struct { + // Resource location + Location *string `json:"location,omitempty"` + + // Capacity pool properties + Properties *PoolPatchProperties `json:"properties,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 CapacityPoolPatch. +func (c CapacityPoolPatch) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", c.ID) + populate(objectMap, "location", c.Location) + populate(objectMap, "name", c.Name) + populate(objectMap, "properties", c.Properties) + populate(objectMap, "tags", c.Tags) + populate(objectMap, "type", c.Type) + return json.Marshal(objectMap) +} + +// CheckAvailabilityResponse - Information regarding availability of a resource. +type CheckAvailabilityResponse struct { + // true indicates name is valid and available. false indicates the name is invalid, unavailable, or both. + IsAvailable *bool `json:"isAvailable,omitempty"` + + // If reason == invalid, provide the user with the reason why the given name is invalid, and provide the resource naming requirements so that the user can + // select a valid name. If reason == AlreadyExists, + // explain that resource name is already in use, and direct them to select a different name. + Message *string `json:"message,omitempty"` + + // Invalid indicates the name provided does not match Azure App Service naming requirements. AlreadyExists indicates that the name is already in use and + // is therefore unavailable. + Reason *InAvailabilityReasonType `json:"reason,omitempty"` +} + +// CloudError - An error response from the service. +// Implements the error and azcore.HTTPResponse interfaces. +type CloudError struct { + raw string + // Cloud error body. + InnerError *CloudErrorBody `json:"error,omitempty"` +} + +// Error implements the error interface for type CloudError. +// The contents of the error text are not contractual and subject to change. +func (e CloudError) Error() string { + return e.raw +} + +// CloudErrorBody - An error response from the service. +type CloudErrorBody struct { + // An identifier for the error. Codes are invariant and are intended to be consumed programmatically. + Code *string `json:"code,omitempty"` + + // A message describing the error, intended to be suitable for display in a user interface. + Message *string `json:"message,omitempty"` +} + +// DailySchedule - Daily Schedule properties +type DailySchedule struct { + // Indicates which hour in UTC timezone a snapshot should be taken + Hour *int32 `json:"hour,omitempty"` + + // Indicates which minute snapshot should be taken + Minute *int32 `json:"minute,omitempty"` + + // Daily snapshot count to keep + SnapshotsToKeep *int32 `json:"snapshotsToKeep,omitempty"` + + // Resource size in bytes, current storage usage for the volume in bytes + UsedBytes *int64 `json:"usedBytes,omitempty"` +} + +// Dimension of blobs, possibly be blob type or access tier. +type Dimension struct { + // Display name of dimension. + DisplayName *string `json:"displayName,omitempty"` + + // Display name of dimension. + Name *string `json:"name,omitempty"` +} + +// ExportPolicyRule - Volume Export Policy Rule +type ExportPolicyRule struct { + // Client ingress specification as comma separated string with IPv4 CIDRs, IPv4 host addresses and host names + AllowedClients *string `json:"allowedClients,omitempty"` + + // This parameter specifies who is authorized to change the ownership of a file. restricted - Only root user can change the ownership of the file. unrestricted + // - Non-root users can change ownership of + // files that they own. + ChownMode *ChownMode `json:"chownMode,omitempty"` + + // Allows CIFS protocol + Cifs *bool `json:"cifs,omitempty"` + + // Has root access to volume + HasRootAccess *bool `json:"hasRootAccess,omitempty"` + + // Kerberos5i Read only access. To be use with swagger version 2020-05-01 or later + Kerberos5IReadOnly *bool `json:"kerberos5iReadOnly,omitempty"` + + // Kerberos5i Read and write access. To be use with swagger version 2020-05-01 or later + Kerberos5IReadWrite *bool `json:"kerberos5iReadWrite,omitempty"` + + // Kerberos5p Read only access. To be use with swagger version 2020-05-01 or later + Kerberos5PReadOnly *bool `json:"kerberos5pReadOnly,omitempty"` + + // Kerberos5p Read and write access. To be use with swagger version 2020-05-01 or later + Kerberos5PReadWrite *bool `json:"kerberos5pReadWrite,omitempty"` + + // Kerberos5 Read only access. To be use with swagger version 2020-05-01 or later + Kerberos5ReadOnly *bool `json:"kerberos5ReadOnly,omitempty"` + + // Kerberos5 Read and write access. To be use with swagger version 2020-05-01 or later + Kerberos5ReadWrite *bool `json:"kerberos5ReadWrite,omitempty"` + + // Allows NFSv3 protocol. Enable only for NFSv3 type volumes + Nfsv3 *bool `json:"nfsv3,omitempty"` + + // Allows NFSv4.1 protocol. Enable only for NFSv4.1 type volumes + Nfsv41 *bool `json:"nfsv41,omitempty"` + + // Order index + RuleIndex *int32 `json:"ruleIndex,omitempty"` + + // Read only access + UnixReadOnly *bool `json:"unixReadOnly,omitempty"` + + // Read and write access + UnixReadWrite *bool `json:"unixReadWrite,omitempty"` +} + +// FilePathAvailabilityRequest - File path availability request content - availability is based on the name and the subnetId. +type FilePathAvailabilityRequest struct { + // REQUIRED; File path to verify. + Name *string `json:"name,omitempty"` + + // REQUIRED; The Azure Resource URI for a delegated subnet. Must have the delegation Microsoft.NetApp/volumes + SubnetID *string `json:"subnetId,omitempty"` +} + +// HourlySchedule - Hourly Schedule properties +type HourlySchedule struct { + // Indicates which minute snapshot should be taken + Minute *int32 `json:"minute,omitempty"` + + // Hourly snapshot count to keep + SnapshotsToKeep *int32 `json:"snapshotsToKeep,omitempty"` + + // Resource size in bytes, current storage usage for the volume in bytes + UsedBytes *int64 `json:"usedBytes,omitempty"` +} + +// LogSpecification - Log Definition of a single resource metric. +type LogSpecification struct { + // Display name of log specification. + DisplayName *string `json:"displayName,omitempty"` + + // Name of log specification. + Name *string `json:"name,omitempty"` +} + +// MetricSpecification - Metric specification of operation. +type MetricSpecification struct { + // Aggregation type could be Average. + AggregationType *string `json:"aggregationType,omitempty"` + + // The category this metric specification belong to, could be Capacity. + Category *string `json:"category,omitempty"` + + // Dimensions of blobs, including blob type and access tier. + Dimensions []*Dimension `json:"dimensions,omitempty"` + + // Display description of metric specification. + DisplayDescription *string `json:"displayDescription,omitempty"` + + // Display name of metric specification. + DisplayName *string `json:"displayName,omitempty"` + + // Whether or not the service is using regional MDM accounts. + EnableRegionalMdmAccount *bool `json:"enableRegionalMdmAccount,omitempty"` + + // The property to decide fill gap with zero or not. + FillGapWithZero *bool `json:"fillGapWithZero,omitempty"` + + // The internal metric name. + InternalMetricName *string `json:"internalMetricName,omitempty"` + + // Whether the metric is internal. + IsInternal *bool `json:"isInternal,omitempty"` + + // Name of metric specification. + Name *string `json:"name,omitempty"` + + // Account Resource Id. + ResourceIDDimensionNameOverride *string `json:"resourceIdDimensionNameOverride,omitempty"` + + // The source MDM account. + SourceMdmAccount *string `json:"sourceMdmAccount,omitempty"` + + // The source MDM namespace. + SourceMdmNamespace *string `json:"sourceMdmNamespace,omitempty"` + + // Support metric aggregation type. + SupportedAggregationTypes []*MetricAggregationType `json:"supportedAggregationTypes,omitempty"` + + // The supported time grain types for the metrics. + SupportedTimeGrainTypes []*string `json:"supportedTimeGrainTypes,omitempty"` + + // Unit could be Bytes or Count. + Unit *string `json:"unit,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type MetricSpecification. +func (m MetricSpecification) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "aggregationType", m.AggregationType) + populate(objectMap, "category", m.Category) + populate(objectMap, "dimensions", m.Dimensions) + populate(objectMap, "displayDescription", m.DisplayDescription) + populate(objectMap, "displayName", m.DisplayName) + populate(objectMap, "enableRegionalMdmAccount", m.EnableRegionalMdmAccount) + populate(objectMap, "fillGapWithZero", m.FillGapWithZero) + populate(objectMap, "internalMetricName", m.InternalMetricName) + populate(objectMap, "isInternal", m.IsInternal) + populate(objectMap, "name", m.Name) + populate(objectMap, "resourceIdDimensionNameOverride", m.ResourceIDDimensionNameOverride) + populate(objectMap, "sourceMdmAccount", m.SourceMdmAccount) + populate(objectMap, "sourceMdmNamespace", m.SourceMdmNamespace) + populate(objectMap, "supportedAggregationTypes", m.SupportedAggregationTypes) + populate(objectMap, "supportedTimeGrainTypes", m.SupportedTimeGrainTypes) + populate(objectMap, "unit", m.Unit) + return json.Marshal(objectMap) +} + +// MonthlySchedule - Monthly Schedule properties +type MonthlySchedule struct { + // Indicates which days of the month snapshot should be taken. A comma delimited string. + DaysOfMonth *string `json:"daysOfMonth,omitempty"` + + // Indicates which hour in UTC timezone a snapshot should be taken + Hour *int32 `json:"hour,omitempty"` + + // Indicates which minute snapshot should be taken + Minute *int32 `json:"minute,omitempty"` + + // Monthly snapshot count to keep + SnapshotsToKeep *int32 `json:"snapshotsToKeep,omitempty"` + + // Resource size in bytes, current storage usage for the volume in bytes + UsedBytes *int64 `json:"usedBytes,omitempty"` +} + +// MountTarget - Mount Target +type MountTarget struct { + // REQUIRED; Resource location + Location *string `json:"location,omitempty"` + + // REQUIRED; Mount Target Properties + Properties *MountTargetProperties `json:"properties,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 MountTarget. +func (m MountTarget) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", m.ID) + populate(objectMap, "location", m.Location) + populate(objectMap, "name", m.Name) + populate(objectMap, "properties", m.Properties) + populate(objectMap, "tags", m.Tags) + populate(objectMap, "type", m.Type) + return json.Marshal(objectMap) +} + +// MountTargetProperties - Mount target properties +type MountTargetProperties struct { + // REQUIRED; UUID v4 used to identify the MountTarget + FileSystemID *string `json:"fileSystemId,omitempty"` + + // The SMB server's Fully Qualified Domain Name, FQDN + SmbServerFqdn *string `json:"smbServerFqdn,omitempty"` + + // READ-ONLY; The mount target's IPv4 address + IPAddress *string `json:"ipAddress,omitempty" azure:"ro"` + + // READ-ONLY; UUID v4 used to identify the MountTarget + MountTargetID *string `json:"mountTargetId,omitempty" azure:"ro"` +} + +// NetAppAccount - NetApp account resource +type NetAppAccount struct { + // REQUIRED; Resource location + Location *string `json:"location,omitempty"` + + // NetApp Account properties + Properties *AccountProperties `json:"properties,omitempty"` + + // Resource tags + Tags map[string]*string `json:"tags,omitempty"` + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty" azure:"ro"` + + // READ-ONLY; Resource Id + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; Resource name + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; The system meta data relating to this resource. + SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` + + // READ-ONLY; Resource type + Type *string `json:"type,omitempty" azure:"ro"` +} + +// MarshalJSON implements the json.Marshaller interface for type NetAppAccount. +func (n NetAppAccount) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", n.Etag) + populate(objectMap, "id", n.ID) + populate(objectMap, "location", n.Location) + populate(objectMap, "name", n.Name) + populate(objectMap, "properties", n.Properties) + populate(objectMap, "systemData", n.SystemData) + populate(objectMap, "tags", n.Tags) + populate(objectMap, "type", n.Type) + return json.Marshal(objectMap) +} + +// NetAppAccountList - List of NetApp account resources +type NetAppAccountList struct { + // URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` + + // Multiple NetApp accounts + Value []*NetAppAccount `json:"value,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type NetAppAccountList. +func (n NetAppAccountList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", n.NextLink) + populate(objectMap, "value", n.Value) + return json.Marshal(objectMap) +} + +// NetAppAccountPatch - NetApp account patch resource +type NetAppAccountPatch struct { + // Resource location + Location *string `json:"location,omitempty"` + + // NetApp Account properties + Properties *AccountProperties `json:"properties,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 NetAppAccountPatch. +func (n NetAppAccountPatch) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", n.ID) + populate(objectMap, "location", n.Location) + populate(objectMap, "name", n.Name) + populate(objectMap, "properties", n.Properties) + populate(objectMap, "tags", n.Tags) + populate(objectMap, "type", n.Type) + return json.Marshal(objectMap) +} + +// NetAppResourceCheckFilePathAvailabilityOptions contains the optional parameters for the NetAppResource.CheckFilePathAvailability method. +type NetAppResourceCheckFilePathAvailabilityOptions struct { + // placeholder for future optional parameters +} + +// NetAppResourceCheckNameAvailabilityOptions contains the optional parameters for the NetAppResource.CheckNameAvailability method. +type NetAppResourceCheckNameAvailabilityOptions struct { + // placeholder for future optional parameters +} + +// NetAppResourceCheckQuotaAvailabilityOptions contains the optional parameters for the NetAppResource.CheckQuotaAvailability method. +type NetAppResourceCheckQuotaAvailabilityOptions struct { + // placeholder for future optional parameters +} + +// NetAppResourceQuotaLimitsGetOptions contains the optional parameters for the NetAppResourceQuotaLimits.Get method. +type NetAppResourceQuotaLimitsGetOptions struct { + // placeholder for future optional parameters +} + +// NetAppResourceQuotaLimitsListOptions contains the optional parameters for the NetAppResourceQuotaLimits.List method. +type NetAppResourceQuotaLimitsListOptions struct { + // placeholder for future optional parameters +} + +// Operation - Microsoft.NetApp REST API operation definition. +type Operation struct { + // Display metadata associated with the operation. + Display *OperationDisplay `json:"display,omitempty"` + + // Operation name: {provider}/{resource}/{operation} + Name *string `json:"name,omitempty"` + + // The origin of operations. + Origin *string `json:"origin,omitempty"` + + // Properties of operation, include metric specifications. + Properties *OperationProperties `json:"properties,omitempty"` +} + +// OperationDisplay - Display metadata associated with the operation. +type OperationDisplay struct { + // Operation description. + Description *string `json:"description,omitempty"` + + // Type of operation: get, read, delete, etc. + Operation *string `json:"operation,omitempty"` + + // Service provider: Microsoft NetApp. + Provider *string `json:"provider,omitempty"` + + // Resource on which the operation is performed etc. + Resource *string `json:"resource,omitempty"` +} + +// OperationListResult - Result of the request to list Cloud Volume operations. It contains a list of operations and a URL link to get the next set of results. +type OperationListResult struct { + // List of Storage operations supported by the Storage resource provider. + Value []*Operation `json:"value,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type OperationListResult. +func (o OperationListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "value", o.Value) + return json.Marshal(objectMap) +} + +// OperationProperties - Properties of operation, include metric specifications. +type OperationProperties struct { + // One property of operation, include metric specifications. + ServiceSpecification *ServiceSpecification `json:"serviceSpecification,omitempty"` +} + +// OperationsListOptions contains the optional parameters for the Operations.List method. +type OperationsListOptions struct { + // placeholder for future optional parameters +} + +// PlacementKeyValuePairs - Application specific parameters for the placement of volumes in the volume group +type PlacementKeyValuePairs struct { + // REQUIRED; Key for an application specific parameter for the placement of volumes in the volume group + Key *string `json:"key,omitempty"` + + // REQUIRED; Value for an application specific parameter for the placement of volumes in the volume group + Value *string `json:"value,omitempty"` +} + +// PoolChangeRequest - Pool change request +type PoolChangeRequest struct { + // REQUIRED; Resource id of the pool to move volume to + NewPoolResourceID *string `json:"newPoolResourceId,omitempty"` +} + +// PoolPatchProperties - Patchable pool properties +type PoolPatchProperties struct { + // The qos type of the pool + QosType *QosType `json:"qosType,omitempty"` + + // Provisioned size of the pool (in bytes). Allowed values are in 4TiB chunks (value must be multiply of 4398046511104). + Size *int64 `json:"size,omitempty"` +} + +// PoolProperties - Pool properties +type PoolProperties struct { + // REQUIRED; The service level of the file system + ServiceLevel *ServiceLevel `json:"serviceLevel,omitempty"` + + // REQUIRED; Provisioned size of the pool (in bytes). Allowed values are in 4TiB chunks (value must be multiply of 4398046511104). + Size *int64 `json:"size,omitempty"` + + // If enabled (true) the pool can contain cool Access enabled volumes. + CoolAccess *bool `json:"coolAccess,omitempty"` + + // Encryption type of the capacity pool, set encryption type for data at rest for this pool and all volumes in it. This value can only be set when creating + // new pool. + EncryptionType *EncryptionType `json:"encryptionType,omitempty"` + + // The qos type of the pool + QosType *QosType `json:"qosType,omitempty"` + + // READ-ONLY; UUID v4 used to identify the Pool + PoolID *string `json:"poolId,omitempty" azure:"ro"` + + // READ-ONLY; Azure lifecycle management + ProvisioningState *string `json:"provisioningState,omitempty" azure:"ro"` + + // READ-ONLY; Total throughput of pool in Mibps + TotalThroughputMibps *float32 `json:"totalThroughputMibps,omitempty" azure:"ro"` + + // READ-ONLY; Utilized throughput of pool in Mibps + UtilizedThroughputMibps *float32 `json:"utilizedThroughputMibps,omitempty" azure:"ro"` +} + +// PoolsBeginCreateOrUpdateOptions contains the optional parameters for the Pools.BeginCreateOrUpdate method. +type PoolsBeginCreateOrUpdateOptions struct { + // placeholder for future optional parameters +} + +// PoolsBeginDeleteOptions contains the optional parameters for the Pools.BeginDelete method. +type PoolsBeginDeleteOptions struct { + // placeholder for future optional parameters +} + +// PoolsBeginUpdateOptions contains the optional parameters for the Pools.BeginUpdate method. +type PoolsBeginUpdateOptions struct { + // placeholder for future optional parameters +} + +// PoolsGetOptions contains the optional parameters for the Pools.Get method. +type PoolsGetOptions struct { + // placeholder for future optional parameters +} + +// PoolsListOptions contains the optional parameters for the Pools.List method. +type PoolsListOptions struct { + // placeholder for future optional parameters +} + +// ProxyResource - The resource model definition for a Azure Resource Manager proxy resource. It will not have tags and a location +type ProxyResource struct { + Resource +} + +// QuotaAvailabilityRequest - Quota availability request content. +type QuotaAvailabilityRequest struct { + // REQUIRED; Name of the resource to verify. + Name *string `json:"name,omitempty"` + + // REQUIRED; Resource group name. + ResourceGroup *string `json:"resourceGroup,omitempty"` + + // REQUIRED; Resource type used for verification. + Type *CheckQuotaNameResourceTypes `json:"type,omitempty"` +} + +// ReplicationObject - Replication properties +type ReplicationObject struct { + // REQUIRED; The resource ID of the remote volume. + RemoteVolumeResourceID *string `json:"remoteVolumeResourceId,omitempty"` + + // Indicates whether the local volume is the source or destination for the Volume Replication + EndpointType *EndpointType `json:"endpointType,omitempty"` + + // The remote region for the other end of the Volume Replication. + RemoteVolumeRegion *string `json:"remoteVolumeRegion,omitempty"` + + // Id + ReplicationID *string `json:"replicationId,omitempty"` + + // Schedule + ReplicationSchedule *ReplicationSchedule `json:"replicationSchedule,omitempty"` +} + +// ReplicationStatus - Replication status +type ReplicationStatus struct { + // Displays error message if the replication is in an error state + ErrorMessage *string `json:"errorMessage,omitempty"` + + // Replication health check + Healthy *bool `json:"healthy,omitempty"` + + // The status of the replication + MirrorState *MirrorState `json:"mirrorState,omitempty"` + + // Status of the mirror relationship + RelationshipStatus *RelationshipStatus `json:"relationshipStatus,omitempty"` + + // The progress of the replication + TotalProgress *string `json:"totalProgress,omitempty"` +} + +// Resource - Common fields that are returned in the response for all Azure Resource Manager resources +type Resource struct { + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; The name of the resource + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty" azure:"ro"` +} + +// ResourceIdentity - Identity for the resource. +type ResourceIdentity struct { + // Type of Identity. Supported values are: 'None', 'SystemAssigned' + Type *string `json:"type,omitempty"` + + // READ-ONLY; Object id of the identity resource + PrincipalID *string `json:"principalId,omitempty" azure:"ro"` + + // READ-ONLY; The tenant id of the resource + TenantID *string `json:"tenantId,omitempty" azure:"ro"` +} + +// ResourceNameAvailabilityRequest - Resource name availability request content. +type ResourceNameAvailabilityRequest struct { + // REQUIRED; Resource name to verify. + Name *string `json:"name,omitempty"` + + // REQUIRED; Resource group name. + ResourceGroup *string `json:"resourceGroup,omitempty"` + + // REQUIRED; Resource type used for verification. + Type *CheckNameResourceTypes `json:"type,omitempty"` +} + +// RestoreStatus - Restore status +type RestoreStatus struct { + // READ-ONLY; Displays error message if the restore is in an error state + ErrorMessage *string `json:"errorMessage,omitempty" azure:"ro"` + + // READ-ONLY; Restore health status + Healthy *bool `json:"healthy,omitempty" azure:"ro"` + + // READ-ONLY; The status of the restore + MirrorState *MirrorState `json:"mirrorState,omitempty" azure:"ro"` + + // READ-ONLY; Status of the restore SnapMirror relationship + RelationshipStatus *RelationshipStatus `json:"relationshipStatus,omitempty" azure:"ro"` + + // READ-ONLY; Displays the total bytes transferred + TotalTransferBytes *int64 `json:"totalTransferBytes,omitempty" azure:"ro"` + + // READ-ONLY; Reason for the unhealthy restore relationship + UnhealthyReason *string `json:"unhealthyReason,omitempty" azure:"ro"` +} + +// ServiceSpecification - One property of operation, include metric specifications. +type ServiceSpecification struct { + // Log specification of operation. + LogSpecifications []*LogSpecification `json:"logSpecifications,omitempty"` + + // Metric specifications of operation. + MetricSpecifications []*MetricSpecification `json:"metricSpecifications,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type ServiceSpecification. +func (s ServiceSpecification) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "logSpecifications", s.LogSpecifications) + populate(objectMap, "metricSpecifications", s.MetricSpecifications) + return json.Marshal(objectMap) +} + +// Snapshot of a Volume +type Snapshot struct { + // REQUIRED; Resource location + Location *string `json:"location,omitempty"` + + // Snapshot Properties + Properties *SnapshotProperties `json:"properties,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"` +} + +// SnapshotPoliciesBeginDeleteOptions contains the optional parameters for the SnapshotPolicies.BeginDelete method. +type SnapshotPoliciesBeginDeleteOptions struct { + // placeholder for future optional parameters +} + +// SnapshotPoliciesBeginUpdateOptions contains the optional parameters for the SnapshotPolicies.BeginUpdate method. +type SnapshotPoliciesBeginUpdateOptions struct { + // placeholder for future optional parameters +} + +// SnapshotPoliciesCreateOptions contains the optional parameters for the SnapshotPolicies.Create method. +type SnapshotPoliciesCreateOptions struct { + // placeholder for future optional parameters +} + +// SnapshotPoliciesGetOptions contains the optional parameters for the SnapshotPolicies.Get method. +type SnapshotPoliciesGetOptions struct { + // placeholder for future optional parameters +} + +// SnapshotPoliciesList - List of Snapshot Policies +type SnapshotPoliciesList struct { + // A list of snapshot policies + Value []*SnapshotPolicy `json:"value,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type SnapshotPoliciesList. +func (s SnapshotPoliciesList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "value", s.Value) + return json.Marshal(objectMap) +} + +// SnapshotPoliciesListOptions contains the optional parameters for the SnapshotPolicies.List method. +type SnapshotPoliciesListOptions struct { + // placeholder for future optional parameters +} + +// SnapshotPoliciesListVolumesOptions contains the optional parameters for the SnapshotPolicies.ListVolumes method. +type SnapshotPoliciesListVolumesOptions struct { + // placeholder for future optional parameters +} + +// SnapshotPolicy - Snapshot policy information +type SnapshotPolicy struct { + // REQUIRED; Resource location + Location *string `json:"location,omitempty"` + + // REQUIRED; Snapshot policy Properties + Properties *SnapshotPolicyProperties `json:"properties,omitempty"` + + // Resource tags + Tags map[string]*string `json:"tags,omitempty"` + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty" azure:"ro"` + + // 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 SnapshotPolicy. +func (s SnapshotPolicy) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", s.Etag) + populate(objectMap, "id", s.ID) + populate(objectMap, "location", s.Location) + populate(objectMap, "name", s.Name) + populate(objectMap, "properties", s.Properties) + populate(objectMap, "tags", s.Tags) + populate(objectMap, "type", s.Type) + return json.Marshal(objectMap) +} + +// SnapshotPolicyDetails - Snapshot policy properties +type SnapshotPolicyDetails struct { + // Resource location + Location *string `json:"location,omitempty"` + + // Snapshot policy Properties + Properties *SnapshotPolicyProperties `json:"properties,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 SnapshotPolicyDetails. +func (s SnapshotPolicyDetails) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", s.ID) + populate(objectMap, "location", s.Location) + populate(objectMap, "name", s.Name) + populate(objectMap, "properties", s.Properties) + populate(objectMap, "tags", s.Tags) + populate(objectMap, "type", s.Type) + return json.Marshal(objectMap) +} + +// SnapshotPolicyPatch - Snapshot policy Details for create and update +type SnapshotPolicyPatch struct { + // Resource location + Location *string `json:"location,omitempty"` + + // Snapshot Policy properties + Properties *SnapshotPolicyProperties `json:"properties,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 SnapshotPolicyPatch. +func (s SnapshotPolicyPatch) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", s.ID) + populate(objectMap, "location", s.Location) + populate(objectMap, "name", s.Name) + populate(objectMap, "properties", s.Properties) + populate(objectMap, "tags", s.Tags) + populate(objectMap, "type", s.Type) + return json.Marshal(objectMap) +} + +// SnapshotPolicyProperties - Snapshot policy properties +type SnapshotPolicyProperties struct { + // Schedule for daily snapshots + DailySchedule *DailySchedule `json:"dailySchedule,omitempty"` + + // The property to decide policy is enabled or not + Enabled *bool `json:"enabled,omitempty"` + + // Schedule for hourly snapshots + HourlySchedule *HourlySchedule `json:"hourlySchedule,omitempty"` + + // Schedule for monthly snapshots + MonthlySchedule *MonthlySchedule `json:"monthlySchedule,omitempty"` + + // Schedule for weekly snapshots + WeeklySchedule *WeeklySchedule `json:"weeklySchedule,omitempty"` + + // READ-ONLY; Azure lifecycle management + ProvisioningState *string `json:"provisioningState,omitempty" azure:"ro"` +} + +// SnapshotPolicyVolumeList - Volumes associated with snapshot policy +type SnapshotPolicyVolumeList struct { + // List of volumes + Value []*Volume `json:"value,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type SnapshotPolicyVolumeList. +func (s SnapshotPolicyVolumeList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "value", s.Value) + return json.Marshal(objectMap) +} + +// SnapshotProperties - Snapshot properties +type SnapshotProperties struct { + // READ-ONLY; The creation date of the snapshot + Created *time.Time `json:"created,omitempty" azure:"ro"` + + // READ-ONLY; Azure lifecycle management + ProvisioningState *string `json:"provisioningState,omitempty" azure:"ro"` + + // READ-ONLY; UUID v4 used to identify the Snapshot + SnapshotID *string `json:"snapshotId,omitempty" azure:"ro"` +} + +// MarshalJSON implements the json.Marshaller interface for type SnapshotProperties. +func (s SnapshotProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populateTimeRFC3339(objectMap, "created", s.Created) + populate(objectMap, "provisioningState", s.ProvisioningState) + populate(objectMap, "snapshotId", s.SnapshotID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SnapshotProperties. +func (s *SnapshotProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "created": + err = unpopulateTimeRFC3339(val, &s.Created) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, &s.ProvisioningState) + delete(rawMsg, key) + case "snapshotId": + err = unpopulate(val, &s.SnapshotID) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// SnapshotsBeginCreateOptions contains the optional parameters for the Snapshots.BeginCreate method. +type SnapshotsBeginCreateOptions struct { + // placeholder for future optional parameters +} + +// SnapshotsBeginDeleteOptions contains the optional parameters for the Snapshots.BeginDelete method. +type SnapshotsBeginDeleteOptions struct { + // placeholder for future optional parameters +} + +// SnapshotsBeginUpdateOptions contains the optional parameters for the Snapshots.BeginUpdate method. +type SnapshotsBeginUpdateOptions struct { + // placeholder for future optional parameters +} + +// SnapshotsGetOptions contains the optional parameters for the Snapshots.Get method. +type SnapshotsGetOptions struct { + // placeholder for future optional parameters +} + +// SnapshotsList - List of Snapshots +type SnapshotsList struct { + // A list of Snapshots + Value []*Snapshot `json:"value,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type SnapshotsList. +func (s SnapshotsList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "value", s.Value) + return json.Marshal(objectMap) +} + +// SnapshotsListOptions contains the optional parameters for the Snapshots.List method. +type SnapshotsListOptions struct { + // placeholder for future optional parameters +} + +// SubscriptionQuotaItem - Information regarding Subscription Quota Item. +type SubscriptionQuotaItem struct { + ProxyResource + // SubscriptionQuotaItem properties + Properties *SubscriptionQuotaItemProperties `json:"properties,omitempty"` + + // READ-ONLY; The system meta data relating to this resource. + SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` +} + +// SubscriptionQuotaItemList - List of Subscription Quota Items +type SubscriptionQuotaItemList struct { + // A list of SubscriptionQuotaItems + Value []*SubscriptionQuotaItem `json:"value,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type SubscriptionQuotaItemList. +func (s SubscriptionQuotaItemList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "value", s.Value) + return json.Marshal(objectMap) +} + +// SubscriptionQuotaItemProperties - SubscriptionQuotaItem Properties +type SubscriptionQuotaItemProperties struct { + // READ-ONLY; The current quota value. + Current *int32 `json:"current,omitempty" azure:"ro"` + + // READ-ONLY; The default quota value. + Default *int32 `json:"default,omitempty" azure:"ro"` +} + +// SystemData - Metadata pertaining to creation and last modification of the resource. +type SystemData struct { + // The timestamp of resource creation (UTC). + CreatedAt *time.Time `json:"createdAt,omitempty"` + + // The identity that created the resource. + CreatedBy *string `json:"createdBy,omitempty"` + + // The type of identity that created the resource. + CreatedByType *CreatedByType `json:"createdByType,omitempty"` + + // The timestamp of resource last modification (UTC) + LastModifiedAt *time.Time `json:"lastModifiedAt,omitempty"` + + // The identity that last modified the resource. + LastModifiedBy *string `json:"lastModifiedBy,omitempty"` + + // The type of identity that last modified the resource. + LastModifiedByType *CreatedByType `json:"lastModifiedByType,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type SystemData. +func (s SystemData) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populateTimeRFC3339(objectMap, "createdAt", s.CreatedAt) + populate(objectMap, "createdBy", s.CreatedBy) + populate(objectMap, "createdByType", s.CreatedByType) + populateTimeRFC3339(objectMap, "lastModifiedAt", s.LastModifiedAt) + populate(objectMap, "lastModifiedBy", s.LastModifiedBy) + populate(objectMap, "lastModifiedByType", s.LastModifiedByType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SystemData. +func (s *SystemData) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "createdAt": + err = unpopulateTimeRFC3339(val, &s.CreatedAt) + delete(rawMsg, key) + case "createdBy": + err = unpopulate(val, &s.CreatedBy) + delete(rawMsg, key) + case "createdByType": + err = unpopulate(val, &s.CreatedByType) + delete(rawMsg, key) + case "lastModifiedAt": + err = unpopulateTimeRFC3339(val, &s.LastModifiedAt) + delete(rawMsg, key) + case "lastModifiedBy": + err = unpopulate(val, &s.LastModifiedBy) + delete(rawMsg, key) + case "lastModifiedByType": + err = unpopulate(val, &s.LastModifiedByType) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// Vault information +type Vault struct { + // REQUIRED; Resource location + Location *string `json:"location,omitempty"` + + // REQUIRED; Vault Properties + Properties *VaultProperties `json:"properties,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"` +} + +// VaultList - List of Vaults +type VaultList struct { + // A list of vaults + Value []*Vault `json:"value,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type VaultList. +func (v VaultList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "value", v.Value) + return json.Marshal(objectMap) +} + +// VaultProperties - Vault properties +type VaultProperties struct { + // Vault Name + VaultName *string `json:"vaultName,omitempty"` +} + +// VaultsListOptions contains the optional parameters for the Vaults.List method. +type VaultsListOptions struct { + // placeholder for future optional parameters +} + +// Volume resource +type Volume struct { + // REQUIRED; Resource location + Location *string `json:"location,omitempty"` + + // REQUIRED; Volume properties + Properties *VolumeProperties `json:"properties,omitempty"` + + // Resource tags + Tags map[string]*string `json:"tags,omitempty"` + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty" azure:"ro"` + + // 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 Volume. +func (v Volume) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", v.Etag) + populate(objectMap, "id", v.ID) + populate(objectMap, "location", v.Location) + populate(objectMap, "name", v.Name) + populate(objectMap, "properties", v.Properties) + populate(objectMap, "tags", v.Tags) + populate(objectMap, "type", v.Type) + return json.Marshal(objectMap) +} + +// VolumeBackupProperties - Volume Backup Properties +type VolumeBackupProperties struct { + // Backup Enabled + BackupEnabled *bool `json:"backupEnabled,omitempty"` + + // Backup Policy Resource ID + BackupPolicyID *string `json:"backupPolicyId,omitempty"` + + // Policy Enforced + PolicyEnforced *bool `json:"policyEnforced,omitempty"` + + // Vault Resource ID + VaultID *string `json:"vaultId,omitempty"` +} + +// VolumeBackups - Volume details using the backup policy +type VolumeBackups struct { + // Total count of backups for volume + BackupsCount *int32 `json:"backupsCount,omitempty"` + + // Policy enabled + PolicyEnabled *bool `json:"policyEnabled,omitempty"` + + // Volume name + VolumeName *string `json:"volumeName,omitempty"` +} + +// VolumeGroup - Volume group resource +type VolumeGroup struct { + // Resource location + Location *string `json:"location,omitempty"` + + // Volume group properties + Properties *VolumeGroupListProperties `json:"properties,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 VolumeGroup. +func (v VolumeGroup) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", v.ID) + populate(objectMap, "location", v.Location) + populate(objectMap, "name", v.Name) + populate(objectMap, "properties", v.Properties) + populate(objectMap, "tags", v.Tags) + populate(objectMap, "type", v.Type) + return json.Marshal(objectMap) +} + +// VolumeGroupDetails - Volume group resource for create +type VolumeGroupDetails struct { + // Resource location + Location *string `json:"location,omitempty"` + + // Volume group properties + Properties *VolumeGroupProperties `json:"properties,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 VolumeGroupDetails. +func (v VolumeGroupDetails) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", v.ID) + populate(objectMap, "location", v.Location) + populate(objectMap, "name", v.Name) + populate(objectMap, "properties", v.Properties) + populate(objectMap, "tags", v.Tags) + populate(objectMap, "type", v.Type) + return json.Marshal(objectMap) +} + +// VolumeGroupList - List of volume group resources +type VolumeGroupList struct { + // List of volume Groups + Value []*VolumeGroup `json:"value,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type VolumeGroupList. +func (v VolumeGroupList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "value", v.Value) + return json.Marshal(objectMap) +} + +// VolumeGroupListProperties - Volume group properties +type VolumeGroupListProperties struct { + // Volume group details + GroupMetaData *VolumeGroupMetaData `json:"groupMetaData,omitempty"` + + // READ-ONLY; Azure lifecycle management + ProvisioningState *string `json:"provisioningState,omitempty" azure:"ro"` +} + +// VolumeGroupMetaData - Volume group properties +type VolumeGroupMetaData struct { + // Application specific identifier + ApplicationIdentifier *string `json:"applicationIdentifier,omitempty"` + + // Application Type + ApplicationType *ApplicationType `json:"applicationType,omitempty"` + + // Application specific identifier of deployment rules for the volume group + DeploymentSpecID *string `json:"deploymentSpecId,omitempty"` + + // Application specific placement rules for the volume group + GlobalPlacementRules []*PlacementKeyValuePairs `json:"globalPlacementRules,omitempty"` + + // Group Description + GroupDescription *string `json:"groupDescription,omitempty"` + + // READ-ONLY; Number of volumes in volume group + VolumesCount *int64 `json:"volumesCount,omitempty" azure:"ro"` +} + +// MarshalJSON implements the json.Marshaller interface for type VolumeGroupMetaData. +func (v VolumeGroupMetaData) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "applicationIdentifier", v.ApplicationIdentifier) + populate(objectMap, "applicationType", v.ApplicationType) + populate(objectMap, "deploymentSpecId", v.DeploymentSpecID) + populate(objectMap, "globalPlacementRules", v.GlobalPlacementRules) + populate(objectMap, "groupDescription", v.GroupDescription) + populate(objectMap, "volumesCount", v.VolumesCount) + return json.Marshal(objectMap) +} + +// VolumeGroupProperties - Volume group properties +type VolumeGroupProperties struct { + // Volume group details + GroupMetaData *VolumeGroupMetaData `json:"groupMetaData,omitempty"` + + // List of volumes from group + Volumes []*VolumeGroupVolumeProperties `json:"volumes,omitempty"` + + // READ-ONLY; Azure lifecycle management + ProvisioningState *string `json:"provisioningState,omitempty" azure:"ro"` +} + +// MarshalJSON implements the json.Marshaller interface for type VolumeGroupProperties. +func (v VolumeGroupProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "groupMetaData", v.GroupMetaData) + populate(objectMap, "provisioningState", v.ProvisioningState) + populate(objectMap, "volumes", v.Volumes) + return json.Marshal(objectMap) +} + +// VolumeGroupVolumeProperties - Volume resource +type VolumeGroupVolumeProperties struct { + // REQUIRED; Volume properties + Properties *VolumeProperties `json:"properties,omitempty"` + + // Resource name + Name *string `json:"name,omitempty"` + + // Resource tags + Tags map[string]*string `json:"tags,omitempty"` + + // READ-ONLY; Resource Id + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; Resource type + Type *string `json:"type,omitempty" azure:"ro"` +} + +// MarshalJSON implements the json.Marshaller interface for type VolumeGroupVolumeProperties. +func (v VolumeGroupVolumeProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", v.ID) + populate(objectMap, "name", v.Name) + populate(objectMap, "properties", v.Properties) + populate(objectMap, "tags", v.Tags) + populate(objectMap, "type", v.Type) + return json.Marshal(objectMap) +} + +// VolumeGroupsBeginCreateOptions contains the optional parameters for the VolumeGroups.BeginCreate method. +type VolumeGroupsBeginCreateOptions struct { + // placeholder for future optional parameters +} + +// VolumeGroupsBeginDeleteOptions contains the optional parameters for the VolumeGroups.BeginDelete method. +type VolumeGroupsBeginDeleteOptions struct { + // placeholder for future optional parameters +} + +// VolumeGroupsGetOptions contains the optional parameters for the VolumeGroups.Get method. +type VolumeGroupsGetOptions struct { + // placeholder for future optional parameters +} + +// VolumeGroupsListByNetAppAccountOptions contains the optional parameters for the VolumeGroups.ListByNetAppAccount method. +type VolumeGroupsListByNetAppAccountOptions struct { + // placeholder for future optional parameters +} + +// VolumeList - List of volume resources +type VolumeList struct { + // URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` + + // List of volumes + Value []*Volume `json:"value,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type VolumeList. +func (v VolumeList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", v.NextLink) + populate(objectMap, "value", v.Value) + return json.Marshal(objectMap) +} + +// VolumePatch - Volume patch resource +type VolumePatch struct { + // Resource location + Location *string `json:"location,omitempty"` + + // Patchable volume properties + Properties *VolumePatchProperties `json:"properties,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 VolumePatch. +func (v VolumePatch) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", v.ID) + populate(objectMap, "location", v.Location) + populate(objectMap, "name", v.Name) + populate(objectMap, "properties", v.Properties) + populate(objectMap, "tags", v.Tags) + populate(objectMap, "type", v.Type) + return json.Marshal(objectMap) +} + +// VolumePatchProperties - Patchable volume properties +type VolumePatchProperties struct { + // DataProtection type volumes include an object containing details of the replication + DataProtection *VolumePatchPropertiesDataProtection `json:"dataProtection,omitempty"` + + // Default group quota for volume in KiBs. If isDefaultQuotaEnabled is set, the minimum value of 4 KiBs applies. + DefaultGroupQuotaInKiBs *int64 `json:"defaultGroupQuotaInKiBs,omitempty"` + + // Default user quota for volume in KiBs. If isDefaultQuotaEnabled is set, the minimum value of 4 KiBs applies . + DefaultUserQuotaInKiBs *int64 `json:"defaultUserQuotaInKiBs,omitempty"` + + // Set of export policy rules + ExportPolicy *VolumePatchPropertiesExportPolicy `json:"exportPolicy,omitempty"` + + // Specifies if default quota is enabled for the volume. + IsDefaultQuotaEnabled *bool `json:"isDefaultQuotaEnabled,omitempty"` + + // The service level of the file system + ServiceLevel *ServiceLevel `json:"serviceLevel,omitempty"` + + // Maximum throughput in Mibps that can be achieved by this volume and this will be accepted as input only for manual qosType volume + ThroughputMibps *float32 `json:"throughputMibps,omitempty"` + + // Maximum storage quota allowed for a file system in bytes. This is a soft quota used for alerting only. Minimum size is 100 GiB. Upper limit is 100TiB. + // Specified in bytes. + UsageThreshold *int64 `json:"usageThreshold,omitempty"` +} + +// VolumePatchPropertiesDataProtection - DataProtection type volumes include an object containing details of the replication +type VolumePatchPropertiesDataProtection struct { + // Backup Properties + Backup *VolumeBackupProperties `json:"backup,omitempty"` + + // Snapshot properties. + Snapshot *VolumeSnapshotProperties `json:"snapshot,omitempty"` +} + +// VolumePatchPropertiesExportPolicy - Set of export policy rules +type VolumePatchPropertiesExportPolicy struct { + // Export policy rule + Rules []*ExportPolicyRule `json:"rules,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type VolumePatchPropertiesExportPolicy. +func (v VolumePatchPropertiesExportPolicy) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "rules", v.Rules) + return json.Marshal(objectMap) +} + +// VolumeProperties - Volume properties +type VolumeProperties struct { + // REQUIRED; A unique file path for the volume. Used when creating mount targets + CreationToken *string `json:"creationToken,omitempty"` + + // REQUIRED; The Azure Resource URI for a delegated subnet. Must have the delegation Microsoft.NetApp/volumes + SubnetID *string `json:"subnetId,omitempty"` + + // REQUIRED; Maximum storage quota allowed for a file system in bytes. This is a soft quota used for alerting only. Minimum size is 100 GiB. Upper limit + // is 100TiB. Specified in bytes. + UsageThreshold *int64 `json:"usageThreshold,omitempty"` + + // Specifies whether the volume is enabled for Azure VMware Solution (AVS) datastore purpose + AvsDataStore *AvsDataStore `json:"avsDataStore,omitempty"` + + // UUID v4 or resource identifier used to identify the Backup. + BackupID *string `json:"backupId,omitempty"` + + // Pool Resource Id used in case of creating a volume through volume group + CapacityPoolResourceID *string `json:"capacityPoolResourceId,omitempty"` + + // Specifies whether Cool Access(tiering) is enabled for the volume. + CoolAccess *bool `json:"coolAccess,omitempty"` + + // Specifies the number of days after which data that is not accessed by clients will be tiered. + CoolnessPeriod *int32 `json:"coolnessPeriod,omitempty"` + + // DataProtection type volumes include an object containing details of the replication + DataProtection *VolumePropertiesDataProtection `json:"dataProtection,omitempty"` + + // Default group quota for volume in KiBs. If isDefaultQuotaEnabled is set, the minimum value of 4 KiBs applies. + DefaultGroupQuotaInKiBs *int64 `json:"defaultGroupQuotaInKiBs,omitempty"` + + // Default user quota for volume in KiBs. If isDefaultQuotaEnabled is set, the minimum value of 4 KiBs applies . + DefaultUserQuotaInKiBs *int64 `json:"defaultUserQuotaInKiBs,omitempty"` + + // Encryption Key Source. Possible values are: 'Microsoft.NetApp' + EncryptionKeySource *string `json:"encryptionKeySource,omitempty"` + + // Set of export policy rules + ExportPolicy *VolumePropertiesExportPolicy `json:"exportPolicy,omitempty"` + + // Specifies if default quota is enabled for the volume. + IsDefaultQuotaEnabled *bool `json:"isDefaultQuotaEnabled,omitempty"` + + // Restoring + IsRestoring *bool `json:"isRestoring,omitempty"` + + // Describe if a volume is KerberosEnabled. To be use with swagger version 2020-05-01 or later + KerberosEnabled *bool `json:"kerberosEnabled,omitempty"` + + // Specifies whether LDAP is enabled or not for a given NFS volume. + LdapEnabled *bool `json:"ldapEnabled,omitempty"` + + // Basic network, or Standard features available to the volume. + NetworkFeatures *NetworkFeatures `json:"networkFeatures,omitempty"` + + // Application specific placement rules for the particular volume + PlacementRules []*PlacementKeyValuePairs `json:"placementRules,omitempty"` + + // Set of protocol types, default NFSv3, CIFS for SMB protocol + ProtocolTypes []*string `json:"protocolTypes,omitempty"` + + // Proximity placement group associated with the volume + ProximityPlacementGroup *string `json:"proximityPlacementGroup,omitempty"` + + // The security style of volume, default unix, defaults to ntfs for dual protocol or CIFS protocol + SecurityStyle *SecurityStyle `json:"securityStyle,omitempty"` + + // The service level of the file system + ServiceLevel *ServiceLevel `json:"serviceLevel,omitempty"` + + // Enables continuously available share property for smb volume. Only applicable for SMB volume + SmbContinuouslyAvailable *bool `json:"smbContinuouslyAvailable,omitempty"` + + // Enables encryption for in-flight smb3 data. Only applicable for SMB/DualProtocol volume. To be used with swagger version 2020-08-01 or later + SmbEncryption *bool `json:"smbEncryption,omitempty"` + + // If enabled (true) the volume will contain a read-only snapshot directory which provides access to each of the volume's snapshots (default to true). + SnapshotDirectoryVisible *bool `json:"snapshotDirectoryVisible,omitempty"` + + // UUID v4 or resource identifier used to identify the Snapshot. + SnapshotID *string `json:"snapshotId,omitempty"` + + // Maximum throughput in Mibps that can be achieved by this volume and this will be accepted as input only for manual qosType volume + ThroughputMibps *float32 `json:"throughputMibps,omitempty"` + + // UNIX permissions for NFS volume accepted in octal 4 digit format. First digit selects the set user ID(4), set group ID (2) and sticky (1) attributes. + // Second digit selects permission for the owner of + // the file: read (4), write (2) and execute (1). Third selects permissions for other users in the same group. the fourth for other users not in the group. + // 0755 - gives read/write/execute permissions to + // owner and read/execute to group and other users. + UnixPermissions *string `json:"unixPermissions,omitempty"` + + // Volume spec name is the application specific designation or identifier for the particular volume in a volume group for e.g. data, log + VolumeSpecName *string `json:"volumeSpecName,omitempty"` + + // What type of volume is this. For destination volumes in Cross Region Replication, set type to DataProtection + VolumeType *string `json:"volumeType,omitempty"` + + // READ-ONLY; Unique Baremetal Tenant Identifier. + BaremetalTenantID *string `json:"baremetalTenantId,omitempty" azure:"ro"` + + // READ-ONLY; When a volume is being restored from another volume's snapshot, will show the percentage completion of this cloning process. When this value + // is empty/null there is no cloning process currently + // happening on this volume. This value will update every 5 minutes during cloning. + CloneProgress *int32 `json:"cloneProgress,omitempty" azure:"ro"` + + // READ-ONLY; Unique FileSystem Identifier. + FileSystemID *string `json:"fileSystemId,omitempty" azure:"ro"` + + // READ-ONLY; List of mount targets + MountTargets []*MountTargetProperties `json:"mountTargets,omitempty" azure:"ro"` + + // READ-ONLY; Network Sibling Set ID for the the group of volumes sharing networking resources. + NetworkSiblingSetID *string `json:"networkSiblingSetId,omitempty" azure:"ro"` + + // READ-ONLY; Azure lifecycle management + ProvisioningState *string `json:"provisioningState,omitempty" azure:"ro"` + + // READ-ONLY; Provides storage to network proximity information for the volume. + StorageToNetworkProximity *VolumeStorageToNetworkProximity `json:"storageToNetworkProximity,omitempty" azure:"ro"` + + // READ-ONLY; T2 network information + T2Network *string `json:"t2Network,omitempty" azure:"ro"` + + // READ-ONLY; Volume Group Name + VolumeGroupName *string `json:"volumeGroupName,omitempty" azure:"ro"` +} + +// MarshalJSON implements the json.Marshaller interface for type VolumeProperties. +func (v VolumeProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "avsDataStore", v.AvsDataStore) + populate(objectMap, "backupId", v.BackupID) + populate(objectMap, "baremetalTenantId", v.BaremetalTenantID) + populate(objectMap, "capacityPoolResourceId", v.CapacityPoolResourceID) + populate(objectMap, "cloneProgress", v.CloneProgress) + populate(objectMap, "coolAccess", v.CoolAccess) + populate(objectMap, "coolnessPeriod", v.CoolnessPeriod) + populate(objectMap, "creationToken", v.CreationToken) + populate(objectMap, "dataProtection", v.DataProtection) + populate(objectMap, "defaultGroupQuotaInKiBs", v.DefaultGroupQuotaInKiBs) + populate(objectMap, "defaultUserQuotaInKiBs", v.DefaultUserQuotaInKiBs) + populate(objectMap, "encryptionKeySource", v.EncryptionKeySource) + populate(objectMap, "exportPolicy", v.ExportPolicy) + populate(objectMap, "fileSystemId", v.FileSystemID) + populate(objectMap, "isDefaultQuotaEnabled", v.IsDefaultQuotaEnabled) + populate(objectMap, "isRestoring", v.IsRestoring) + populate(objectMap, "kerberosEnabled", v.KerberosEnabled) + populate(objectMap, "ldapEnabled", v.LdapEnabled) + populate(objectMap, "mountTargets", v.MountTargets) + populate(objectMap, "networkFeatures", v.NetworkFeatures) + populate(objectMap, "networkSiblingSetId", v.NetworkSiblingSetID) + populate(objectMap, "placementRules", v.PlacementRules) + populate(objectMap, "protocolTypes", v.ProtocolTypes) + populate(objectMap, "provisioningState", v.ProvisioningState) + populate(objectMap, "proximityPlacementGroup", v.ProximityPlacementGroup) + populate(objectMap, "securityStyle", v.SecurityStyle) + populate(objectMap, "serviceLevel", v.ServiceLevel) + populate(objectMap, "smbContinuouslyAvailable", v.SmbContinuouslyAvailable) + populate(objectMap, "smbEncryption", v.SmbEncryption) + populate(objectMap, "snapshotDirectoryVisible", v.SnapshotDirectoryVisible) + populate(objectMap, "snapshotId", v.SnapshotID) + populate(objectMap, "storageToNetworkProximity", v.StorageToNetworkProximity) + populate(objectMap, "subnetId", v.SubnetID) + populate(objectMap, "t2Network", v.T2Network) + populate(objectMap, "throughputMibps", v.ThroughputMibps) + populate(objectMap, "unixPermissions", v.UnixPermissions) + populate(objectMap, "usageThreshold", v.UsageThreshold) + populate(objectMap, "volumeGroupName", v.VolumeGroupName) + populate(objectMap, "volumeSpecName", v.VolumeSpecName) + populate(objectMap, "volumeType", v.VolumeType) + return json.Marshal(objectMap) +} + +// VolumePropertiesDataProtection - DataProtection type volumes include an object containing details of the replication +type VolumePropertiesDataProtection struct { + // Backup Properties + Backup *VolumeBackupProperties `json:"backup,omitempty"` + + // Replication properties + Replication *ReplicationObject `json:"replication,omitempty"` + + // Snapshot properties. + Snapshot *VolumeSnapshotProperties `json:"snapshot,omitempty"` +} + +// VolumePropertiesExportPolicy - Set of export policy rules +type VolumePropertiesExportPolicy struct { + // Export policy rule + Rules []*ExportPolicyRule `json:"rules,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type VolumePropertiesExportPolicy. +func (v VolumePropertiesExportPolicy) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "rules", v.Rules) + return json.Marshal(objectMap) +} + +// VolumeRevert - revert a volume to the snapshot +type VolumeRevert struct { + // Resource id of the snapshot + SnapshotID *string `json:"snapshotId,omitempty"` +} + +// VolumeSnapshotProperties - Volume Snapshot Properties +type VolumeSnapshotProperties struct { + // Snapshot Policy ResourceId + SnapshotPolicyID *string `json:"snapshotPolicyId,omitempty"` +} + +// VolumesBeginAuthorizeReplicationOptions contains the optional parameters for the Volumes.BeginAuthorizeReplication method. +type VolumesBeginAuthorizeReplicationOptions struct { + // placeholder for future optional parameters +} + +// VolumesBeginBreakReplicationOptions contains the optional parameters for the Volumes.BeginBreakReplication method. +type VolumesBeginBreakReplicationOptions struct { + // Optional body to force break the replication. + Body *BreakReplicationRequest +} + +// VolumesBeginCreateOrUpdateOptions contains the optional parameters for the Volumes.BeginCreateOrUpdate method. +type VolumesBeginCreateOrUpdateOptions struct { + // placeholder for future optional parameters +} + +// VolumesBeginDeleteOptions contains the optional parameters for the Volumes.BeginDelete method. +type VolumesBeginDeleteOptions struct { + // placeholder for future optional parameters +} + +// VolumesBeginDeleteReplicationOptions contains the optional parameters for the Volumes.BeginDeleteReplication method. +type VolumesBeginDeleteReplicationOptions struct { + // placeholder for future optional parameters +} + +// VolumesBeginPoolChangeOptions contains the optional parameters for the Volumes.BeginPoolChange method. +type VolumesBeginPoolChangeOptions struct { + // placeholder for future optional parameters +} + +// VolumesBeginReInitializeReplicationOptions contains the optional parameters for the Volumes.BeginReInitializeReplication method. +type VolumesBeginReInitializeReplicationOptions struct { + // placeholder for future optional parameters +} + +// VolumesBeginResyncReplicationOptions contains the optional parameters for the Volumes.BeginResyncReplication method. +type VolumesBeginResyncReplicationOptions struct { + // placeholder for future optional parameters +} + +// VolumesBeginRevertOptions contains the optional parameters for the Volumes.BeginRevert method. +type VolumesBeginRevertOptions struct { + // placeholder for future optional parameters +} + +// VolumesBeginUpdateOptions contains the optional parameters for the Volumes.BeginUpdate method. +type VolumesBeginUpdateOptions struct { + // placeholder for future optional parameters +} + +// VolumesGetOptions contains the optional parameters for the Volumes.Get method. +type VolumesGetOptions struct { + // placeholder for future optional parameters +} + +// VolumesListOptions contains the optional parameters for the Volumes.List method. +type VolumesListOptions struct { + // placeholder for future optional parameters +} + +// VolumesReplicationStatusOptions contains the optional parameters for the Volumes.ReplicationStatus method. +type VolumesReplicationStatusOptions struct { + // placeholder for future optional parameters +} + +// WeeklySchedule - Weekly Schedule properties, make a snapshot every week at a specific day or days +type WeeklySchedule struct { + // Indicates which weekdays snapshot should be taken, accepts a comma separated list of week day names in english + Day *string `json:"day,omitempty"` + + // Indicates which hour in UTC timezone a snapshot should be taken + Hour *int32 `json:"hour,omitempty"` + + // Indicates which minute snapshot should be taken + Minute *int32 `json:"minute,omitempty"` + + // Weekly snapshot count to keep + SnapshotsToKeep *int32 `json:"snapshotsToKeep,omitempty"` + + // Resource size in bytes, current storage usage for the volume in bytes + UsedBytes *int64 `json:"usedBytes,omitempty"` +} + +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 + } +} + +func unpopulate(data json.RawMessage, v interface{}) error { + if data == nil { + return nil + } + return json.Unmarshal(data, v) +} diff --git a/sdk/resourcemanager/netapp/armnetapp/zz_generated_netappresource_client.go b/sdk/resourcemanager/netapp/armnetapp/zz_generated_netappresource_client.go new file mode 100644 index 000000000000..16a22201446e --- /dev/null +++ b/sdk/resourcemanager/netapp/armnetapp/zz_generated_netappresource_client.go @@ -0,0 +1,222 @@ +//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 armnetapp + +import ( + "context" + "errors" + "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" +) + +// NetAppResourceClient contains the methods for the NetAppResource group. +// Don't use this type directly, use NewNetAppResourceClient() instead. +type NetAppResourceClient struct { + ep string + pl runtime.Pipeline + subscriptionID string +} + +// NewNetAppResourceClient creates a new instance of NetAppResourceClient with the specified values. +func NewNetAppResourceClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *NetAppResourceClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &NetAppResourceClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} +} + +// CheckFilePathAvailability - Check if a file path is available. +// If the operation fails it returns a generic error. +func (client *NetAppResourceClient) CheckFilePathAvailability(ctx context.Context, location string, body FilePathAvailabilityRequest, options *NetAppResourceCheckFilePathAvailabilityOptions) (NetAppResourceCheckFilePathAvailabilityResponse, error) { + req, err := client.checkFilePathAvailabilityCreateRequest(ctx, location, body, options) + if err != nil { + return NetAppResourceCheckFilePathAvailabilityResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return NetAppResourceCheckFilePathAvailabilityResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return NetAppResourceCheckFilePathAvailabilityResponse{}, client.checkFilePathAvailabilityHandleError(resp) + } + return client.checkFilePathAvailabilityHandleResponse(resp) +} + +// checkFilePathAvailabilityCreateRequest creates the CheckFilePathAvailability request. +func (client *NetAppResourceClient) checkFilePathAvailabilityCreateRequest(ctx context.Context, location string, body FilePathAvailabilityRequest, options *NetAppResourceCheckFilePathAvailabilityOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.NetApp/locations/{location}/checkFilePathAvailability" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if location == "" { + return nil, errors.New("parameter location cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{location}", url.PathEscape(location)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, runtime.MarshalAsJSON(req, body) +} + +// checkFilePathAvailabilityHandleResponse handles the CheckFilePathAvailability response. +func (client *NetAppResourceClient) checkFilePathAvailabilityHandleResponse(resp *http.Response) (NetAppResourceCheckFilePathAvailabilityResponse, error) { + result := NetAppResourceCheckFilePathAvailabilityResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.CheckAvailabilityResponse); err != nil { + return NetAppResourceCheckFilePathAvailabilityResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// checkFilePathAvailabilityHandleError handles the CheckFilePathAvailability error response. +func (client *NetAppResourceClient) checkFilePathAvailabilityHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + if len(body) == 0 { + return runtime.NewResponseError(errors.New(resp.Status), resp) + } + return runtime.NewResponseError(errors.New(string(body)), resp) +} + +// CheckNameAvailability - Check if a resource name is available. +// If the operation fails it returns a generic error. +func (client *NetAppResourceClient) CheckNameAvailability(ctx context.Context, location string, body ResourceNameAvailabilityRequest, options *NetAppResourceCheckNameAvailabilityOptions) (NetAppResourceCheckNameAvailabilityResponse, error) { + req, err := client.checkNameAvailabilityCreateRequest(ctx, location, body, options) + if err != nil { + return NetAppResourceCheckNameAvailabilityResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return NetAppResourceCheckNameAvailabilityResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return NetAppResourceCheckNameAvailabilityResponse{}, client.checkNameAvailabilityHandleError(resp) + } + return client.checkNameAvailabilityHandleResponse(resp) +} + +// checkNameAvailabilityCreateRequest creates the CheckNameAvailability request. +func (client *NetAppResourceClient) checkNameAvailabilityCreateRequest(ctx context.Context, location string, body ResourceNameAvailabilityRequest, options *NetAppResourceCheckNameAvailabilityOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.NetApp/locations/{location}/checkNameAvailability" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if location == "" { + return nil, errors.New("parameter location cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{location}", url.PathEscape(location)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, runtime.MarshalAsJSON(req, body) +} + +// checkNameAvailabilityHandleResponse handles the CheckNameAvailability response. +func (client *NetAppResourceClient) checkNameAvailabilityHandleResponse(resp *http.Response) (NetAppResourceCheckNameAvailabilityResponse, error) { + result := NetAppResourceCheckNameAvailabilityResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.CheckAvailabilityResponse); err != nil { + return NetAppResourceCheckNameAvailabilityResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// checkNameAvailabilityHandleError handles the CheckNameAvailability error response. +func (client *NetAppResourceClient) checkNameAvailabilityHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + if len(body) == 0 { + return runtime.NewResponseError(errors.New(resp.Status), resp) + } + return runtime.NewResponseError(errors.New(string(body)), resp) +} + +// CheckQuotaAvailability - Check if a quota is available. +// If the operation fails it returns a generic error. +func (client *NetAppResourceClient) CheckQuotaAvailability(ctx context.Context, location string, body QuotaAvailabilityRequest, options *NetAppResourceCheckQuotaAvailabilityOptions) (NetAppResourceCheckQuotaAvailabilityResponse, error) { + req, err := client.checkQuotaAvailabilityCreateRequest(ctx, location, body, options) + if err != nil { + return NetAppResourceCheckQuotaAvailabilityResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return NetAppResourceCheckQuotaAvailabilityResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return NetAppResourceCheckQuotaAvailabilityResponse{}, client.checkQuotaAvailabilityHandleError(resp) + } + return client.checkQuotaAvailabilityHandleResponse(resp) +} + +// checkQuotaAvailabilityCreateRequest creates the CheckQuotaAvailability request. +func (client *NetAppResourceClient) checkQuotaAvailabilityCreateRequest(ctx context.Context, location string, body QuotaAvailabilityRequest, options *NetAppResourceCheckQuotaAvailabilityOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.NetApp/locations/{location}/checkQuotaAvailability" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if location == "" { + return nil, errors.New("parameter location cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{location}", url.PathEscape(location)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, runtime.MarshalAsJSON(req, body) +} + +// checkQuotaAvailabilityHandleResponse handles the CheckQuotaAvailability response. +func (client *NetAppResourceClient) checkQuotaAvailabilityHandleResponse(resp *http.Response) (NetAppResourceCheckQuotaAvailabilityResponse, error) { + result := NetAppResourceCheckQuotaAvailabilityResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.CheckAvailabilityResponse); err != nil { + return NetAppResourceCheckQuotaAvailabilityResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// checkQuotaAvailabilityHandleError handles the CheckQuotaAvailability error response. +func (client *NetAppResourceClient) checkQuotaAvailabilityHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + if len(body) == 0 { + return runtime.NewResponseError(errors.New(resp.Status), resp) + } + return runtime.NewResponseError(errors.New(string(body)), resp) +} diff --git a/sdk/resourcemanager/netapp/armnetapp/zz_generated_netappresourcequotalimits_client.go b/sdk/resourcemanager/netapp/armnetapp/zz_generated_netappresourcequotalimits_client.go new file mode 100644 index 000000000000..9a17a1d95fc5 --- /dev/null +++ b/sdk/resourcemanager/netapp/armnetapp/zz_generated_netappresourcequotalimits_client.go @@ -0,0 +1,166 @@ +//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 armnetapp + +import ( + "context" + "errors" + "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" +) + +// NetAppResourceQuotaLimitsClient contains the methods for the NetAppResourceQuotaLimits group. +// Don't use this type directly, use NewNetAppResourceQuotaLimitsClient() instead. +type NetAppResourceQuotaLimitsClient struct { + ep string + pl runtime.Pipeline + subscriptionID string +} + +// NewNetAppResourceQuotaLimitsClient creates a new instance of NetAppResourceQuotaLimitsClient with the specified values. +func NewNetAppResourceQuotaLimitsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *NetAppResourceQuotaLimitsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &NetAppResourceQuotaLimitsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} +} + +// Get - Get the default and current subscription quota limit +// If the operation fails it returns a generic error. +func (client *NetAppResourceQuotaLimitsClient) Get(ctx context.Context, location string, quotaLimitName string, options *NetAppResourceQuotaLimitsGetOptions) (NetAppResourceQuotaLimitsGetResponse, error) { + req, err := client.getCreateRequest(ctx, location, quotaLimitName, options) + if err != nil { + return NetAppResourceQuotaLimitsGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return NetAppResourceQuotaLimitsGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return NetAppResourceQuotaLimitsGetResponse{}, client.getHandleError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *NetAppResourceQuotaLimitsClient) getCreateRequest(ctx context.Context, location string, quotaLimitName string, options *NetAppResourceQuotaLimitsGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.NetApp/locations/{location}/quotaLimits/{quotaLimitName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if location == "" { + return nil, errors.New("parameter location cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{location}", url.PathEscape(location)) + if quotaLimitName == "" { + return nil, errors.New("parameter quotaLimitName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{quotaLimitName}", url.PathEscape(quotaLimitName)) + 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", "2021-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *NetAppResourceQuotaLimitsClient) getHandleResponse(resp *http.Response) (NetAppResourceQuotaLimitsGetResponse, error) { + result := NetAppResourceQuotaLimitsGetResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.SubscriptionQuotaItem); err != nil { + return NetAppResourceQuotaLimitsGetResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// getHandleError handles the Get error response. +func (client *NetAppResourceQuotaLimitsClient) getHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + if len(body) == 0 { + return runtime.NewResponseError(errors.New(resp.Status), resp) + } + return runtime.NewResponseError(errors.New(string(body)), resp) +} + +// List - Get the default and current limits for quotas +// If the operation fails it returns a generic error. +func (client *NetAppResourceQuotaLimitsClient) List(ctx context.Context, location string, options *NetAppResourceQuotaLimitsListOptions) (NetAppResourceQuotaLimitsListResponse, error) { + req, err := client.listCreateRequest(ctx, location, options) + if err != nil { + return NetAppResourceQuotaLimitsListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return NetAppResourceQuotaLimitsListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return NetAppResourceQuotaLimitsListResponse{}, client.listHandleError(resp) + } + return client.listHandleResponse(resp) +} + +// listCreateRequest creates the List request. +func (client *NetAppResourceQuotaLimitsClient) listCreateRequest(ctx context.Context, location string, options *NetAppResourceQuotaLimitsListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.NetApp/locations/{location}/quotaLimits" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if location == "" { + return nil, errors.New("parameter location cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{location}", url.PathEscape(location)) + 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", "2021-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// listHandleResponse handles the List response. +func (client *NetAppResourceQuotaLimitsClient) listHandleResponse(resp *http.Response) (NetAppResourceQuotaLimitsListResponse, error) { + result := NetAppResourceQuotaLimitsListResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.SubscriptionQuotaItemList); err != nil { + return NetAppResourceQuotaLimitsListResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// listHandleError handles the List error response. +func (client *NetAppResourceQuotaLimitsClient) listHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + if len(body) == 0 { + return runtime.NewResponseError(errors.New(resp.Status), resp) + } + return runtime.NewResponseError(errors.New(string(body)), resp) +} diff --git a/sdk/resourcemanager/netapp/armnetapp/zz_generated_operations_client.go b/sdk/resourcemanager/netapp/armnetapp/zz_generated_operations_client.go new file mode 100644 index 000000000000..000541efe61b --- /dev/null +++ b/sdk/resourcemanager/netapp/armnetapp/zz_generated_operations_client.go @@ -0,0 +1,91 @@ +//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 armnetapp + +import ( + "context" + "errors" + "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 - Lists all of the available Microsoft.NetApp Rest API operations +// If the operation fails it returns a generic error. +func (client *OperationsClient) List(ctx context.Context, options *OperationsListOptions) (OperationsListResponse, error) { + req, err := client.listCreateRequest(ctx, options) + if err != nil { + return OperationsListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return OperationsListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return OperationsListResponse{}, client.listHandleError(resp) + } + return client.listHandleResponse(resp) +} + +// listCreateRequest creates the List request. +func (client *OperationsClient) listCreateRequest(ctx context.Context, options *OperationsListOptions) (*policy.Request, error) { + urlPath := "/providers/Microsoft.NetApp/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", "2021-08-01") + 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.OperationListResult); 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) + } + if len(body) == 0 { + return runtime.NewResponseError(errors.New(resp.Status), resp) + } + return runtime.NewResponseError(errors.New(string(body)), resp) +} diff --git a/sdk/resourcemanager/netapp/armnetapp/zz_generated_pagers.go b/sdk/resourcemanager/netapp/armnetapp/zz_generated_pagers.go new file mode 100644 index 000000000000..160d414492e0 --- /dev/null +++ b/sdk/resourcemanager/netapp/armnetapp/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 armnetapp + +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" +) + +// AccountsListBySubscriptionPager provides operations for iterating over paged responses. +type AccountsListBySubscriptionPager struct { + client *AccountsClient + current AccountsListBySubscriptionResponse + err error + requester func(context.Context) (*policy.Request, error) + advancer func(context.Context, AccountsListBySubscriptionResponse) (*policy.Request, error) +} + +// Err returns the last error encountered while paging. +func (p *AccountsListBySubscriptionPager) 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 *AccountsListBySubscriptionPager) NextPage(ctx context.Context) bool { + var req *policy.Request + var err error + if !reflect.ValueOf(p.current).IsZero() { + if p.current.NetAppAccountList.NextLink == nil || len(*p.current.NetAppAccountList.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 AccountsListBySubscriptionResponse page. +func (p *AccountsListBySubscriptionPager) PageResponse() AccountsListBySubscriptionResponse { + return p.current +} + +// AccountsListPager provides operations for iterating over paged responses. +type AccountsListPager struct { + client *AccountsClient + current AccountsListResponse + err error + requester func(context.Context) (*policy.Request, error) + advancer func(context.Context, AccountsListResponse) (*policy.Request, error) +} + +// Err returns the last error encountered while paging. +func (p *AccountsListPager) 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 *AccountsListPager) NextPage(ctx context.Context) bool { + var req *policy.Request + var err error + if !reflect.ValueOf(p.current).IsZero() { + if p.current.NetAppAccountList.NextLink == nil || len(*p.current.NetAppAccountList.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 AccountsListResponse page. +func (p *AccountsListPager) PageResponse() AccountsListResponse { + return p.current +} + +// PoolsListPager provides operations for iterating over paged responses. +type PoolsListPager struct { + client *PoolsClient + current PoolsListResponse + err error + requester func(context.Context) (*policy.Request, error) + advancer func(context.Context, PoolsListResponse) (*policy.Request, error) +} + +// Err returns the last error encountered while paging. +func (p *PoolsListPager) 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 *PoolsListPager) NextPage(ctx context.Context) bool { + var req *policy.Request + var err error + if !reflect.ValueOf(p.current).IsZero() { + if p.current.CapacityPoolList.NextLink == nil || len(*p.current.CapacityPoolList.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 PoolsListResponse page. +func (p *PoolsListPager) PageResponse() PoolsListResponse { + return p.current +} + +// VolumesListPager provides operations for iterating over paged responses. +type VolumesListPager struct { + client *VolumesClient + current VolumesListResponse + err error + requester func(context.Context) (*policy.Request, error) + advancer func(context.Context, VolumesListResponse) (*policy.Request, error) +} + +// Err returns the last error encountered while paging. +func (p *VolumesListPager) 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 *VolumesListPager) NextPage(ctx context.Context) bool { + var req *policy.Request + var err error + if !reflect.ValueOf(p.current).IsZero() { + if p.current.VolumeList.NextLink == nil || len(*p.current.VolumeList.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 VolumesListResponse page. +func (p *VolumesListPager) PageResponse() VolumesListResponse { + return p.current +} diff --git a/sdk/resourcemanager/netapp/armnetapp/zz_generated_pollers.go b/sdk/resourcemanager/netapp/armnetapp/zz_generated_pollers.go new file mode 100644 index 000000000000..cf63d0b04062 --- /dev/null +++ b/sdk/resourcemanager/netapp/armnetapp/zz_generated_pollers.go @@ -0,0 +1,1305 @@ +//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 armnetapp + +import ( + "context" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "net/http" +) + +// AccountBackupsDeletePoller provides polling facilities until the operation reaches a terminal state. +type AccountBackupsDeletePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *AccountBackupsDeletePoller) 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 *AccountBackupsDeletePoller) 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 AccountBackupsDeleteResponse will be returned. +func (p *AccountBackupsDeletePoller) FinalResponse(ctx context.Context) (AccountBackupsDeleteResponse, error) { + respType := AccountBackupsDeleteResponse{} + resp, err := p.pt.FinalResponse(ctx, nil) + if err != nil { + return AccountBackupsDeleteResponse{}, 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 *AccountBackupsDeletePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// AccountsCreateOrUpdatePoller provides polling facilities until the operation reaches a terminal state. +type AccountsCreateOrUpdatePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *AccountsCreateOrUpdatePoller) 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 *AccountsCreateOrUpdatePoller) 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 AccountsCreateOrUpdateResponse will be returned. +func (p *AccountsCreateOrUpdatePoller) FinalResponse(ctx context.Context) (AccountsCreateOrUpdateResponse, error) { + respType := AccountsCreateOrUpdateResponse{} + resp, err := p.pt.FinalResponse(ctx, &respType.NetAppAccount) + if err != nil { + return AccountsCreateOrUpdateResponse{}, 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 *AccountsCreateOrUpdatePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// AccountsDeletePoller provides polling facilities until the operation reaches a terminal state. +type AccountsDeletePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *AccountsDeletePoller) 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 *AccountsDeletePoller) 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 AccountsDeleteResponse will be returned. +func (p *AccountsDeletePoller) FinalResponse(ctx context.Context) (AccountsDeleteResponse, error) { + respType := AccountsDeleteResponse{} + resp, err := p.pt.FinalResponse(ctx, nil) + if err != nil { + return AccountsDeleteResponse{}, 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 *AccountsDeletePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// AccountsUpdatePoller provides polling facilities until the operation reaches a terminal state. +type AccountsUpdatePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *AccountsUpdatePoller) 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 *AccountsUpdatePoller) 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 AccountsUpdateResponse will be returned. +func (p *AccountsUpdatePoller) FinalResponse(ctx context.Context) (AccountsUpdateResponse, error) { + respType := AccountsUpdateResponse{} + resp, err := p.pt.FinalResponse(ctx, &respType.NetAppAccount) + if err != nil { + return AccountsUpdateResponse{}, 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 *AccountsUpdatePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// BackupPoliciesCreatePoller provides polling facilities until the operation reaches a terminal state. +type BackupPoliciesCreatePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *BackupPoliciesCreatePoller) 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 *BackupPoliciesCreatePoller) 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 BackupPoliciesCreateResponse will be returned. +func (p *BackupPoliciesCreatePoller) FinalResponse(ctx context.Context) (BackupPoliciesCreateResponse, error) { + respType := BackupPoliciesCreateResponse{} + resp, err := p.pt.FinalResponse(ctx, &respType.BackupPolicy) + if err != nil { + return BackupPoliciesCreateResponse{}, 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 *BackupPoliciesCreatePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// BackupPoliciesDeletePoller provides polling facilities until the operation reaches a terminal state. +type BackupPoliciesDeletePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *BackupPoliciesDeletePoller) 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 *BackupPoliciesDeletePoller) 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 BackupPoliciesDeleteResponse will be returned. +func (p *BackupPoliciesDeletePoller) FinalResponse(ctx context.Context) (BackupPoliciesDeleteResponse, error) { + respType := BackupPoliciesDeleteResponse{} + resp, err := p.pt.FinalResponse(ctx, nil) + if err != nil { + return BackupPoliciesDeleteResponse{}, 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 *BackupPoliciesDeletePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// BackupPoliciesUpdatePoller provides polling facilities until the operation reaches a terminal state. +type BackupPoliciesUpdatePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *BackupPoliciesUpdatePoller) 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 *BackupPoliciesUpdatePoller) 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 BackupPoliciesUpdateResponse will be returned. +func (p *BackupPoliciesUpdatePoller) FinalResponse(ctx context.Context) (BackupPoliciesUpdateResponse, error) { + respType := BackupPoliciesUpdateResponse{} + resp, err := p.pt.FinalResponse(ctx, &respType.BackupPolicy) + if err != nil { + return BackupPoliciesUpdateResponse{}, 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 *BackupPoliciesUpdatePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// BackupsCreatePoller provides polling facilities until the operation reaches a terminal state. +type BackupsCreatePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *BackupsCreatePoller) 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 *BackupsCreatePoller) 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 BackupsCreateResponse will be returned. +func (p *BackupsCreatePoller) FinalResponse(ctx context.Context) (BackupsCreateResponse, error) { + respType := BackupsCreateResponse{} + resp, err := p.pt.FinalResponse(ctx, &respType.Backup) + if err != nil { + return BackupsCreateResponse{}, 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 *BackupsCreatePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// BackupsDeletePoller provides polling facilities until the operation reaches a terminal state. +type BackupsDeletePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *BackupsDeletePoller) 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 *BackupsDeletePoller) 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 BackupsDeleteResponse will be returned. +func (p *BackupsDeletePoller) FinalResponse(ctx context.Context) (BackupsDeleteResponse, error) { + respType := BackupsDeleteResponse{} + resp, err := p.pt.FinalResponse(ctx, nil) + if err != nil { + return BackupsDeleteResponse{}, 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 *BackupsDeletePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// BackupsUpdatePoller provides polling facilities until the operation reaches a terminal state. +type BackupsUpdatePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *BackupsUpdatePoller) 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 *BackupsUpdatePoller) 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 BackupsUpdateResponse will be returned. +func (p *BackupsUpdatePoller) FinalResponse(ctx context.Context) (BackupsUpdateResponse, error) { + respType := BackupsUpdateResponse{} + resp, err := p.pt.FinalResponse(ctx, &respType.Backup) + if err != nil { + return BackupsUpdateResponse{}, 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 *BackupsUpdatePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// PoolsCreateOrUpdatePoller provides polling facilities until the operation reaches a terminal state. +type PoolsCreateOrUpdatePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *PoolsCreateOrUpdatePoller) 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 *PoolsCreateOrUpdatePoller) 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 PoolsCreateOrUpdateResponse will be returned. +func (p *PoolsCreateOrUpdatePoller) FinalResponse(ctx context.Context) (PoolsCreateOrUpdateResponse, error) { + respType := PoolsCreateOrUpdateResponse{} + resp, err := p.pt.FinalResponse(ctx, &respType.CapacityPool) + if err != nil { + return PoolsCreateOrUpdateResponse{}, 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 *PoolsCreateOrUpdatePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// PoolsDeletePoller provides polling facilities until the operation reaches a terminal state. +type PoolsDeletePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *PoolsDeletePoller) 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 *PoolsDeletePoller) 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 PoolsDeleteResponse will be returned. +func (p *PoolsDeletePoller) FinalResponse(ctx context.Context) (PoolsDeleteResponse, error) { + respType := PoolsDeleteResponse{} + resp, err := p.pt.FinalResponse(ctx, nil) + if err != nil { + return PoolsDeleteResponse{}, 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 *PoolsDeletePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// PoolsUpdatePoller provides polling facilities until the operation reaches a terminal state. +type PoolsUpdatePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *PoolsUpdatePoller) 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 *PoolsUpdatePoller) 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 PoolsUpdateResponse will be returned. +func (p *PoolsUpdatePoller) FinalResponse(ctx context.Context) (PoolsUpdateResponse, error) { + respType := PoolsUpdateResponse{} + resp, err := p.pt.FinalResponse(ctx, &respType.CapacityPool) + if err != nil { + return PoolsUpdateResponse{}, 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 *PoolsUpdatePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// SnapshotPoliciesDeletePoller provides polling facilities until the operation reaches a terminal state. +type SnapshotPoliciesDeletePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *SnapshotPoliciesDeletePoller) 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 *SnapshotPoliciesDeletePoller) 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 SnapshotPoliciesDeleteResponse will be returned. +func (p *SnapshotPoliciesDeletePoller) FinalResponse(ctx context.Context) (SnapshotPoliciesDeleteResponse, error) { + respType := SnapshotPoliciesDeleteResponse{} + resp, err := p.pt.FinalResponse(ctx, nil) + if err != nil { + return SnapshotPoliciesDeleteResponse{}, 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 *SnapshotPoliciesDeletePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// SnapshotPoliciesUpdatePoller provides polling facilities until the operation reaches a terminal state. +type SnapshotPoliciesUpdatePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *SnapshotPoliciesUpdatePoller) 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 *SnapshotPoliciesUpdatePoller) 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 SnapshotPoliciesUpdateResponse will be returned. +func (p *SnapshotPoliciesUpdatePoller) FinalResponse(ctx context.Context) (SnapshotPoliciesUpdateResponse, error) { + respType := SnapshotPoliciesUpdateResponse{} + resp, err := p.pt.FinalResponse(ctx, &respType.SnapshotPolicy) + if err != nil { + return SnapshotPoliciesUpdateResponse{}, 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 *SnapshotPoliciesUpdatePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// SnapshotsCreatePoller provides polling facilities until the operation reaches a terminal state. +type SnapshotsCreatePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *SnapshotsCreatePoller) 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 *SnapshotsCreatePoller) 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 SnapshotsCreateResponse will be returned. +func (p *SnapshotsCreatePoller) FinalResponse(ctx context.Context) (SnapshotsCreateResponse, error) { + respType := SnapshotsCreateResponse{} + resp, err := p.pt.FinalResponse(ctx, &respType.Snapshot) + if err != nil { + return SnapshotsCreateResponse{}, 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 *SnapshotsCreatePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// SnapshotsDeletePoller provides polling facilities until the operation reaches a terminal state. +type SnapshotsDeletePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *SnapshotsDeletePoller) 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 *SnapshotsDeletePoller) 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 SnapshotsDeleteResponse will be returned. +func (p *SnapshotsDeletePoller) FinalResponse(ctx context.Context) (SnapshotsDeleteResponse, error) { + respType := SnapshotsDeleteResponse{} + resp, err := p.pt.FinalResponse(ctx, nil) + if err != nil { + return SnapshotsDeleteResponse{}, 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 *SnapshotsDeletePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// SnapshotsUpdatePoller provides polling facilities until the operation reaches a terminal state. +type SnapshotsUpdatePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *SnapshotsUpdatePoller) 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 *SnapshotsUpdatePoller) 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 SnapshotsUpdateResponse will be returned. +func (p *SnapshotsUpdatePoller) FinalResponse(ctx context.Context) (SnapshotsUpdateResponse, error) { + respType := SnapshotsUpdateResponse{} + resp, err := p.pt.FinalResponse(ctx, &respType.Snapshot) + if err != nil { + return SnapshotsUpdateResponse{}, 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 *SnapshotsUpdatePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// VolumeGroupsCreatePoller provides polling facilities until the operation reaches a terminal state. +type VolumeGroupsCreatePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *VolumeGroupsCreatePoller) 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 *VolumeGroupsCreatePoller) 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 VolumeGroupsCreateResponse will be returned. +func (p *VolumeGroupsCreatePoller) FinalResponse(ctx context.Context) (VolumeGroupsCreateResponse, error) { + respType := VolumeGroupsCreateResponse{} + resp, err := p.pt.FinalResponse(ctx, &respType.VolumeGroupDetails) + if err != nil { + return VolumeGroupsCreateResponse{}, 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 *VolumeGroupsCreatePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// VolumeGroupsDeletePoller provides polling facilities until the operation reaches a terminal state. +type VolumeGroupsDeletePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *VolumeGroupsDeletePoller) 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 *VolumeGroupsDeletePoller) 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 VolumeGroupsDeleteResponse will be returned. +func (p *VolumeGroupsDeletePoller) FinalResponse(ctx context.Context) (VolumeGroupsDeleteResponse, error) { + respType := VolumeGroupsDeleteResponse{} + resp, err := p.pt.FinalResponse(ctx, nil) + if err != nil { + return VolumeGroupsDeleteResponse{}, 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 *VolumeGroupsDeletePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// VolumesAuthorizeReplicationPoller provides polling facilities until the operation reaches a terminal state. +type VolumesAuthorizeReplicationPoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *VolumesAuthorizeReplicationPoller) 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 *VolumesAuthorizeReplicationPoller) 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 VolumesAuthorizeReplicationResponse will be returned. +func (p *VolumesAuthorizeReplicationPoller) FinalResponse(ctx context.Context) (VolumesAuthorizeReplicationResponse, error) { + respType := VolumesAuthorizeReplicationResponse{} + resp, err := p.pt.FinalResponse(ctx, nil) + if err != nil { + return VolumesAuthorizeReplicationResponse{}, 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 *VolumesAuthorizeReplicationPoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// VolumesBreakReplicationPoller provides polling facilities until the operation reaches a terminal state. +type VolumesBreakReplicationPoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *VolumesBreakReplicationPoller) 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 *VolumesBreakReplicationPoller) 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 VolumesBreakReplicationResponse will be returned. +func (p *VolumesBreakReplicationPoller) FinalResponse(ctx context.Context) (VolumesBreakReplicationResponse, error) { + respType := VolumesBreakReplicationResponse{} + resp, err := p.pt.FinalResponse(ctx, nil) + if err != nil { + return VolumesBreakReplicationResponse{}, 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 *VolumesBreakReplicationPoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// VolumesCreateOrUpdatePoller provides polling facilities until the operation reaches a terminal state. +type VolumesCreateOrUpdatePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *VolumesCreateOrUpdatePoller) 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 *VolumesCreateOrUpdatePoller) 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 VolumesCreateOrUpdateResponse will be returned. +func (p *VolumesCreateOrUpdatePoller) FinalResponse(ctx context.Context) (VolumesCreateOrUpdateResponse, error) { + respType := VolumesCreateOrUpdateResponse{} + resp, err := p.pt.FinalResponse(ctx, &respType.Volume) + if err != nil { + return VolumesCreateOrUpdateResponse{}, 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 *VolumesCreateOrUpdatePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// VolumesDeletePoller provides polling facilities until the operation reaches a terminal state. +type VolumesDeletePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *VolumesDeletePoller) 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 *VolumesDeletePoller) 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 VolumesDeleteResponse will be returned. +func (p *VolumesDeletePoller) FinalResponse(ctx context.Context) (VolumesDeleteResponse, error) { + respType := VolumesDeleteResponse{} + resp, err := p.pt.FinalResponse(ctx, nil) + if err != nil { + return VolumesDeleteResponse{}, 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 *VolumesDeletePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// VolumesDeleteReplicationPoller provides polling facilities until the operation reaches a terminal state. +type VolumesDeleteReplicationPoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *VolumesDeleteReplicationPoller) 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 *VolumesDeleteReplicationPoller) 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 VolumesDeleteReplicationResponse will be returned. +func (p *VolumesDeleteReplicationPoller) FinalResponse(ctx context.Context) (VolumesDeleteReplicationResponse, error) { + respType := VolumesDeleteReplicationResponse{} + resp, err := p.pt.FinalResponse(ctx, nil) + if err != nil { + return VolumesDeleteReplicationResponse{}, 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 *VolumesDeleteReplicationPoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// VolumesPoolChangePoller provides polling facilities until the operation reaches a terminal state. +type VolumesPoolChangePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *VolumesPoolChangePoller) 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 *VolumesPoolChangePoller) 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 VolumesPoolChangeResponse will be returned. +func (p *VolumesPoolChangePoller) FinalResponse(ctx context.Context) (VolumesPoolChangeResponse, error) { + respType := VolumesPoolChangeResponse{} + resp, err := p.pt.FinalResponse(ctx, nil) + if err != nil { + return VolumesPoolChangeResponse{}, 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 *VolumesPoolChangePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// VolumesReInitializeReplicationPoller provides polling facilities until the operation reaches a terminal state. +type VolumesReInitializeReplicationPoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *VolumesReInitializeReplicationPoller) 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 *VolumesReInitializeReplicationPoller) 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 VolumesReInitializeReplicationResponse will be returned. +func (p *VolumesReInitializeReplicationPoller) FinalResponse(ctx context.Context) (VolumesReInitializeReplicationResponse, error) { + respType := VolumesReInitializeReplicationResponse{} + resp, err := p.pt.FinalResponse(ctx, nil) + if err != nil { + return VolumesReInitializeReplicationResponse{}, 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 *VolumesReInitializeReplicationPoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// VolumesResyncReplicationPoller provides polling facilities until the operation reaches a terminal state. +type VolumesResyncReplicationPoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *VolumesResyncReplicationPoller) 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 *VolumesResyncReplicationPoller) 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 VolumesResyncReplicationResponse will be returned. +func (p *VolumesResyncReplicationPoller) FinalResponse(ctx context.Context) (VolumesResyncReplicationResponse, error) { + respType := VolumesResyncReplicationResponse{} + resp, err := p.pt.FinalResponse(ctx, nil) + if err != nil { + return VolumesResyncReplicationResponse{}, 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 *VolumesResyncReplicationPoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// VolumesRevertPoller provides polling facilities until the operation reaches a terminal state. +type VolumesRevertPoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *VolumesRevertPoller) 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 *VolumesRevertPoller) 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 VolumesRevertResponse will be returned. +func (p *VolumesRevertPoller) FinalResponse(ctx context.Context) (VolumesRevertResponse, error) { + respType := VolumesRevertResponse{} + resp, err := p.pt.FinalResponse(ctx, nil) + if err != nil { + return VolumesRevertResponse{}, 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 *VolumesRevertPoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// VolumesUpdatePoller provides polling facilities until the operation reaches a terminal state. +type VolumesUpdatePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *VolumesUpdatePoller) 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 *VolumesUpdatePoller) 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 VolumesUpdateResponse will be returned. +func (p *VolumesUpdatePoller) FinalResponse(ctx context.Context) (VolumesUpdateResponse, error) { + respType := VolumesUpdateResponse{} + resp, err := p.pt.FinalResponse(ctx, &respType.Volume) + if err != nil { + return VolumesUpdateResponse{}, 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 *VolumesUpdatePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} diff --git a/sdk/resourcemanager/netapp/armnetapp/zz_generated_pools_client.go b/sdk/resourcemanager/netapp/armnetapp/zz_generated_pools_client.go new file mode 100644 index 000000000000..8f53e0e7e7f0 --- /dev/null +++ b/sdk/resourcemanager/netapp/armnetapp/zz_generated_pools_client.go @@ -0,0 +1,407 @@ +//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 armnetapp + +import ( + "context" + "errors" + "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" +) + +// PoolsClient contains the methods for the Pools group. +// Don't use this type directly, use NewPoolsClient() instead. +type PoolsClient struct { + ep string + pl runtime.Pipeline + subscriptionID string +} + +// NewPoolsClient creates a new instance of PoolsClient with the specified values. +func NewPoolsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *PoolsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &PoolsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} +} + +// BeginCreateOrUpdate - Create or Update a capacity pool +// If the operation fails it returns a generic error. +func (client *PoolsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, accountName string, poolName string, body CapacityPool, options *PoolsBeginCreateOrUpdateOptions) (PoolsCreateOrUpdatePollerResponse, error) { + resp, err := client.createOrUpdate(ctx, resourceGroupName, accountName, poolName, body, options) + if err != nil { + return PoolsCreateOrUpdatePollerResponse{}, err + } + result := PoolsCreateOrUpdatePollerResponse{ + RawResponse: resp, + } + pt, err := armruntime.NewPoller("PoolsClient.CreateOrUpdate", "location", resp, client.pl, client.createOrUpdateHandleError) + if err != nil { + return PoolsCreateOrUpdatePollerResponse{}, err + } + result.Poller = &PoolsCreateOrUpdatePoller{ + pt: pt, + } + return result, nil +} + +// CreateOrUpdate - Create or Update a capacity pool +// If the operation fails it returns a generic error. +func (client *PoolsClient) createOrUpdate(ctx context.Context, resourceGroupName string, accountName string, poolName string, body CapacityPool, options *PoolsBeginCreateOrUpdateOptions) (*http.Response, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, accountName, poolName, body, 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 *PoolsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, accountName string, poolName string, body CapacityPool, options *PoolsBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}" + 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 accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if poolName == "" { + return nil, errors.New("parameter poolName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{poolName}", url.PathEscape(poolName)) + 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", "2021-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, runtime.MarshalAsJSON(req, body) +} + +// createOrUpdateHandleError handles the CreateOrUpdate error response. +func (client *PoolsClient) createOrUpdateHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + if len(body) == 0 { + return runtime.NewResponseError(errors.New(resp.Status), resp) + } + return runtime.NewResponseError(errors.New(string(body)), resp) +} + +// BeginDelete - Delete the specified capacity pool +// If the operation fails it returns a generic error. +func (client *PoolsClient) BeginDelete(ctx context.Context, resourceGroupName string, accountName string, poolName string, options *PoolsBeginDeleteOptions) (PoolsDeletePollerResponse, error) { + resp, err := client.deleteOperation(ctx, resourceGroupName, accountName, poolName, options) + if err != nil { + return PoolsDeletePollerResponse{}, err + } + result := PoolsDeletePollerResponse{ + RawResponse: resp, + } + pt, err := armruntime.NewPoller("PoolsClient.Delete", "location", resp, client.pl, client.deleteHandleError) + if err != nil { + return PoolsDeletePollerResponse{}, err + } + result.Poller = &PoolsDeletePoller{ + pt: pt, + } + return result, nil +} + +// Delete - Delete the specified capacity pool +// If the operation fails it returns a generic error. +func (client *PoolsClient) deleteOperation(ctx context.Context, resourceGroupName string, accountName string, poolName string, options *PoolsBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, accountName, poolName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusAccepted, http.StatusNoContent) { + return nil, client.deleteHandleError(resp) + } + return resp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *PoolsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, accountName string, poolName string, options *PoolsBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}" + 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 accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if poolName == "" { + return nil, errors.New("parameter poolName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{poolName}", url.PathEscape(poolName)) + 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", "2021-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + return req, nil +} + +// deleteHandleError handles the Delete error response. +func (client *PoolsClient) deleteHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + if len(body) == 0 { + return runtime.NewResponseError(errors.New(resp.Status), resp) + } + return runtime.NewResponseError(errors.New(string(body)), resp) +} + +// Get - Get details of the specified capacity pool +// If the operation fails it returns a generic error. +func (client *PoolsClient) Get(ctx context.Context, resourceGroupName string, accountName string, poolName string, options *PoolsGetOptions) (PoolsGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, accountName, poolName, options) + if err != nil { + return PoolsGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return PoolsGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return PoolsGetResponse{}, client.getHandleError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *PoolsClient) getCreateRequest(ctx context.Context, resourceGroupName string, accountName string, poolName string, options *PoolsGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}" + 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 accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if poolName == "" { + return nil, errors.New("parameter poolName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{poolName}", url.PathEscape(poolName)) + 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", "2021-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *PoolsClient) getHandleResponse(resp *http.Response) (PoolsGetResponse, error) { + result := PoolsGetResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.CapacityPool); err != nil { + return PoolsGetResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// getHandleError handles the Get error response. +func (client *PoolsClient) getHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + if len(body) == 0 { + return runtime.NewResponseError(errors.New(resp.Status), resp) + } + return runtime.NewResponseError(errors.New(string(body)), resp) +} + +// List - List all capacity pools in the NetApp Account +// If the operation fails it returns a generic error. +func (client *PoolsClient) List(resourceGroupName string, accountName string, options *PoolsListOptions) *PoolsListPager { + return &PoolsListPager{ + client: client, + requester: func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, resourceGroupName, accountName, options) + }, + advancer: func(ctx context.Context, resp PoolsListResponse) (*policy.Request, error) { + return runtime.NewRequest(ctx, http.MethodGet, *resp.CapacityPoolList.NextLink) + }, + } +} + +// listCreateRequest creates the List request. +func (client *PoolsClient) listCreateRequest(ctx context.Context, resourceGroupName string, accountName string, options *PoolsListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools" + 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 accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + 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", "2021-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// listHandleResponse handles the List response. +func (client *PoolsClient) listHandleResponse(resp *http.Response) (PoolsListResponse, error) { + result := PoolsListResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.CapacityPoolList); err != nil { + return PoolsListResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// listHandleError handles the List error response. +func (client *PoolsClient) listHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + if len(body) == 0 { + return runtime.NewResponseError(errors.New(resp.Status), resp) + } + return runtime.NewResponseError(errors.New(string(body)), resp) +} + +// BeginUpdate - Patch the specified capacity pool +// If the operation fails it returns a generic error. +func (client *PoolsClient) BeginUpdate(ctx context.Context, resourceGroupName string, accountName string, poolName string, body CapacityPoolPatch, options *PoolsBeginUpdateOptions) (PoolsUpdatePollerResponse, error) { + resp, err := client.update(ctx, resourceGroupName, accountName, poolName, body, options) + if err != nil { + return PoolsUpdatePollerResponse{}, err + } + result := PoolsUpdatePollerResponse{ + RawResponse: resp, + } + pt, err := armruntime.NewPoller("PoolsClient.Update", "location", resp, client.pl, client.updateHandleError) + if err != nil { + return PoolsUpdatePollerResponse{}, err + } + result.Poller = &PoolsUpdatePoller{ + pt: pt, + } + return result, nil +} + +// Update - Patch the specified capacity pool +// If the operation fails it returns a generic error. +func (client *PoolsClient) update(ctx context.Context, resourceGroupName string, accountName string, poolName string, body CapacityPoolPatch, options *PoolsBeginUpdateOptions) (*http.Response, error) { + req, err := client.updateCreateRequest(ctx, resourceGroupName, accountName, poolName, body, 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) { + return nil, client.updateHandleError(resp) + } + return resp, nil +} + +// updateCreateRequest creates the Update request. +func (client *PoolsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, accountName string, poolName string, body CapacityPoolPatch, options *PoolsBeginUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}" + 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 accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if poolName == "" { + return nil, errors.New("parameter poolName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{poolName}", url.PathEscape(poolName)) + 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", "2021-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, runtime.MarshalAsJSON(req, body) +} + +// updateHandleError handles the Update error response. +func (client *PoolsClient) updateHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + if len(body) == 0 { + return runtime.NewResponseError(errors.New(resp.Status), resp) + } + return runtime.NewResponseError(errors.New(string(body)), resp) +} diff --git a/sdk/resourcemanager/netapp/armnetapp/zz_generated_response_types.go b/sdk/resourcemanager/netapp/armnetapp/zz_generated_response_types.go new file mode 100644 index 000000000000..49b99a1c6f34 --- /dev/null +++ b/sdk/resourcemanager/netapp/armnetapp/zz_generated_response_types.go @@ -0,0 +1,1852 @@ +//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 armnetapp + +import ( + "context" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "net/http" + "time" +) + +// AccountBackupsDeletePollerResponse contains the response from method AccountBackups.Delete. +type AccountBackupsDeletePollerResponse struct { + // Poller contains an initialized poller. + Poller *AccountBackupsDeletePoller + + // 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 AccountBackupsDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (AccountBackupsDeleteResponse, error) { + respType := AccountBackupsDeleteResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a AccountBackupsDeletePollerResponse from the provided client and resume token. +func (l *AccountBackupsDeletePollerResponse) Resume(ctx context.Context, client *AccountBackupsClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("AccountBackupsClient.Delete", token, client.pl, client.deleteHandleError) + if err != nil { + return err + } + poller := &AccountBackupsDeletePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// AccountBackupsDeleteResponse contains the response from method AccountBackups.Delete. +type AccountBackupsDeleteResponse struct { + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// AccountBackupsGetResponse contains the response from method AccountBackups.Get. +type AccountBackupsGetResponse struct { + AccountBackupsGetResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// AccountBackupsGetResult contains the result from method AccountBackups.Get. +type AccountBackupsGetResult struct { + Backup +} + +// AccountBackupsListResponse contains the response from method AccountBackups.List. +type AccountBackupsListResponse struct { + AccountBackupsListResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// AccountBackupsListResult contains the result from method AccountBackups.List. +type AccountBackupsListResult struct { + BackupsList +} + +// AccountsCreateOrUpdatePollerResponse contains the response from method Accounts.CreateOrUpdate. +type AccountsCreateOrUpdatePollerResponse struct { + // Poller contains an initialized poller. + Poller *AccountsCreateOrUpdatePoller + + // 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 AccountsCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (AccountsCreateOrUpdateResponse, error) { + respType := AccountsCreateOrUpdateResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.NetAppAccount) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a AccountsCreateOrUpdatePollerResponse from the provided client and resume token. +func (l *AccountsCreateOrUpdatePollerResponse) Resume(ctx context.Context, client *AccountsClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("AccountsClient.CreateOrUpdate", token, client.pl, client.createOrUpdateHandleError) + if err != nil { + return err + } + poller := &AccountsCreateOrUpdatePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// AccountsCreateOrUpdateResponse contains the response from method Accounts.CreateOrUpdate. +type AccountsCreateOrUpdateResponse struct { + AccountsCreateOrUpdateResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// AccountsCreateOrUpdateResult contains the result from method Accounts.CreateOrUpdate. +type AccountsCreateOrUpdateResult struct { + NetAppAccount +} + +// AccountsDeletePollerResponse contains the response from method Accounts.Delete. +type AccountsDeletePollerResponse struct { + // Poller contains an initialized poller. + Poller *AccountsDeletePoller + + // 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 AccountsDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (AccountsDeleteResponse, error) { + respType := AccountsDeleteResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a AccountsDeletePollerResponse from the provided client and resume token. +func (l *AccountsDeletePollerResponse) Resume(ctx context.Context, client *AccountsClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("AccountsClient.Delete", token, client.pl, client.deleteHandleError) + if err != nil { + return err + } + poller := &AccountsDeletePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// AccountsDeleteResponse contains the response from method Accounts.Delete. +type AccountsDeleteResponse struct { + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// AccountsGetResponse contains the response from method Accounts.Get. +type AccountsGetResponse struct { + AccountsGetResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// AccountsGetResult contains the result from method Accounts.Get. +type AccountsGetResult struct { + NetAppAccount +} + +// AccountsListBySubscriptionResponse contains the response from method Accounts.ListBySubscription. +type AccountsListBySubscriptionResponse struct { + AccountsListBySubscriptionResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// AccountsListBySubscriptionResult contains the result from method Accounts.ListBySubscription. +type AccountsListBySubscriptionResult struct { + NetAppAccountList +} + +// AccountsListResponse contains the response from method Accounts.List. +type AccountsListResponse struct { + AccountsListResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// AccountsListResult contains the result from method Accounts.List. +type AccountsListResult struct { + NetAppAccountList +} + +// AccountsUpdatePollerResponse contains the response from method Accounts.Update. +type AccountsUpdatePollerResponse struct { + // Poller contains an initialized poller. + Poller *AccountsUpdatePoller + + // 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 AccountsUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (AccountsUpdateResponse, error) { + respType := AccountsUpdateResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.NetAppAccount) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a AccountsUpdatePollerResponse from the provided client and resume token. +func (l *AccountsUpdatePollerResponse) Resume(ctx context.Context, client *AccountsClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("AccountsClient.Update", token, client.pl, client.updateHandleError) + if err != nil { + return err + } + poller := &AccountsUpdatePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// AccountsUpdateResponse contains the response from method Accounts.Update. +type AccountsUpdateResponse struct { + AccountsUpdateResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// AccountsUpdateResult contains the result from method Accounts.Update. +type AccountsUpdateResult struct { + NetAppAccount +} + +// BackupPoliciesCreatePollerResponse contains the response from method BackupPolicies.Create. +type BackupPoliciesCreatePollerResponse struct { + // Poller contains an initialized poller. + Poller *BackupPoliciesCreatePoller + + // 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 BackupPoliciesCreatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (BackupPoliciesCreateResponse, error) { + respType := BackupPoliciesCreateResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.BackupPolicy) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a BackupPoliciesCreatePollerResponse from the provided client and resume token. +func (l *BackupPoliciesCreatePollerResponse) Resume(ctx context.Context, client *BackupPoliciesClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("BackupPoliciesClient.Create", token, client.pl, client.createHandleError) + if err != nil { + return err + } + poller := &BackupPoliciesCreatePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// BackupPoliciesCreateResponse contains the response from method BackupPolicies.Create. +type BackupPoliciesCreateResponse struct { + BackupPoliciesCreateResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// BackupPoliciesCreateResult contains the result from method BackupPolicies.Create. +type BackupPoliciesCreateResult struct { + BackupPolicy +} + +// BackupPoliciesDeletePollerResponse contains the response from method BackupPolicies.Delete. +type BackupPoliciesDeletePollerResponse struct { + // Poller contains an initialized poller. + Poller *BackupPoliciesDeletePoller + + // 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 BackupPoliciesDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (BackupPoliciesDeleteResponse, error) { + respType := BackupPoliciesDeleteResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a BackupPoliciesDeletePollerResponse from the provided client and resume token. +func (l *BackupPoliciesDeletePollerResponse) Resume(ctx context.Context, client *BackupPoliciesClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("BackupPoliciesClient.Delete", token, client.pl, client.deleteHandleError) + if err != nil { + return err + } + poller := &BackupPoliciesDeletePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// BackupPoliciesDeleteResponse contains the response from method BackupPolicies.Delete. +type BackupPoliciesDeleteResponse struct { + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// BackupPoliciesGetResponse contains the response from method BackupPolicies.Get. +type BackupPoliciesGetResponse struct { + BackupPoliciesGetResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// BackupPoliciesGetResult contains the result from method BackupPolicies.Get. +type BackupPoliciesGetResult struct { + BackupPolicy +} + +// BackupPoliciesListResponse contains the response from method BackupPolicies.List. +type BackupPoliciesListResponse struct { + BackupPoliciesListResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// BackupPoliciesListResult contains the result from method BackupPolicies.List. +type BackupPoliciesListResult struct { + BackupPoliciesList +} + +// BackupPoliciesUpdatePollerResponse contains the response from method BackupPolicies.Update. +type BackupPoliciesUpdatePollerResponse struct { + // Poller contains an initialized poller. + Poller *BackupPoliciesUpdatePoller + + // 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 BackupPoliciesUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (BackupPoliciesUpdateResponse, error) { + respType := BackupPoliciesUpdateResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.BackupPolicy) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a BackupPoliciesUpdatePollerResponse from the provided client and resume token. +func (l *BackupPoliciesUpdatePollerResponse) Resume(ctx context.Context, client *BackupPoliciesClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("BackupPoliciesClient.Update", token, client.pl, client.updateHandleError) + if err != nil { + return err + } + poller := &BackupPoliciesUpdatePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// BackupPoliciesUpdateResponse contains the response from method BackupPolicies.Update. +type BackupPoliciesUpdateResponse struct { + BackupPoliciesUpdateResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// BackupPoliciesUpdateResult contains the result from method BackupPolicies.Update. +type BackupPoliciesUpdateResult struct { + BackupPolicy +} + +// BackupsCreatePollerResponse contains the response from method Backups.Create. +type BackupsCreatePollerResponse struct { + // Poller contains an initialized poller. + Poller *BackupsCreatePoller + + // 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 BackupsCreatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (BackupsCreateResponse, error) { + respType := BackupsCreateResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.Backup) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a BackupsCreatePollerResponse from the provided client and resume token. +func (l *BackupsCreatePollerResponse) Resume(ctx context.Context, client *BackupsClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("BackupsClient.Create", token, client.pl, client.createHandleError) + if err != nil { + return err + } + poller := &BackupsCreatePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// BackupsCreateResponse contains the response from method Backups.Create. +type BackupsCreateResponse struct { + BackupsCreateResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// BackupsCreateResult contains the result from method Backups.Create. +type BackupsCreateResult struct { + Backup +} + +// BackupsDeletePollerResponse contains the response from method Backups.Delete. +type BackupsDeletePollerResponse struct { + // Poller contains an initialized poller. + Poller *BackupsDeletePoller + + // 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 BackupsDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (BackupsDeleteResponse, error) { + respType := BackupsDeleteResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a BackupsDeletePollerResponse from the provided client and resume token. +func (l *BackupsDeletePollerResponse) Resume(ctx context.Context, client *BackupsClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("BackupsClient.Delete", token, client.pl, client.deleteHandleError) + if err != nil { + return err + } + poller := &BackupsDeletePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// BackupsDeleteResponse contains the response from method Backups.Delete. +type BackupsDeleteResponse struct { + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// BackupsGetResponse contains the response from method Backups.Get. +type BackupsGetResponse struct { + BackupsGetResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// BackupsGetResult contains the result from method Backups.Get. +type BackupsGetResult struct { + Backup +} + +// BackupsGetStatusResponse contains the response from method Backups.GetStatus. +type BackupsGetStatusResponse struct { + BackupsGetStatusResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// BackupsGetStatusResult contains the result from method Backups.GetStatus. +type BackupsGetStatusResult struct { + BackupStatus +} + +// BackupsGetVolumeRestoreStatusResponse contains the response from method Backups.GetVolumeRestoreStatus. +type BackupsGetVolumeRestoreStatusResponse struct { + BackupsGetVolumeRestoreStatusResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// BackupsGetVolumeRestoreStatusResult contains the result from method Backups.GetVolumeRestoreStatus. +type BackupsGetVolumeRestoreStatusResult struct { + RestoreStatus +} + +// BackupsListResponse contains the response from method Backups.List. +type BackupsListResponse struct { + BackupsListResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// BackupsListResult contains the result from method Backups.List. +type BackupsListResult struct { + BackupsList +} + +// BackupsUpdatePollerResponse contains the response from method Backups.Update. +type BackupsUpdatePollerResponse struct { + // Poller contains an initialized poller. + Poller *BackupsUpdatePoller + + // 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 BackupsUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (BackupsUpdateResponse, error) { + respType := BackupsUpdateResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.Backup) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a BackupsUpdatePollerResponse from the provided client and resume token. +func (l *BackupsUpdatePollerResponse) Resume(ctx context.Context, client *BackupsClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("BackupsClient.Update", token, client.pl, client.updateHandleError) + if err != nil { + return err + } + poller := &BackupsUpdatePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// BackupsUpdateResponse contains the response from method Backups.Update. +type BackupsUpdateResponse struct { + BackupsUpdateResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// BackupsUpdateResult contains the result from method Backups.Update. +type BackupsUpdateResult struct { + Backup +} + +// NetAppResourceCheckFilePathAvailabilityResponse contains the response from method NetAppResource.CheckFilePathAvailability. +type NetAppResourceCheckFilePathAvailabilityResponse struct { + NetAppResourceCheckFilePathAvailabilityResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// NetAppResourceCheckFilePathAvailabilityResult contains the result from method NetAppResource.CheckFilePathAvailability. +type NetAppResourceCheckFilePathAvailabilityResult struct { + CheckAvailabilityResponse +} + +// NetAppResourceCheckNameAvailabilityResponse contains the response from method NetAppResource.CheckNameAvailability. +type NetAppResourceCheckNameAvailabilityResponse struct { + NetAppResourceCheckNameAvailabilityResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// NetAppResourceCheckNameAvailabilityResult contains the result from method NetAppResource.CheckNameAvailability. +type NetAppResourceCheckNameAvailabilityResult struct { + CheckAvailabilityResponse +} + +// NetAppResourceCheckQuotaAvailabilityResponse contains the response from method NetAppResource.CheckQuotaAvailability. +type NetAppResourceCheckQuotaAvailabilityResponse struct { + NetAppResourceCheckQuotaAvailabilityResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// NetAppResourceCheckQuotaAvailabilityResult contains the result from method NetAppResource.CheckQuotaAvailability. +type NetAppResourceCheckQuotaAvailabilityResult struct { + CheckAvailabilityResponse +} + +// NetAppResourceQuotaLimitsGetResponse contains the response from method NetAppResourceQuotaLimits.Get. +type NetAppResourceQuotaLimitsGetResponse struct { + NetAppResourceQuotaLimitsGetResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// NetAppResourceQuotaLimitsGetResult contains the result from method NetAppResourceQuotaLimits.Get. +type NetAppResourceQuotaLimitsGetResult struct { + SubscriptionQuotaItem +} + +// NetAppResourceQuotaLimitsListResponse contains the response from method NetAppResourceQuotaLimits.List. +type NetAppResourceQuotaLimitsListResponse struct { + NetAppResourceQuotaLimitsListResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// NetAppResourceQuotaLimitsListResult contains the result from method NetAppResourceQuotaLimits.List. +type NetAppResourceQuotaLimitsListResult struct { + SubscriptionQuotaItemList +} + +// 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 { + OperationListResult +} + +// PoolsCreateOrUpdatePollerResponse contains the response from method Pools.CreateOrUpdate. +type PoolsCreateOrUpdatePollerResponse struct { + // Poller contains an initialized poller. + Poller *PoolsCreateOrUpdatePoller + + // 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 PoolsCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (PoolsCreateOrUpdateResponse, error) { + respType := PoolsCreateOrUpdateResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.CapacityPool) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a PoolsCreateOrUpdatePollerResponse from the provided client and resume token. +func (l *PoolsCreateOrUpdatePollerResponse) Resume(ctx context.Context, client *PoolsClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("PoolsClient.CreateOrUpdate", token, client.pl, client.createOrUpdateHandleError) + if err != nil { + return err + } + poller := &PoolsCreateOrUpdatePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// PoolsCreateOrUpdateResponse contains the response from method Pools.CreateOrUpdate. +type PoolsCreateOrUpdateResponse struct { + PoolsCreateOrUpdateResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PoolsCreateOrUpdateResult contains the result from method Pools.CreateOrUpdate. +type PoolsCreateOrUpdateResult struct { + CapacityPool +} + +// PoolsDeletePollerResponse contains the response from method Pools.Delete. +type PoolsDeletePollerResponse struct { + // Poller contains an initialized poller. + Poller *PoolsDeletePoller + + // 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 PoolsDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (PoolsDeleteResponse, error) { + respType := PoolsDeleteResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a PoolsDeletePollerResponse from the provided client and resume token. +func (l *PoolsDeletePollerResponse) Resume(ctx context.Context, client *PoolsClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("PoolsClient.Delete", token, client.pl, client.deleteHandleError) + if err != nil { + return err + } + poller := &PoolsDeletePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// PoolsDeleteResponse contains the response from method Pools.Delete. +type PoolsDeleteResponse struct { + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PoolsGetResponse contains the response from method Pools.Get. +type PoolsGetResponse struct { + PoolsGetResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PoolsGetResult contains the result from method Pools.Get. +type PoolsGetResult struct { + CapacityPool +} + +// PoolsListResponse contains the response from method Pools.List. +type PoolsListResponse struct { + PoolsListResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PoolsListResult contains the result from method Pools.List. +type PoolsListResult struct { + CapacityPoolList +} + +// PoolsUpdatePollerResponse contains the response from method Pools.Update. +type PoolsUpdatePollerResponse struct { + // Poller contains an initialized poller. + Poller *PoolsUpdatePoller + + // 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 PoolsUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (PoolsUpdateResponse, error) { + respType := PoolsUpdateResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.CapacityPool) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a PoolsUpdatePollerResponse from the provided client and resume token. +func (l *PoolsUpdatePollerResponse) Resume(ctx context.Context, client *PoolsClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("PoolsClient.Update", token, client.pl, client.updateHandleError) + if err != nil { + return err + } + poller := &PoolsUpdatePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// PoolsUpdateResponse contains the response from method Pools.Update. +type PoolsUpdateResponse struct { + PoolsUpdateResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PoolsUpdateResult contains the result from method Pools.Update. +type PoolsUpdateResult struct { + CapacityPool +} + +// SnapshotPoliciesCreateResponse contains the response from method SnapshotPolicies.Create. +type SnapshotPoliciesCreateResponse struct { + SnapshotPoliciesCreateResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// SnapshotPoliciesCreateResult contains the result from method SnapshotPolicies.Create. +type SnapshotPoliciesCreateResult struct { + SnapshotPolicy +} + +// SnapshotPoliciesDeletePollerResponse contains the response from method SnapshotPolicies.Delete. +type SnapshotPoliciesDeletePollerResponse struct { + // Poller contains an initialized poller. + Poller *SnapshotPoliciesDeletePoller + + // 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 SnapshotPoliciesDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (SnapshotPoliciesDeleteResponse, error) { + respType := SnapshotPoliciesDeleteResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a SnapshotPoliciesDeletePollerResponse from the provided client and resume token. +func (l *SnapshotPoliciesDeletePollerResponse) Resume(ctx context.Context, client *SnapshotPoliciesClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("SnapshotPoliciesClient.Delete", token, client.pl, client.deleteHandleError) + if err != nil { + return err + } + poller := &SnapshotPoliciesDeletePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// SnapshotPoliciesDeleteResponse contains the response from method SnapshotPolicies.Delete. +type SnapshotPoliciesDeleteResponse struct { + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// SnapshotPoliciesGetResponse contains the response from method SnapshotPolicies.Get. +type SnapshotPoliciesGetResponse struct { + SnapshotPoliciesGetResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// SnapshotPoliciesGetResult contains the result from method SnapshotPolicies.Get. +type SnapshotPoliciesGetResult struct { + SnapshotPolicy +} + +// SnapshotPoliciesListResponse contains the response from method SnapshotPolicies.List. +type SnapshotPoliciesListResponse struct { + SnapshotPoliciesListResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// SnapshotPoliciesListResult contains the result from method SnapshotPolicies.List. +type SnapshotPoliciesListResult struct { + SnapshotPoliciesList +} + +// SnapshotPoliciesListVolumesResponse contains the response from method SnapshotPolicies.ListVolumes. +type SnapshotPoliciesListVolumesResponse struct { + SnapshotPoliciesListVolumesResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// SnapshotPoliciesListVolumesResult contains the result from method SnapshotPolicies.ListVolumes. +type SnapshotPoliciesListVolumesResult struct { + SnapshotPolicyVolumeList +} + +// SnapshotPoliciesUpdatePollerResponse contains the response from method SnapshotPolicies.Update. +type SnapshotPoliciesUpdatePollerResponse struct { + // Poller contains an initialized poller. + Poller *SnapshotPoliciesUpdatePoller + + // 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 SnapshotPoliciesUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (SnapshotPoliciesUpdateResponse, error) { + respType := SnapshotPoliciesUpdateResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.SnapshotPolicy) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a SnapshotPoliciesUpdatePollerResponse from the provided client and resume token. +func (l *SnapshotPoliciesUpdatePollerResponse) Resume(ctx context.Context, client *SnapshotPoliciesClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("SnapshotPoliciesClient.Update", token, client.pl, client.updateHandleError) + if err != nil { + return err + } + poller := &SnapshotPoliciesUpdatePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// SnapshotPoliciesUpdateResponse contains the response from method SnapshotPolicies.Update. +type SnapshotPoliciesUpdateResponse struct { + SnapshotPoliciesUpdateResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// SnapshotPoliciesUpdateResult contains the result from method SnapshotPolicies.Update. +type SnapshotPoliciesUpdateResult struct { + SnapshotPolicy +} + +// SnapshotsCreatePollerResponse contains the response from method Snapshots.Create. +type SnapshotsCreatePollerResponse struct { + // Poller contains an initialized poller. + Poller *SnapshotsCreatePoller + + // 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 SnapshotsCreatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (SnapshotsCreateResponse, error) { + respType := SnapshotsCreateResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.Snapshot) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a SnapshotsCreatePollerResponse from the provided client and resume token. +func (l *SnapshotsCreatePollerResponse) Resume(ctx context.Context, client *SnapshotsClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("SnapshotsClient.Create", token, client.pl, client.createHandleError) + if err != nil { + return err + } + poller := &SnapshotsCreatePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// SnapshotsCreateResponse contains the response from method Snapshots.Create. +type SnapshotsCreateResponse struct { + SnapshotsCreateResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// SnapshotsCreateResult contains the result from method Snapshots.Create. +type SnapshotsCreateResult struct { + Snapshot +} + +// SnapshotsDeletePollerResponse contains the response from method Snapshots.Delete. +type SnapshotsDeletePollerResponse struct { + // Poller contains an initialized poller. + Poller *SnapshotsDeletePoller + + // 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 SnapshotsDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (SnapshotsDeleteResponse, error) { + respType := SnapshotsDeleteResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a SnapshotsDeletePollerResponse from the provided client and resume token. +func (l *SnapshotsDeletePollerResponse) Resume(ctx context.Context, client *SnapshotsClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("SnapshotsClient.Delete", token, client.pl, client.deleteHandleError) + if err != nil { + return err + } + poller := &SnapshotsDeletePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// SnapshotsDeleteResponse contains the response from method Snapshots.Delete. +type SnapshotsDeleteResponse struct { + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// SnapshotsGetResponse contains the response from method Snapshots.Get. +type SnapshotsGetResponse struct { + SnapshotsGetResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// SnapshotsGetResult contains the result from method Snapshots.Get. +type SnapshotsGetResult struct { + Snapshot +} + +// SnapshotsListResponse contains the response from method Snapshots.List. +type SnapshotsListResponse struct { + SnapshotsListResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// SnapshotsListResult contains the result from method Snapshots.List. +type SnapshotsListResult struct { + SnapshotsList +} + +// SnapshotsUpdatePollerResponse contains the response from method Snapshots.Update. +type SnapshotsUpdatePollerResponse struct { + // Poller contains an initialized poller. + Poller *SnapshotsUpdatePoller + + // 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 SnapshotsUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (SnapshotsUpdateResponse, error) { + respType := SnapshotsUpdateResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.Snapshot) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a SnapshotsUpdatePollerResponse from the provided client and resume token. +func (l *SnapshotsUpdatePollerResponse) Resume(ctx context.Context, client *SnapshotsClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("SnapshotsClient.Update", token, client.pl, client.updateHandleError) + if err != nil { + return err + } + poller := &SnapshotsUpdatePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// SnapshotsUpdateResponse contains the response from method Snapshots.Update. +type SnapshotsUpdateResponse struct { + SnapshotsUpdateResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// SnapshotsUpdateResult contains the result from method Snapshots.Update. +type SnapshotsUpdateResult struct { + Snapshot +} + +// VaultsListResponse contains the response from method Vaults.List. +type VaultsListResponse struct { + VaultsListResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// VaultsListResult contains the result from method Vaults.List. +type VaultsListResult struct { + VaultList +} + +// VolumeGroupsCreatePollerResponse contains the response from method VolumeGroups.Create. +type VolumeGroupsCreatePollerResponse struct { + // Poller contains an initialized poller. + Poller *VolumeGroupsCreatePoller + + // 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 VolumeGroupsCreatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VolumeGroupsCreateResponse, error) { + respType := VolumeGroupsCreateResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.VolumeGroupDetails) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a VolumeGroupsCreatePollerResponse from the provided client and resume token. +func (l *VolumeGroupsCreatePollerResponse) Resume(ctx context.Context, client *VolumeGroupsClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("VolumeGroupsClient.Create", token, client.pl, client.createHandleError) + if err != nil { + return err + } + poller := &VolumeGroupsCreatePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// VolumeGroupsCreateResponse contains the response from method VolumeGroups.Create. +type VolumeGroupsCreateResponse struct { + VolumeGroupsCreateResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// VolumeGroupsCreateResult contains the result from method VolumeGroups.Create. +type VolumeGroupsCreateResult struct { + VolumeGroupDetails +} + +// VolumeGroupsDeletePollerResponse contains the response from method VolumeGroups.Delete. +type VolumeGroupsDeletePollerResponse struct { + // Poller contains an initialized poller. + Poller *VolumeGroupsDeletePoller + + // 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 VolumeGroupsDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VolumeGroupsDeleteResponse, error) { + respType := VolumeGroupsDeleteResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a VolumeGroupsDeletePollerResponse from the provided client and resume token. +func (l *VolumeGroupsDeletePollerResponse) Resume(ctx context.Context, client *VolumeGroupsClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("VolumeGroupsClient.Delete", token, client.pl, client.deleteHandleError) + if err != nil { + return err + } + poller := &VolumeGroupsDeletePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// VolumeGroupsDeleteResponse contains the response from method VolumeGroups.Delete. +type VolumeGroupsDeleteResponse struct { + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// VolumeGroupsGetResponse contains the response from method VolumeGroups.Get. +type VolumeGroupsGetResponse struct { + VolumeGroupsGetResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// VolumeGroupsGetResult contains the result from method VolumeGroups.Get. +type VolumeGroupsGetResult struct { + VolumeGroupDetails +} + +// VolumeGroupsListByNetAppAccountResponse contains the response from method VolumeGroups.ListByNetAppAccount. +type VolumeGroupsListByNetAppAccountResponse struct { + VolumeGroupsListByNetAppAccountResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// VolumeGroupsListByNetAppAccountResult contains the result from method VolumeGroups.ListByNetAppAccount. +type VolumeGroupsListByNetAppAccountResult struct { + VolumeGroupList +} + +// VolumesAuthorizeReplicationPollerResponse contains the response from method Volumes.AuthorizeReplication. +type VolumesAuthorizeReplicationPollerResponse struct { + // Poller contains an initialized poller. + Poller *VolumesAuthorizeReplicationPoller + + // 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 VolumesAuthorizeReplicationPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VolumesAuthorizeReplicationResponse, error) { + respType := VolumesAuthorizeReplicationResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a VolumesAuthorizeReplicationPollerResponse from the provided client and resume token. +func (l *VolumesAuthorizeReplicationPollerResponse) Resume(ctx context.Context, client *VolumesClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("VolumesClient.AuthorizeReplication", token, client.pl, client.authorizeReplicationHandleError) + if err != nil { + return err + } + poller := &VolumesAuthorizeReplicationPoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// VolumesAuthorizeReplicationResponse contains the response from method Volumes.AuthorizeReplication. +type VolumesAuthorizeReplicationResponse struct { + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// VolumesBreakReplicationPollerResponse contains the response from method Volumes.BreakReplication. +type VolumesBreakReplicationPollerResponse struct { + // Poller contains an initialized poller. + Poller *VolumesBreakReplicationPoller + + // 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 VolumesBreakReplicationPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VolumesBreakReplicationResponse, error) { + respType := VolumesBreakReplicationResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a VolumesBreakReplicationPollerResponse from the provided client and resume token. +func (l *VolumesBreakReplicationPollerResponse) Resume(ctx context.Context, client *VolumesClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("VolumesClient.BreakReplication", token, client.pl, client.breakReplicationHandleError) + if err != nil { + return err + } + poller := &VolumesBreakReplicationPoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// VolumesBreakReplicationResponse contains the response from method Volumes.BreakReplication. +type VolumesBreakReplicationResponse struct { + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// VolumesCreateOrUpdatePollerResponse contains the response from method Volumes.CreateOrUpdate. +type VolumesCreateOrUpdatePollerResponse struct { + // Poller contains an initialized poller. + Poller *VolumesCreateOrUpdatePoller + + // 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 VolumesCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VolumesCreateOrUpdateResponse, error) { + respType := VolumesCreateOrUpdateResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.Volume) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a VolumesCreateOrUpdatePollerResponse from the provided client and resume token. +func (l *VolumesCreateOrUpdatePollerResponse) Resume(ctx context.Context, client *VolumesClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("VolumesClient.CreateOrUpdate", token, client.pl, client.createOrUpdateHandleError) + if err != nil { + return err + } + poller := &VolumesCreateOrUpdatePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// VolumesCreateOrUpdateResponse contains the response from method Volumes.CreateOrUpdate. +type VolumesCreateOrUpdateResponse struct { + VolumesCreateOrUpdateResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// VolumesCreateOrUpdateResult contains the result from method Volumes.CreateOrUpdate. +type VolumesCreateOrUpdateResult struct { + Volume +} + +// VolumesDeletePollerResponse contains the response from method Volumes.Delete. +type VolumesDeletePollerResponse struct { + // Poller contains an initialized poller. + Poller *VolumesDeletePoller + + // 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 VolumesDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VolumesDeleteResponse, error) { + respType := VolumesDeleteResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a VolumesDeletePollerResponse from the provided client and resume token. +func (l *VolumesDeletePollerResponse) Resume(ctx context.Context, client *VolumesClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("VolumesClient.Delete", token, client.pl, client.deleteHandleError) + if err != nil { + return err + } + poller := &VolumesDeletePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// VolumesDeleteReplicationPollerResponse contains the response from method Volumes.DeleteReplication. +type VolumesDeleteReplicationPollerResponse struct { + // Poller contains an initialized poller. + Poller *VolumesDeleteReplicationPoller + + // 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 VolumesDeleteReplicationPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VolumesDeleteReplicationResponse, error) { + respType := VolumesDeleteReplicationResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a VolumesDeleteReplicationPollerResponse from the provided client and resume token. +func (l *VolumesDeleteReplicationPollerResponse) Resume(ctx context.Context, client *VolumesClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("VolumesClient.DeleteReplication", token, client.pl, client.deleteReplicationHandleError) + if err != nil { + return err + } + poller := &VolumesDeleteReplicationPoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// VolumesDeleteReplicationResponse contains the response from method Volumes.DeleteReplication. +type VolumesDeleteReplicationResponse struct { + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// VolumesDeleteResponse contains the response from method Volumes.Delete. +type VolumesDeleteResponse struct { + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// VolumesGetResponse contains the response from method Volumes.Get. +type VolumesGetResponse struct { + VolumesGetResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// VolumesGetResult contains the result from method Volumes.Get. +type VolumesGetResult struct { + Volume +} + +// VolumesListResponse contains the response from method Volumes.List. +type VolumesListResponse struct { + VolumesListResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// VolumesListResult contains the result from method Volumes.List. +type VolumesListResult struct { + VolumeList +} + +// VolumesPoolChangePollerResponse contains the response from method Volumes.PoolChange. +type VolumesPoolChangePollerResponse struct { + // Poller contains an initialized poller. + Poller *VolumesPoolChangePoller + + // 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 VolumesPoolChangePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VolumesPoolChangeResponse, error) { + respType := VolumesPoolChangeResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a VolumesPoolChangePollerResponse from the provided client and resume token. +func (l *VolumesPoolChangePollerResponse) Resume(ctx context.Context, client *VolumesClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("VolumesClient.PoolChange", token, client.pl, client.poolChangeHandleError) + if err != nil { + return err + } + poller := &VolumesPoolChangePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// VolumesPoolChangeResponse contains the response from method Volumes.PoolChange. +type VolumesPoolChangeResponse struct { + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// VolumesReInitializeReplicationPollerResponse contains the response from method Volumes.ReInitializeReplication. +type VolumesReInitializeReplicationPollerResponse struct { + // Poller contains an initialized poller. + Poller *VolumesReInitializeReplicationPoller + + // 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 VolumesReInitializeReplicationPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VolumesReInitializeReplicationResponse, error) { + respType := VolumesReInitializeReplicationResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a VolumesReInitializeReplicationPollerResponse from the provided client and resume token. +func (l *VolumesReInitializeReplicationPollerResponse) Resume(ctx context.Context, client *VolumesClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("VolumesClient.ReInitializeReplication", token, client.pl, client.reInitializeReplicationHandleError) + if err != nil { + return err + } + poller := &VolumesReInitializeReplicationPoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// VolumesReInitializeReplicationResponse contains the response from method Volumes.ReInitializeReplication. +type VolumesReInitializeReplicationResponse struct { + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// VolumesReplicationStatusResponse contains the response from method Volumes.ReplicationStatus. +type VolumesReplicationStatusResponse struct { + VolumesReplicationStatusResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// VolumesReplicationStatusResult contains the result from method Volumes.ReplicationStatus. +type VolumesReplicationStatusResult struct { + ReplicationStatus +} + +// VolumesResyncReplicationPollerResponse contains the response from method Volumes.ResyncReplication. +type VolumesResyncReplicationPollerResponse struct { + // Poller contains an initialized poller. + Poller *VolumesResyncReplicationPoller + + // 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 VolumesResyncReplicationPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VolumesResyncReplicationResponse, error) { + respType := VolumesResyncReplicationResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a VolumesResyncReplicationPollerResponse from the provided client and resume token. +func (l *VolumesResyncReplicationPollerResponse) Resume(ctx context.Context, client *VolumesClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("VolumesClient.ResyncReplication", token, client.pl, client.resyncReplicationHandleError) + if err != nil { + return err + } + poller := &VolumesResyncReplicationPoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// VolumesResyncReplicationResponse contains the response from method Volumes.ResyncReplication. +type VolumesResyncReplicationResponse struct { + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// VolumesRevertPollerResponse contains the response from method Volumes.Revert. +type VolumesRevertPollerResponse struct { + // Poller contains an initialized poller. + Poller *VolumesRevertPoller + + // 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 VolumesRevertPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VolumesRevertResponse, error) { + respType := VolumesRevertResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a VolumesRevertPollerResponse from the provided client and resume token. +func (l *VolumesRevertPollerResponse) Resume(ctx context.Context, client *VolumesClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("VolumesClient.Revert", token, client.pl, client.revertHandleError) + if err != nil { + return err + } + poller := &VolumesRevertPoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// VolumesRevertResponse contains the response from method Volumes.Revert. +type VolumesRevertResponse struct { + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// VolumesUpdatePollerResponse contains the response from method Volumes.Update. +type VolumesUpdatePollerResponse struct { + // Poller contains an initialized poller. + Poller *VolumesUpdatePoller + + // 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 VolumesUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VolumesUpdateResponse, error) { + respType := VolumesUpdateResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.Volume) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a VolumesUpdatePollerResponse from the provided client and resume token. +func (l *VolumesUpdatePollerResponse) Resume(ctx context.Context, client *VolumesClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("VolumesClient.Update", token, client.pl, client.updateHandleError) + if err != nil { + return err + } + poller := &VolumesUpdatePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// VolumesUpdateResponse contains the response from method Volumes.Update. +type VolumesUpdateResponse struct { + VolumesUpdateResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// VolumesUpdateResult contains the result from method Volumes.Update. +type VolumesUpdateResult struct { + Volume +} diff --git a/sdk/resourcemanager/netapp/armnetapp/zz_generated_snapshotpolicies_client.go b/sdk/resourcemanager/netapp/armnetapp/zz_generated_snapshotpolicies_client.go new file mode 100644 index 000000000000..8afb76247c18 --- /dev/null +++ b/sdk/resourcemanager/netapp/armnetapp/zz_generated_snapshotpolicies_client.go @@ -0,0 +1,467 @@ +//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 armnetapp + +import ( + "context" + "errors" + "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" +) + +// SnapshotPoliciesClient contains the methods for the SnapshotPolicies group. +// Don't use this type directly, use NewSnapshotPoliciesClient() instead. +type SnapshotPoliciesClient struct { + ep string + pl runtime.Pipeline + subscriptionID string +} + +// NewSnapshotPoliciesClient creates a new instance of SnapshotPoliciesClient with the specified values. +func NewSnapshotPoliciesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *SnapshotPoliciesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &SnapshotPoliciesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} +} + +// Create - Create a snapshot policy +// If the operation fails it returns a generic error. +func (client *SnapshotPoliciesClient) Create(ctx context.Context, resourceGroupName string, accountName string, snapshotPolicyName string, body SnapshotPolicy, options *SnapshotPoliciesCreateOptions) (SnapshotPoliciesCreateResponse, error) { + req, err := client.createCreateRequest(ctx, resourceGroupName, accountName, snapshotPolicyName, body, options) + if err != nil { + return SnapshotPoliciesCreateResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return SnapshotPoliciesCreateResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return SnapshotPoliciesCreateResponse{}, client.createHandleError(resp) + } + return client.createHandleResponse(resp) +} + +// createCreateRequest creates the Create request. +func (client *SnapshotPoliciesClient) createCreateRequest(ctx context.Context, resourceGroupName string, accountName string, snapshotPolicyName string, body SnapshotPolicy, options *SnapshotPoliciesCreateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/snapshotPolicies/{snapshotPolicyName}" + 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 accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if snapshotPolicyName == "" { + return nil, errors.New("parameter snapshotPolicyName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{snapshotPolicyName}", url.PathEscape(snapshotPolicyName)) + 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", "2021-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, runtime.MarshalAsJSON(req, body) +} + +// createHandleResponse handles the Create response. +func (client *SnapshotPoliciesClient) createHandleResponse(resp *http.Response) (SnapshotPoliciesCreateResponse, error) { + result := SnapshotPoliciesCreateResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.SnapshotPolicy); err != nil { + return SnapshotPoliciesCreateResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// createHandleError handles the Create error response. +func (client *SnapshotPoliciesClient) createHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + if len(body) == 0 { + return runtime.NewResponseError(errors.New(resp.Status), resp) + } + return runtime.NewResponseError(errors.New(string(body)), resp) +} + +// BeginDelete - Delete snapshot policy +// If the operation fails it returns a generic error. +func (client *SnapshotPoliciesClient) BeginDelete(ctx context.Context, resourceGroupName string, accountName string, snapshotPolicyName string, options *SnapshotPoliciesBeginDeleteOptions) (SnapshotPoliciesDeletePollerResponse, error) { + resp, err := client.deleteOperation(ctx, resourceGroupName, accountName, snapshotPolicyName, options) + if err != nil { + return SnapshotPoliciesDeletePollerResponse{}, err + } + result := SnapshotPoliciesDeletePollerResponse{ + RawResponse: resp, + } + pt, err := armruntime.NewPoller("SnapshotPoliciesClient.Delete", "location", resp, client.pl, client.deleteHandleError) + if err != nil { + return SnapshotPoliciesDeletePollerResponse{}, err + } + result.Poller = &SnapshotPoliciesDeletePoller{ + pt: pt, + } + return result, nil +} + +// Delete - Delete snapshot policy +// If the operation fails it returns a generic error. +func (client *SnapshotPoliciesClient) deleteOperation(ctx context.Context, resourceGroupName string, accountName string, snapshotPolicyName string, options *SnapshotPoliciesBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, accountName, snapshotPolicyName, 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 *SnapshotPoliciesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, accountName string, snapshotPolicyName string, options *SnapshotPoliciesBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/snapshotPolicies/{snapshotPolicyName}" + 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 accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if snapshotPolicyName == "" { + return nil, errors.New("parameter snapshotPolicyName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{snapshotPolicyName}", url.PathEscape(snapshotPolicyName)) + 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", "2021-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + return req, nil +} + +// deleteHandleError handles the Delete error response. +func (client *SnapshotPoliciesClient) deleteHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + if len(body) == 0 { + return runtime.NewResponseError(errors.New(resp.Status), resp) + } + return runtime.NewResponseError(errors.New(string(body)), resp) +} + +// Get - Get a snapshot Policy +// If the operation fails it returns a generic error. +func (client *SnapshotPoliciesClient) Get(ctx context.Context, resourceGroupName string, accountName string, snapshotPolicyName string, options *SnapshotPoliciesGetOptions) (SnapshotPoliciesGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, accountName, snapshotPolicyName, options) + if err != nil { + return SnapshotPoliciesGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return SnapshotPoliciesGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return SnapshotPoliciesGetResponse{}, client.getHandleError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *SnapshotPoliciesClient) getCreateRequest(ctx context.Context, resourceGroupName string, accountName string, snapshotPolicyName string, options *SnapshotPoliciesGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/snapshotPolicies/{snapshotPolicyName}" + 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 accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if snapshotPolicyName == "" { + return nil, errors.New("parameter snapshotPolicyName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{snapshotPolicyName}", url.PathEscape(snapshotPolicyName)) + 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", "2021-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *SnapshotPoliciesClient) getHandleResponse(resp *http.Response) (SnapshotPoliciesGetResponse, error) { + result := SnapshotPoliciesGetResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.SnapshotPolicy); err != nil { + return SnapshotPoliciesGetResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// getHandleError handles the Get error response. +func (client *SnapshotPoliciesClient) getHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + if len(body) == 0 { + return runtime.NewResponseError(errors.New(resp.Status), resp) + } + return runtime.NewResponseError(errors.New(string(body)), resp) +} + +// List - List snapshot policy +// If the operation fails it returns a generic error. +func (client *SnapshotPoliciesClient) List(ctx context.Context, resourceGroupName string, accountName string, options *SnapshotPoliciesListOptions) (SnapshotPoliciesListResponse, error) { + req, err := client.listCreateRequest(ctx, resourceGroupName, accountName, options) + if err != nil { + return SnapshotPoliciesListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return SnapshotPoliciesListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return SnapshotPoliciesListResponse{}, client.listHandleError(resp) + } + return client.listHandleResponse(resp) +} + +// listCreateRequest creates the List request. +func (client *SnapshotPoliciesClient) listCreateRequest(ctx context.Context, resourceGroupName string, accountName string, options *SnapshotPoliciesListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/snapshotPolicies" + 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 accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + 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", "2021-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// listHandleResponse handles the List response. +func (client *SnapshotPoliciesClient) listHandleResponse(resp *http.Response) (SnapshotPoliciesListResponse, error) { + result := SnapshotPoliciesListResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.SnapshotPoliciesList); err != nil { + return SnapshotPoliciesListResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// listHandleError handles the List error response. +func (client *SnapshotPoliciesClient) listHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + if len(body) == 0 { + return runtime.NewResponseError(errors.New(resp.Status), resp) + } + return runtime.NewResponseError(errors.New(string(body)), resp) +} + +// ListVolumes - Get volumes associated with snapshot policy +// If the operation fails it returns a generic error. +func (client *SnapshotPoliciesClient) ListVolumes(ctx context.Context, resourceGroupName string, accountName string, snapshotPolicyName string, options *SnapshotPoliciesListVolumesOptions) (SnapshotPoliciesListVolumesResponse, error) { + req, err := client.listVolumesCreateRequest(ctx, resourceGroupName, accountName, snapshotPolicyName, options) + if err != nil { + return SnapshotPoliciesListVolumesResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return SnapshotPoliciesListVolumesResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return SnapshotPoliciesListVolumesResponse{}, client.listVolumesHandleError(resp) + } + return client.listVolumesHandleResponse(resp) +} + +// listVolumesCreateRequest creates the ListVolumes request. +func (client *SnapshotPoliciesClient) listVolumesCreateRequest(ctx context.Context, resourceGroupName string, accountName string, snapshotPolicyName string, options *SnapshotPoliciesListVolumesOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/snapshotPolicies/{snapshotPolicyName}/volumes" + 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 accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if snapshotPolicyName == "" { + return nil, errors.New("parameter snapshotPolicyName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{snapshotPolicyName}", url.PathEscape(snapshotPolicyName)) + 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", "2021-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// listVolumesHandleResponse handles the ListVolumes response. +func (client *SnapshotPoliciesClient) listVolumesHandleResponse(resp *http.Response) (SnapshotPoliciesListVolumesResponse, error) { + result := SnapshotPoliciesListVolumesResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.SnapshotPolicyVolumeList); err != nil { + return SnapshotPoliciesListVolumesResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// listVolumesHandleError handles the ListVolumes error response. +func (client *SnapshotPoliciesClient) listVolumesHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + if len(body) == 0 { + return runtime.NewResponseError(errors.New(resp.Status), resp) + } + return runtime.NewResponseError(errors.New(string(body)), resp) +} + +// BeginUpdate - Patch a snapshot policy +// If the operation fails it returns a generic error. +func (client *SnapshotPoliciesClient) BeginUpdate(ctx context.Context, resourceGroupName string, accountName string, snapshotPolicyName string, body SnapshotPolicyPatch, options *SnapshotPoliciesBeginUpdateOptions) (SnapshotPoliciesUpdatePollerResponse, error) { + resp, err := client.update(ctx, resourceGroupName, accountName, snapshotPolicyName, body, options) + if err != nil { + return SnapshotPoliciesUpdatePollerResponse{}, err + } + result := SnapshotPoliciesUpdatePollerResponse{ + RawResponse: resp, + } + pt, err := armruntime.NewPoller("SnapshotPoliciesClient.Update", "location", resp, client.pl, client.updateHandleError) + if err != nil { + return SnapshotPoliciesUpdatePollerResponse{}, err + } + result.Poller = &SnapshotPoliciesUpdatePoller{ + pt: pt, + } + return result, nil +} + +// Update - Patch a snapshot policy +// If the operation fails it returns a generic error. +func (client *SnapshotPoliciesClient) update(ctx context.Context, resourceGroupName string, accountName string, snapshotPolicyName string, body SnapshotPolicyPatch, options *SnapshotPoliciesBeginUpdateOptions) (*http.Response, error) { + req, err := client.updateCreateRequest(ctx, resourceGroupName, accountName, snapshotPolicyName, body, 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) { + return nil, client.updateHandleError(resp) + } + return resp, nil +} + +// updateCreateRequest creates the Update request. +func (client *SnapshotPoliciesClient) updateCreateRequest(ctx context.Context, resourceGroupName string, accountName string, snapshotPolicyName string, body SnapshotPolicyPatch, options *SnapshotPoliciesBeginUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/snapshotPolicies/{snapshotPolicyName}" + 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 accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if snapshotPolicyName == "" { + return nil, errors.New("parameter snapshotPolicyName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{snapshotPolicyName}", url.PathEscape(snapshotPolicyName)) + 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", "2021-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, runtime.MarshalAsJSON(req, body) +} + +// updateHandleError handles the Update error response. +func (client *SnapshotPoliciesClient) updateHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + if len(body) == 0 { + return runtime.NewResponseError(errors.New(resp.Status), resp) + } + return runtime.NewResponseError(errors.New(string(body)), resp) +} diff --git a/sdk/resourcemanager/netapp/armnetapp/zz_generated_snapshots_client.go b/sdk/resourcemanager/netapp/armnetapp/zz_generated_snapshots_client.go new file mode 100644 index 000000000000..0754ed92c31e --- /dev/null +++ b/sdk/resourcemanager/netapp/armnetapp/zz_generated_snapshots_client.go @@ -0,0 +1,450 @@ +//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 armnetapp + +import ( + "context" + "errors" + "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" +) + +// SnapshotsClient contains the methods for the Snapshots group. +// Don't use this type directly, use NewSnapshotsClient() instead. +type SnapshotsClient struct { + ep string + pl runtime.Pipeline + subscriptionID string +} + +// NewSnapshotsClient creates a new instance of SnapshotsClient with the specified values. +func NewSnapshotsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *SnapshotsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &SnapshotsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} +} + +// BeginCreate - Create the specified snapshot within the given volume +// If the operation fails it returns a generic error. +func (client *SnapshotsClient) BeginCreate(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, snapshotName string, body Snapshot, options *SnapshotsBeginCreateOptions) (SnapshotsCreatePollerResponse, error) { + resp, err := client.create(ctx, resourceGroupName, accountName, poolName, volumeName, snapshotName, body, options) + if err != nil { + return SnapshotsCreatePollerResponse{}, err + } + result := SnapshotsCreatePollerResponse{ + RawResponse: resp, + } + pt, err := armruntime.NewPoller("SnapshotsClient.Create", "location", resp, client.pl, client.createHandleError) + if err != nil { + return SnapshotsCreatePollerResponse{}, err + } + result.Poller = &SnapshotsCreatePoller{ + pt: pt, + } + return result, nil +} + +// Create - Create the specified snapshot within the given volume +// If the operation fails it returns a generic error. +func (client *SnapshotsClient) create(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, snapshotName string, body Snapshot, options *SnapshotsBeginCreateOptions) (*http.Response, error) { + req, err := client.createCreateRequest(ctx, resourceGroupName, accountName, poolName, volumeName, snapshotName, body, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusCreated, http.StatusAccepted) { + return nil, client.createHandleError(resp) + } + return resp, nil +} + +// createCreateRequest creates the Create request. +func (client *SnapshotsClient) createCreateRequest(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, snapshotName string, body Snapshot, options *SnapshotsBeginCreateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/snapshots/{snapshotName}" + 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 accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if poolName == "" { + return nil, errors.New("parameter poolName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{poolName}", url.PathEscape(poolName)) + if volumeName == "" { + return nil, errors.New("parameter volumeName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{volumeName}", url.PathEscape(volumeName)) + if snapshotName == "" { + return nil, errors.New("parameter snapshotName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{snapshotName}", url.PathEscape(snapshotName)) + 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", "2021-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, runtime.MarshalAsJSON(req, body) +} + +// createHandleError handles the Create error response. +func (client *SnapshotsClient) createHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + if len(body) == 0 { + return runtime.NewResponseError(errors.New(resp.Status), resp) + } + return runtime.NewResponseError(errors.New(string(body)), resp) +} + +// BeginDelete - Delete snapshot +// If the operation fails it returns a generic error. +func (client *SnapshotsClient) BeginDelete(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, snapshotName string, options *SnapshotsBeginDeleteOptions) (SnapshotsDeletePollerResponse, error) { + resp, err := client.deleteOperation(ctx, resourceGroupName, accountName, poolName, volumeName, snapshotName, options) + if err != nil { + return SnapshotsDeletePollerResponse{}, err + } + result := SnapshotsDeletePollerResponse{ + RawResponse: resp, + } + pt, err := armruntime.NewPoller("SnapshotsClient.Delete", "location", resp, client.pl, client.deleteHandleError) + if err != nil { + return SnapshotsDeletePollerResponse{}, err + } + result.Poller = &SnapshotsDeletePoller{ + pt: pt, + } + return result, nil +} + +// Delete - Delete snapshot +// If the operation fails it returns a generic error. +func (client *SnapshotsClient) deleteOperation(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, snapshotName string, options *SnapshotsBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, accountName, poolName, volumeName, snapshotName, 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 *SnapshotsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, snapshotName string, options *SnapshotsBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/snapshots/{snapshotName}" + 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 accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if poolName == "" { + return nil, errors.New("parameter poolName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{poolName}", url.PathEscape(poolName)) + if volumeName == "" { + return nil, errors.New("parameter volumeName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{volumeName}", url.PathEscape(volumeName)) + if snapshotName == "" { + return nil, errors.New("parameter snapshotName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{snapshotName}", url.PathEscape(snapshotName)) + 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", "2021-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + return req, nil +} + +// deleteHandleError handles the Delete error response. +func (client *SnapshotsClient) deleteHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + if len(body) == 0 { + return runtime.NewResponseError(errors.New(resp.Status), resp) + } + return runtime.NewResponseError(errors.New(string(body)), resp) +} + +// Get - Get details of the specified snapshot +// If the operation fails it returns a generic error. +func (client *SnapshotsClient) Get(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, snapshotName string, options *SnapshotsGetOptions) (SnapshotsGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, accountName, poolName, volumeName, snapshotName, options) + if err != nil { + return SnapshotsGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return SnapshotsGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return SnapshotsGetResponse{}, client.getHandleError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *SnapshotsClient) getCreateRequest(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, snapshotName string, options *SnapshotsGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/snapshots/{snapshotName}" + 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 accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if poolName == "" { + return nil, errors.New("parameter poolName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{poolName}", url.PathEscape(poolName)) + if volumeName == "" { + return nil, errors.New("parameter volumeName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{volumeName}", url.PathEscape(volumeName)) + if snapshotName == "" { + return nil, errors.New("parameter snapshotName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{snapshotName}", url.PathEscape(snapshotName)) + 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", "2021-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *SnapshotsClient) getHandleResponse(resp *http.Response) (SnapshotsGetResponse, error) { + result := SnapshotsGetResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.Snapshot); err != nil { + return SnapshotsGetResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// getHandleError handles the Get error response. +func (client *SnapshotsClient) getHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + if len(body) == 0 { + return runtime.NewResponseError(errors.New(resp.Status), resp) + } + return runtime.NewResponseError(errors.New(string(body)), resp) +} + +// List - List all snapshots associated with the volume +// If the operation fails it returns a generic error. +func (client *SnapshotsClient) List(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, options *SnapshotsListOptions) (SnapshotsListResponse, error) { + req, err := client.listCreateRequest(ctx, resourceGroupName, accountName, poolName, volumeName, options) + if err != nil { + return SnapshotsListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return SnapshotsListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return SnapshotsListResponse{}, client.listHandleError(resp) + } + return client.listHandleResponse(resp) +} + +// listCreateRequest creates the List request. +func (client *SnapshotsClient) listCreateRequest(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, options *SnapshotsListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/snapshots" + 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 accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if poolName == "" { + return nil, errors.New("parameter poolName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{poolName}", url.PathEscape(poolName)) + if volumeName == "" { + return nil, errors.New("parameter volumeName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{volumeName}", url.PathEscape(volumeName)) + 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", "2021-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// listHandleResponse handles the List response. +func (client *SnapshotsClient) listHandleResponse(resp *http.Response) (SnapshotsListResponse, error) { + result := SnapshotsListResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.SnapshotsList); err != nil { + return SnapshotsListResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// listHandleError handles the List error response. +func (client *SnapshotsClient) listHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + if len(body) == 0 { + return runtime.NewResponseError(errors.New(resp.Status), resp) + } + return runtime.NewResponseError(errors.New(string(body)), resp) +} + +// BeginUpdate - Patch a snapshot +// If the operation fails it returns a generic error. +func (client *SnapshotsClient) BeginUpdate(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, snapshotName string, body map[string]interface{}, options *SnapshotsBeginUpdateOptions) (SnapshotsUpdatePollerResponse, error) { + resp, err := client.update(ctx, resourceGroupName, accountName, poolName, volumeName, snapshotName, body, options) + if err != nil { + return SnapshotsUpdatePollerResponse{}, err + } + result := SnapshotsUpdatePollerResponse{ + RawResponse: resp, + } + pt, err := armruntime.NewPoller("SnapshotsClient.Update", "location", resp, client.pl, client.updateHandleError) + if err != nil { + return SnapshotsUpdatePollerResponse{}, err + } + result.Poller = &SnapshotsUpdatePoller{ + pt: pt, + } + return result, nil +} + +// Update - Patch a snapshot +// If the operation fails it returns a generic error. +func (client *SnapshotsClient) update(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, snapshotName string, body map[string]interface{}, options *SnapshotsBeginUpdateOptions) (*http.Response, error) { + req, err := client.updateCreateRequest(ctx, resourceGroupName, accountName, poolName, volumeName, snapshotName, body, 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) { + return nil, client.updateHandleError(resp) + } + return resp, nil +} + +// updateCreateRequest creates the Update request. +func (client *SnapshotsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, snapshotName string, body map[string]interface{}, options *SnapshotsBeginUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/snapshots/{snapshotName}" + 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 accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if poolName == "" { + return nil, errors.New("parameter poolName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{poolName}", url.PathEscape(poolName)) + if volumeName == "" { + return nil, errors.New("parameter volumeName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{volumeName}", url.PathEscape(volumeName)) + if snapshotName == "" { + return nil, errors.New("parameter snapshotName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{snapshotName}", url.PathEscape(snapshotName)) + 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", "2021-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, runtime.MarshalAsJSON(req, body) +} + +// updateHandleError handles the Update error response. +func (client *SnapshotsClient) updateHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + if len(body) == 0 { + return runtime.NewResponseError(errors.New(resp.Status), resp) + } + return runtime.NewResponseError(errors.New(string(body)), resp) +} diff --git a/sdk/resourcemanager/netapp/armnetapp/zz_generated_time_rfc3339.go b/sdk/resourcemanager/netapp/armnetapp/zz_generated_time_rfc3339.go new file mode 100644 index 000000000000..be320c830da3 --- /dev/null +++ b/sdk/resourcemanager/netapp/armnetapp/zz_generated_time_rfc3339.go @@ -0,0 +1,85 @@ +//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 armnetapp + +import ( + "encoding/json" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" + "regexp" + "strings" + "time" +) + +const ( + utcLayoutJSON = `"2006-01-02T15:04:05.999999999"` + utcLayout = "2006-01-02T15:04:05.999999999" + rfc3339JSON = `"` + time.RFC3339Nano + `"` +) + +// Azure reports time in UTC but it doesn't include the 'Z' time zone suffix in some cases. +var tzOffsetRegex = regexp.MustCompile(`(Z|z|\+|-)(\d+:\d+)*"*$`) + +type timeRFC3339 time.Time + +func (t timeRFC3339) MarshalJSON() (json []byte, err error) { + tt := time.Time(t) + return tt.MarshalJSON() +} + +func (t timeRFC3339) MarshalText() (text []byte, err error) { + tt := time.Time(t) + return tt.MarshalText() +} + +func (t *timeRFC3339) UnmarshalJSON(data []byte) error { + layout := utcLayoutJSON + if tzOffsetRegex.Match(data) { + layout = rfc3339JSON + } + return t.Parse(layout, string(data)) +} + +func (t *timeRFC3339) UnmarshalText(data []byte) (err error) { + layout := utcLayout + if tzOffsetRegex.Match(data) { + layout = time.RFC3339Nano + } + return t.Parse(layout, string(data)) +} + +func (t *timeRFC3339) Parse(layout, value string) error { + p, err := time.Parse(layout, strings.ToUpper(value)) + *t = timeRFC3339(p) + return err +} + +func populateTimeRFC3339(m map[string]interface{}, k string, t *time.Time) { + if t == nil { + return + } else if azcore.IsNullValue(t) { + m[k] = nil + return + } else if reflect.ValueOf(t).IsNil() { + return + } + m[k] = (*timeRFC3339)(t) +} + +func unpopulateTimeRFC3339(data json.RawMessage, t **time.Time) error { + if data == nil || strings.EqualFold(string(data), "null") { + return nil + } + var aux timeRFC3339 + if err := json.Unmarshal(data, &aux); err != nil { + return err + } + *t = (*time.Time)(&aux) + return nil +} diff --git a/sdk/resourcemanager/netapp/armnetapp/zz_generated_vaults_client.go b/sdk/resourcemanager/netapp/armnetapp/zz_generated_vaults_client.go new file mode 100644 index 000000000000..2815033fa09b --- /dev/null +++ b/sdk/resourcemanager/netapp/armnetapp/zz_generated_vaults_client.go @@ -0,0 +1,106 @@ +//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 armnetapp + +import ( + "context" + "errors" + "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" +) + +// VaultsClient contains the methods for the Vaults group. +// Don't use this type directly, use NewVaultsClient() instead. +type VaultsClient struct { + ep string + pl runtime.Pipeline + subscriptionID string +} + +// NewVaultsClient creates a new instance of VaultsClient with the specified values. +func NewVaultsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *VaultsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &VaultsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} +} + +// List - List vaults for a Netapp Account +// If the operation fails it returns a generic error. +func (client *VaultsClient) List(ctx context.Context, resourceGroupName string, accountName string, options *VaultsListOptions) (VaultsListResponse, error) { + req, err := client.listCreateRequest(ctx, resourceGroupName, accountName, options) + if err != nil { + return VaultsListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return VaultsListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return VaultsListResponse{}, client.listHandleError(resp) + } + return client.listHandleResponse(resp) +} + +// listCreateRequest creates the List request. +func (client *VaultsClient) listCreateRequest(ctx context.Context, resourceGroupName string, accountName string, options *VaultsListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/vaults" + 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 accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + 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", "2021-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// listHandleResponse handles the List response. +func (client *VaultsClient) listHandleResponse(resp *http.Response) (VaultsListResponse, error) { + result := VaultsListResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.VaultList); err != nil { + return VaultsListResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// listHandleError handles the List error response. +func (client *VaultsClient) listHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + if len(body) == 0 { + return runtime.NewResponseError(errors.New(resp.Status), resp) + } + return runtime.NewResponseError(errors.New(string(body)), resp) +} diff --git a/sdk/resourcemanager/netapp/armnetapp/zz_generated_volumegroups_client.go b/sdk/resourcemanager/netapp/armnetapp/zz_generated_volumegroups_client.go new file mode 100644 index 000000000000..dbebf504b6d0 --- /dev/null +++ b/sdk/resourcemanager/netapp/armnetapp/zz_generated_volumegroups_client.go @@ -0,0 +1,331 @@ +//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 armnetapp + +import ( + "context" + "errors" + "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" +) + +// VolumeGroupsClient contains the methods for the VolumeGroups group. +// Don't use this type directly, use NewVolumeGroupsClient() instead. +type VolumeGroupsClient struct { + ep string + pl runtime.Pipeline + subscriptionID string +} + +// NewVolumeGroupsClient creates a new instance of VolumeGroupsClient with the specified values. +func NewVolumeGroupsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *VolumeGroupsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &VolumeGroupsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} +} + +// BeginCreate - Create a volume group along with specified volumes +// If the operation fails it returns a generic error. +func (client *VolumeGroupsClient) BeginCreate(ctx context.Context, resourceGroupName string, accountName string, volumeGroupName string, body VolumeGroupDetails, options *VolumeGroupsBeginCreateOptions) (VolumeGroupsCreatePollerResponse, error) { + resp, err := client.create(ctx, resourceGroupName, accountName, volumeGroupName, body, options) + if err != nil { + return VolumeGroupsCreatePollerResponse{}, err + } + result := VolumeGroupsCreatePollerResponse{ + RawResponse: resp, + } + pt, err := armruntime.NewPoller("VolumeGroupsClient.Create", "", resp, client.pl, client.createHandleError) + if err != nil { + return VolumeGroupsCreatePollerResponse{}, err + } + result.Poller = &VolumeGroupsCreatePoller{ + pt: pt, + } + return result, nil +} + +// Create - Create a volume group along with specified volumes +// If the operation fails it returns a generic error. +func (client *VolumeGroupsClient) create(ctx context.Context, resourceGroupName string, accountName string, volumeGroupName string, body VolumeGroupDetails, options *VolumeGroupsBeginCreateOptions) (*http.Response, error) { + req, err := client.createCreateRequest(ctx, resourceGroupName, accountName, volumeGroupName, body, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusCreated) { + return nil, client.createHandleError(resp) + } + return resp, nil +} + +// createCreateRequest creates the Create request. +func (client *VolumeGroupsClient) createCreateRequest(ctx context.Context, resourceGroupName string, accountName string, volumeGroupName string, body VolumeGroupDetails, options *VolumeGroupsBeginCreateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/volumeGroups/{volumeGroupName}" + 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 accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if volumeGroupName == "" { + return nil, errors.New("parameter volumeGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{volumeGroupName}", url.PathEscape(volumeGroupName)) + 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", "2021-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, runtime.MarshalAsJSON(req, body) +} + +// createHandleError handles the Create error response. +func (client *VolumeGroupsClient) createHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + if len(body) == 0 { + return runtime.NewResponseError(errors.New(resp.Status), resp) + } + return runtime.NewResponseError(errors.New(string(body)), resp) +} + +// BeginDelete - Delete the specified volume group only if there are no volumes under volume group. +// If the operation fails it returns a generic error. +func (client *VolumeGroupsClient) BeginDelete(ctx context.Context, resourceGroupName string, accountName string, volumeGroupName string, options *VolumeGroupsBeginDeleteOptions) (VolumeGroupsDeletePollerResponse, error) { + resp, err := client.deleteOperation(ctx, resourceGroupName, accountName, volumeGroupName, options) + if err != nil { + return VolumeGroupsDeletePollerResponse{}, err + } + result := VolumeGroupsDeletePollerResponse{ + RawResponse: resp, + } + pt, err := armruntime.NewPoller("VolumeGroupsClient.Delete", "", resp, client.pl, client.deleteHandleError) + if err != nil { + return VolumeGroupsDeletePollerResponse{}, err + } + result.Poller = &VolumeGroupsDeletePoller{ + pt: pt, + } + return result, nil +} + +// Delete - Delete the specified volume group only if there are no volumes under volume group. +// If the operation fails it returns a generic error. +func (client *VolumeGroupsClient) deleteOperation(ctx context.Context, resourceGroupName string, accountName string, volumeGroupName string, options *VolumeGroupsBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, accountName, volumeGroupName, 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 *VolumeGroupsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, accountName string, volumeGroupName string, options *VolumeGroupsBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/volumeGroups/{volumeGroupName}" + 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 accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if volumeGroupName == "" { + return nil, errors.New("parameter volumeGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{volumeGroupName}", url.PathEscape(volumeGroupName)) + 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", "2021-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + return req, nil +} + +// deleteHandleError handles the Delete error response. +func (client *VolumeGroupsClient) deleteHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + if len(body) == 0 { + return runtime.NewResponseError(errors.New(resp.Status), resp) + } + return runtime.NewResponseError(errors.New(string(body)), resp) +} + +// Get - Get details of the specified volume group +// If the operation fails it returns a generic error. +func (client *VolumeGroupsClient) Get(ctx context.Context, resourceGroupName string, accountName string, volumeGroupName string, options *VolumeGroupsGetOptions) (VolumeGroupsGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, accountName, volumeGroupName, options) + if err != nil { + return VolumeGroupsGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return VolumeGroupsGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return VolumeGroupsGetResponse{}, client.getHandleError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *VolumeGroupsClient) getCreateRequest(ctx context.Context, resourceGroupName string, accountName string, volumeGroupName string, options *VolumeGroupsGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/volumeGroups/{volumeGroupName}" + 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 accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if volumeGroupName == "" { + return nil, errors.New("parameter volumeGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{volumeGroupName}", url.PathEscape(volumeGroupName)) + 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", "2021-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *VolumeGroupsClient) getHandleResponse(resp *http.Response) (VolumeGroupsGetResponse, error) { + result := VolumeGroupsGetResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.VolumeGroupDetails); err != nil { + return VolumeGroupsGetResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// getHandleError handles the Get error response. +func (client *VolumeGroupsClient) getHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + if len(body) == 0 { + return runtime.NewResponseError(errors.New(resp.Status), resp) + } + return runtime.NewResponseError(errors.New(string(body)), resp) +} + +// ListByNetAppAccount - List all volume groups for given account +// If the operation fails it returns a generic error. +func (client *VolumeGroupsClient) ListByNetAppAccount(ctx context.Context, resourceGroupName string, accountName string, options *VolumeGroupsListByNetAppAccountOptions) (VolumeGroupsListByNetAppAccountResponse, error) { + req, err := client.listByNetAppAccountCreateRequest(ctx, resourceGroupName, accountName, options) + if err != nil { + return VolumeGroupsListByNetAppAccountResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return VolumeGroupsListByNetAppAccountResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return VolumeGroupsListByNetAppAccountResponse{}, client.listByNetAppAccountHandleError(resp) + } + return client.listByNetAppAccountHandleResponse(resp) +} + +// listByNetAppAccountCreateRequest creates the ListByNetAppAccount request. +func (client *VolumeGroupsClient) listByNetAppAccountCreateRequest(ctx context.Context, resourceGroupName string, accountName string, options *VolumeGroupsListByNetAppAccountOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/volumeGroups" + 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 accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + 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", "2021-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// listByNetAppAccountHandleResponse handles the ListByNetAppAccount response. +func (client *VolumeGroupsClient) listByNetAppAccountHandleResponse(resp *http.Response) (VolumeGroupsListByNetAppAccountResponse, error) { + result := VolumeGroupsListByNetAppAccountResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.VolumeGroupList); err != nil { + return VolumeGroupsListByNetAppAccountResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// listByNetAppAccountHandleError handles the ListByNetAppAccount error response. +func (client *VolumeGroupsClient) listByNetAppAccountHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + if len(body) == 0 { + return runtime.NewResponseError(errors.New(resp.Status), resp) + } + return runtime.NewResponseError(errors.New(string(body)), resp) +} diff --git a/sdk/resourcemanager/netapp/armnetapp/zz_generated_volumes_client.go b/sdk/resourcemanager/netapp/armnetapp/zz_generated_volumes_client.go new file mode 100644 index 000000000000..534354946aec --- /dev/null +++ b/sdk/resourcemanager/netapp/armnetapp/zz_generated_volumes_client.go @@ -0,0 +1,1080 @@ +//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 armnetapp + +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" +) + +// VolumesClient contains the methods for the Volumes group. +// Don't use this type directly, use NewVolumesClient() instead. +type VolumesClient struct { + ep string + pl runtime.Pipeline + subscriptionID string +} + +// NewVolumesClient creates a new instance of VolumesClient with the specified values. +func NewVolumesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *VolumesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &VolumesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} +} + +// BeginAuthorizeReplication - Authorize the replication connection on the source volume +// If the operation fails it returns a generic error. +func (client *VolumesClient) BeginAuthorizeReplication(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, body AuthorizeRequest, options *VolumesBeginAuthorizeReplicationOptions) (VolumesAuthorizeReplicationPollerResponse, error) { + resp, err := client.authorizeReplication(ctx, resourceGroupName, accountName, poolName, volumeName, body, options) + if err != nil { + return VolumesAuthorizeReplicationPollerResponse{}, err + } + result := VolumesAuthorizeReplicationPollerResponse{ + RawResponse: resp, + } + pt, err := armruntime.NewPoller("VolumesClient.AuthorizeReplication", "location", resp, client.pl, client.authorizeReplicationHandleError) + if err != nil { + return VolumesAuthorizeReplicationPollerResponse{}, err + } + result.Poller = &VolumesAuthorizeReplicationPoller{ + pt: pt, + } + return result, nil +} + +// AuthorizeReplication - Authorize the replication connection on the source volume +// If the operation fails it returns a generic error. +func (client *VolumesClient) authorizeReplication(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, body AuthorizeRequest, options *VolumesBeginAuthorizeReplicationOptions) (*http.Response, error) { + req, err := client.authorizeReplicationCreateRequest(ctx, resourceGroupName, accountName, poolName, volumeName, body, 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) { + return nil, client.authorizeReplicationHandleError(resp) + } + return resp, nil +} + +// authorizeReplicationCreateRequest creates the AuthorizeReplication request. +func (client *VolumesClient) authorizeReplicationCreateRequest(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, body AuthorizeRequest, options *VolumesBeginAuthorizeReplicationOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/authorizeReplication" + 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 accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if poolName == "" { + return nil, errors.New("parameter poolName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{poolName}", url.PathEscape(poolName)) + if volumeName == "" { + return nil, errors.New("parameter volumeName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{volumeName}", url.PathEscape(volumeName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + return req, runtime.MarshalAsJSON(req, body) +} + +// authorizeReplicationHandleError handles the AuthorizeReplication error response. +func (client *VolumesClient) authorizeReplicationHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + if len(body) == 0 { + return runtime.NewResponseError(errors.New(resp.Status), resp) + } + return runtime.NewResponseError(errors.New(string(body)), resp) +} + +// BeginBreakReplication - Break the replication connection on the destination volume +// If the operation fails it returns a generic error. +func (client *VolumesClient) BeginBreakReplication(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, options *VolumesBeginBreakReplicationOptions) (VolumesBreakReplicationPollerResponse, error) { + resp, err := client.breakReplication(ctx, resourceGroupName, accountName, poolName, volumeName, options) + if err != nil { + return VolumesBreakReplicationPollerResponse{}, err + } + result := VolumesBreakReplicationPollerResponse{ + RawResponse: resp, + } + pt, err := armruntime.NewPoller("VolumesClient.BreakReplication", "location", resp, client.pl, client.breakReplicationHandleError) + if err != nil { + return VolumesBreakReplicationPollerResponse{}, err + } + result.Poller = &VolumesBreakReplicationPoller{ + pt: pt, + } + return result, nil +} + +// BreakReplication - Break the replication connection on the destination volume +// If the operation fails it returns a generic error. +func (client *VolumesClient) breakReplication(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, options *VolumesBeginBreakReplicationOptions) (*http.Response, error) { + req, err := client.breakReplicationCreateRequest(ctx, resourceGroupName, accountName, poolName, volumeName, 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) { + return nil, client.breakReplicationHandleError(resp) + } + return resp, nil +} + +// breakReplicationCreateRequest creates the BreakReplication request. +func (client *VolumesClient) breakReplicationCreateRequest(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, options *VolumesBeginBreakReplicationOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/breakReplication" + 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 accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if poolName == "" { + return nil, errors.New("parameter poolName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{poolName}", url.PathEscape(poolName)) + if volumeName == "" { + return nil, errors.New("parameter volumeName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{volumeName}", url.PathEscape(volumeName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + if options != nil && options.Body != nil { + return req, runtime.MarshalAsJSON(req, *options.Body) + } + return req, nil +} + +// breakReplicationHandleError handles the BreakReplication error response. +func (client *VolumesClient) breakReplicationHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + if len(body) == 0 { + return runtime.NewResponseError(errors.New(resp.Status), resp) + } + return runtime.NewResponseError(errors.New(string(body)), resp) +} + +// BeginCreateOrUpdate - Create or update the specified volume within the capacity pool +// If the operation fails it returns a generic error. +func (client *VolumesClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, body Volume, options *VolumesBeginCreateOrUpdateOptions) (VolumesCreateOrUpdatePollerResponse, error) { + resp, err := client.createOrUpdate(ctx, resourceGroupName, accountName, poolName, volumeName, body, options) + if err != nil { + return VolumesCreateOrUpdatePollerResponse{}, err + } + result := VolumesCreateOrUpdatePollerResponse{ + RawResponse: resp, + } + pt, err := armruntime.NewPoller("VolumesClient.CreateOrUpdate", "azure-async-operation", resp, client.pl, client.createOrUpdateHandleError) + if err != nil { + return VolumesCreateOrUpdatePollerResponse{}, err + } + result.Poller = &VolumesCreateOrUpdatePoller{ + pt: pt, + } + return result, nil +} + +// CreateOrUpdate - Create or update the specified volume within the capacity pool +// If the operation fails it returns a generic error. +func (client *VolumesClient) createOrUpdate(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, body Volume, options *VolumesBeginCreateOrUpdateOptions) (*http.Response, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, accountName, poolName, volumeName, body, 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, http.StatusAccepted) { + return nil, client.createOrUpdateHandleError(resp) + } + return resp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *VolumesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, body Volume, options *VolumesBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}" + 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 accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if poolName == "" { + return nil, errors.New("parameter poolName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{poolName}", url.PathEscape(poolName)) + if volumeName == "" { + return nil, errors.New("parameter volumeName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{volumeName}", url.PathEscape(volumeName)) + 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", "2021-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, runtime.MarshalAsJSON(req, body) +} + +// createOrUpdateHandleError handles the CreateOrUpdate error response. +func (client *VolumesClient) createOrUpdateHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + if len(body) == 0 { + return runtime.NewResponseError(errors.New(resp.Status), resp) + } + return runtime.NewResponseError(errors.New(string(body)), resp) +} + +// BeginDelete - Delete the specified volume +// If the operation fails it returns a generic error. +func (client *VolumesClient) BeginDelete(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, options *VolumesBeginDeleteOptions) (VolumesDeletePollerResponse, error) { + resp, err := client.deleteOperation(ctx, resourceGroupName, accountName, poolName, volumeName, options) + if err != nil { + return VolumesDeletePollerResponse{}, err + } + result := VolumesDeletePollerResponse{ + RawResponse: resp, + } + pt, err := armruntime.NewPoller("VolumesClient.Delete", "location", resp, client.pl, client.deleteHandleError) + if err != nil { + return VolumesDeletePollerResponse{}, err + } + result.Poller = &VolumesDeletePoller{ + pt: pt, + } + return result, nil +} + +// Delete - Delete the specified volume +// If the operation fails it returns a generic error. +func (client *VolumesClient) deleteOperation(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, options *VolumesBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, accountName, poolName, volumeName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusAccepted, http.StatusNoContent) { + return nil, client.deleteHandleError(resp) + } + return resp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *VolumesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, options *VolumesBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}" + 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 accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if poolName == "" { + return nil, errors.New("parameter poolName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{poolName}", url.PathEscape(poolName)) + if volumeName == "" { + return nil, errors.New("parameter volumeName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{volumeName}", url.PathEscape(volumeName)) + 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", "2021-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + return req, nil +} + +// deleteHandleError handles the Delete error response. +func (client *VolumesClient) deleteHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + if len(body) == 0 { + return runtime.NewResponseError(errors.New(resp.Status), resp) + } + return runtime.NewResponseError(errors.New(string(body)), resp) +} + +// BeginDeleteReplication - Delete the replication connection on the destination volume, and send release to the source replication +// If the operation fails it returns a generic error. +func (client *VolumesClient) BeginDeleteReplication(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, options *VolumesBeginDeleteReplicationOptions) (VolumesDeleteReplicationPollerResponse, error) { + resp, err := client.deleteReplication(ctx, resourceGroupName, accountName, poolName, volumeName, options) + if err != nil { + return VolumesDeleteReplicationPollerResponse{}, err + } + result := VolumesDeleteReplicationPollerResponse{ + RawResponse: resp, + } + pt, err := armruntime.NewPoller("VolumesClient.DeleteReplication", "location", resp, client.pl, client.deleteReplicationHandleError) + if err != nil { + return VolumesDeleteReplicationPollerResponse{}, err + } + result.Poller = &VolumesDeleteReplicationPoller{ + pt: pt, + } + return result, nil +} + +// DeleteReplication - Delete the replication connection on the destination volume, and send release to the source replication +// If the operation fails it returns a generic error. +func (client *VolumesClient) deleteReplication(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, options *VolumesBeginDeleteReplicationOptions) (*http.Response, error) { + req, err := client.deleteReplicationCreateRequest(ctx, resourceGroupName, accountName, poolName, volumeName, 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) { + return nil, client.deleteReplicationHandleError(resp) + } + return resp, nil +} + +// deleteReplicationCreateRequest creates the DeleteReplication request. +func (client *VolumesClient) deleteReplicationCreateRequest(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, options *VolumesBeginDeleteReplicationOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/deleteReplication" + 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 accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if poolName == "" { + return nil, errors.New("parameter poolName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{poolName}", url.PathEscape(poolName)) + if volumeName == "" { + return nil, errors.New("parameter volumeName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{volumeName}", url.PathEscape(volumeName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + return req, nil +} + +// deleteReplicationHandleError handles the DeleteReplication error response. +func (client *VolumesClient) deleteReplicationHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + if len(body) == 0 { + return runtime.NewResponseError(errors.New(resp.Status), resp) + } + return runtime.NewResponseError(errors.New(string(body)), resp) +} + +// Get - Get the details of the specified volume +// If the operation fails it returns a generic error. +func (client *VolumesClient) Get(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, options *VolumesGetOptions) (VolumesGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, accountName, poolName, volumeName, options) + if err != nil { + return VolumesGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return VolumesGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return VolumesGetResponse{}, client.getHandleError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *VolumesClient) getCreateRequest(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, options *VolumesGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}" + 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 accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if poolName == "" { + return nil, errors.New("parameter poolName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{poolName}", url.PathEscape(poolName)) + if volumeName == "" { + return nil, errors.New("parameter volumeName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{volumeName}", url.PathEscape(volumeName)) + 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", "2021-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *VolumesClient) getHandleResponse(resp *http.Response) (VolumesGetResponse, error) { + result := VolumesGetResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.Volume); err != nil { + return VolumesGetResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// getHandleError handles the Get error response. +func (client *VolumesClient) getHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + if len(body) == 0 { + return runtime.NewResponseError(errors.New(resp.Status), resp) + } + return runtime.NewResponseError(errors.New(string(body)), resp) +} + +// List - List all volumes within the capacity pool +// If the operation fails it returns a generic error. +func (client *VolumesClient) List(resourceGroupName string, accountName string, poolName string, options *VolumesListOptions) *VolumesListPager { + return &VolumesListPager{ + client: client, + requester: func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, resourceGroupName, accountName, poolName, options) + }, + advancer: func(ctx context.Context, resp VolumesListResponse) (*policy.Request, error) { + return runtime.NewRequest(ctx, http.MethodGet, *resp.VolumeList.NextLink) + }, + } +} + +// listCreateRequest creates the List request. +func (client *VolumesClient) listCreateRequest(ctx context.Context, resourceGroupName string, accountName string, poolName string, options *VolumesListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes" + 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 accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if poolName == "" { + return nil, errors.New("parameter poolName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{poolName}", url.PathEscape(poolName)) + 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", "2021-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// listHandleResponse handles the List response. +func (client *VolumesClient) listHandleResponse(resp *http.Response) (VolumesListResponse, error) { + result := VolumesListResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.VolumeList); err != nil { + return VolumesListResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// listHandleError handles the List error response. +func (client *VolumesClient) listHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + if len(body) == 0 { + return runtime.NewResponseError(errors.New(resp.Status), resp) + } + return runtime.NewResponseError(errors.New(string(body)), resp) +} + +// BeginPoolChange - Moves volume to another pool +// If the operation fails it returns a generic error. +func (client *VolumesClient) BeginPoolChange(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, body PoolChangeRequest, options *VolumesBeginPoolChangeOptions) (VolumesPoolChangePollerResponse, error) { + resp, err := client.poolChange(ctx, resourceGroupName, accountName, poolName, volumeName, body, options) + if err != nil { + return VolumesPoolChangePollerResponse{}, err + } + result := VolumesPoolChangePollerResponse{ + RawResponse: resp, + } + pt, err := armruntime.NewPoller("VolumesClient.PoolChange", "location", resp, client.pl, client.poolChangeHandleError) + if err != nil { + return VolumesPoolChangePollerResponse{}, err + } + result.Poller = &VolumesPoolChangePoller{ + pt: pt, + } + return result, nil +} + +// PoolChange - Moves volume to another pool +// If the operation fails it returns a generic error. +func (client *VolumesClient) poolChange(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, body PoolChangeRequest, options *VolumesBeginPoolChangeOptions) (*http.Response, error) { + req, err := client.poolChangeCreateRequest(ctx, resourceGroupName, accountName, poolName, volumeName, body, 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) { + return nil, client.poolChangeHandleError(resp) + } + return resp, nil +} + +// poolChangeCreateRequest creates the PoolChange request. +func (client *VolumesClient) poolChangeCreateRequest(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, body PoolChangeRequest, options *VolumesBeginPoolChangeOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/poolChange" + 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 accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if poolName == "" { + return nil, errors.New("parameter poolName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{poolName}", url.PathEscape(poolName)) + if volumeName == "" { + return nil, errors.New("parameter volumeName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{volumeName}", url.PathEscape(volumeName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + return req, runtime.MarshalAsJSON(req, body) +} + +// poolChangeHandleError handles the PoolChange error response. +func (client *VolumesClient) poolChangeHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + if len(body) == 0 { + return runtime.NewResponseError(errors.New(resp.Status), resp) + } + return runtime.NewResponseError(errors.New(string(body)), resp) +} + +// BeginReInitializeReplication - Re-Initializes the replication connection on the destination volume +// If the operation fails it returns a generic error. +func (client *VolumesClient) BeginReInitializeReplication(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, options *VolumesBeginReInitializeReplicationOptions) (VolumesReInitializeReplicationPollerResponse, error) { + resp, err := client.reInitializeReplication(ctx, resourceGroupName, accountName, poolName, volumeName, options) + if err != nil { + return VolumesReInitializeReplicationPollerResponse{}, err + } + result := VolumesReInitializeReplicationPollerResponse{ + RawResponse: resp, + } + pt, err := armruntime.NewPoller("VolumesClient.ReInitializeReplication", "location", resp, client.pl, client.reInitializeReplicationHandleError) + if err != nil { + return VolumesReInitializeReplicationPollerResponse{}, err + } + result.Poller = &VolumesReInitializeReplicationPoller{ + pt: pt, + } + return result, nil +} + +// ReInitializeReplication - Re-Initializes the replication connection on the destination volume +// If the operation fails it returns a generic error. +func (client *VolumesClient) reInitializeReplication(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, options *VolumesBeginReInitializeReplicationOptions) (*http.Response, error) { + req, err := client.reInitializeReplicationCreateRequest(ctx, resourceGroupName, accountName, poolName, volumeName, 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) { + return nil, client.reInitializeReplicationHandleError(resp) + } + return resp, nil +} + +// reInitializeReplicationCreateRequest creates the ReInitializeReplication request. +func (client *VolumesClient) reInitializeReplicationCreateRequest(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, options *VolumesBeginReInitializeReplicationOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/reinitializeReplication" + 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 accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if poolName == "" { + return nil, errors.New("parameter poolName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{poolName}", url.PathEscape(poolName)) + if volumeName == "" { + return nil, errors.New("parameter volumeName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{volumeName}", url.PathEscape(volumeName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + return req, nil +} + +// reInitializeReplicationHandleError handles the ReInitializeReplication error response. +func (client *VolumesClient) reInitializeReplicationHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + if len(body) == 0 { + return runtime.NewResponseError(errors.New(resp.Status), resp) + } + return runtime.NewResponseError(errors.New(string(body)), resp) +} + +// ReplicationStatus - Get the status of the replication +// If the operation fails it returns a generic error. +func (client *VolumesClient) ReplicationStatus(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, options *VolumesReplicationStatusOptions) (VolumesReplicationStatusResponse, error) { + req, err := client.replicationStatusCreateRequest(ctx, resourceGroupName, accountName, poolName, volumeName, options) + if err != nil { + return VolumesReplicationStatusResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return VolumesReplicationStatusResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return VolumesReplicationStatusResponse{}, client.replicationStatusHandleError(resp) + } + return client.replicationStatusHandleResponse(resp) +} + +// replicationStatusCreateRequest creates the ReplicationStatus request. +func (client *VolumesClient) replicationStatusCreateRequest(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, options *VolumesReplicationStatusOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/replicationStatus" + 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 accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if poolName == "" { + return nil, errors.New("parameter poolName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{poolName}", url.PathEscape(poolName)) + if volumeName == "" { + return nil, errors.New("parameter volumeName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{volumeName}", url.PathEscape(volumeName)) + 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", "2021-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// replicationStatusHandleResponse handles the ReplicationStatus response. +func (client *VolumesClient) replicationStatusHandleResponse(resp *http.Response) (VolumesReplicationStatusResponse, error) { + result := VolumesReplicationStatusResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.ReplicationStatus); err != nil { + return VolumesReplicationStatusResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// replicationStatusHandleError handles the ReplicationStatus error response. +func (client *VolumesClient) replicationStatusHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + if len(body) == 0 { + return runtime.NewResponseError(errors.New(resp.Status), resp) + } + return runtime.NewResponseError(errors.New(string(body)), resp) +} + +// BeginResyncReplication - Resync the connection on the destination volume. If the operation is ran on the source volume it will reverse-resync the connection +// and sync from destination to source. +// If the operation fails it returns a generic error. +func (client *VolumesClient) BeginResyncReplication(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, options *VolumesBeginResyncReplicationOptions) (VolumesResyncReplicationPollerResponse, error) { + resp, err := client.resyncReplication(ctx, resourceGroupName, accountName, poolName, volumeName, options) + if err != nil { + return VolumesResyncReplicationPollerResponse{}, err + } + result := VolumesResyncReplicationPollerResponse{ + RawResponse: resp, + } + pt, err := armruntime.NewPoller("VolumesClient.ResyncReplication", "location", resp, client.pl, client.resyncReplicationHandleError) + if err != nil { + return VolumesResyncReplicationPollerResponse{}, err + } + result.Poller = &VolumesResyncReplicationPoller{ + pt: pt, + } + return result, nil +} + +// ResyncReplication - Resync the connection on the destination volume. If the operation is ran on the source volume it will reverse-resync the connection +// and sync from destination to source. +// If the operation fails it returns a generic error. +func (client *VolumesClient) resyncReplication(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, options *VolumesBeginResyncReplicationOptions) (*http.Response, error) { + req, err := client.resyncReplicationCreateRequest(ctx, resourceGroupName, accountName, poolName, volumeName, 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) { + return nil, client.resyncReplicationHandleError(resp) + } + return resp, nil +} + +// resyncReplicationCreateRequest creates the ResyncReplication request. +func (client *VolumesClient) resyncReplicationCreateRequest(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, options *VolumesBeginResyncReplicationOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/resyncReplication" + 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 accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if poolName == "" { + return nil, errors.New("parameter poolName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{poolName}", url.PathEscape(poolName)) + if volumeName == "" { + return nil, errors.New("parameter volumeName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{volumeName}", url.PathEscape(volumeName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + return req, nil +} + +// resyncReplicationHandleError handles the ResyncReplication error response. +func (client *VolumesClient) resyncReplicationHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + if len(body) == 0 { + return runtime.NewResponseError(errors.New(resp.Status), resp) + } + return runtime.NewResponseError(errors.New(string(body)), resp) +} + +// BeginRevert - Revert a volume to the snapshot specified in the body +// If the operation fails it returns a generic error. +func (client *VolumesClient) BeginRevert(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, body VolumeRevert, options *VolumesBeginRevertOptions) (VolumesRevertPollerResponse, error) { + resp, err := client.revert(ctx, resourceGroupName, accountName, poolName, volumeName, body, options) + if err != nil { + return VolumesRevertPollerResponse{}, err + } + result := VolumesRevertPollerResponse{ + RawResponse: resp, + } + pt, err := armruntime.NewPoller("VolumesClient.Revert", "location", resp, client.pl, client.revertHandleError) + if err != nil { + return VolumesRevertPollerResponse{}, err + } + result.Poller = &VolumesRevertPoller{ + pt: pt, + } + return result, nil +} + +// Revert - Revert a volume to the snapshot specified in the body +// If the operation fails it returns a generic error. +func (client *VolumesClient) revert(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, body VolumeRevert, options *VolumesBeginRevertOptions) (*http.Response, error) { + req, err := client.revertCreateRequest(ctx, resourceGroupName, accountName, poolName, volumeName, body, 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) { + return nil, client.revertHandleError(resp) + } + return resp, nil +} + +// revertCreateRequest creates the Revert request. +func (client *VolumesClient) revertCreateRequest(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, body VolumeRevert, options *VolumesBeginRevertOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/revert" + 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 accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if poolName == "" { + return nil, errors.New("parameter poolName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{poolName}", url.PathEscape(poolName)) + if volumeName == "" { + return nil, errors.New("parameter volumeName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{volumeName}", url.PathEscape(volumeName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + return req, runtime.MarshalAsJSON(req, body) +} + +// revertHandleError handles the Revert error response. +func (client *VolumesClient) revertHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + if len(body) == 0 { + return runtime.NewResponseError(errors.New(resp.Status), resp) + } + return runtime.NewResponseError(errors.New(string(body)), resp) +} + +// BeginUpdate - Patch the specified volume +// If the operation fails it returns the *CloudError error type. +func (client *VolumesClient) BeginUpdate(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, body VolumePatch, options *VolumesBeginUpdateOptions) (VolumesUpdatePollerResponse, error) { + resp, err := client.update(ctx, resourceGroupName, accountName, poolName, volumeName, body, options) + if err != nil { + return VolumesUpdatePollerResponse{}, err + } + result := VolumesUpdatePollerResponse{ + RawResponse: resp, + } + pt, err := armruntime.NewPoller("VolumesClient.Update", "location", resp, client.pl, client.updateHandleError) + if err != nil { + return VolumesUpdatePollerResponse{}, err + } + result.Poller = &VolumesUpdatePoller{ + pt: pt, + } + return result, nil +} + +// Update - Patch the specified volume +// If the operation fails it returns the *CloudError error type. +func (client *VolumesClient) update(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, body VolumePatch, options *VolumesBeginUpdateOptions) (*http.Response, error) { + req, err := client.updateCreateRequest(ctx, resourceGroupName, accountName, poolName, volumeName, body, 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) { + return nil, client.updateHandleError(resp) + } + return resp, nil +} + +// updateCreateRequest creates the Update request. +func (client *VolumesClient) updateCreateRequest(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, body VolumePatch, options *VolumesBeginUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}" + 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 accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if poolName == "" { + return nil, errors.New("parameter poolName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{poolName}", url.PathEscape(poolName)) + if volumeName == "" { + return nil, errors.New("parameter volumeName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{volumeName}", url.PathEscape(volumeName)) + 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", "2021-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, runtime.MarshalAsJSON(req, body) +} + +// updateHandleError handles the Update error response. +func (client *VolumesClient) updateHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := CloudError{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) +}