From 867413a045a34e8466d4ddfc4a2627f0c7758524 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Wed, 18 Aug 2021 10:05:21 +0000 Subject: [PATCH] CodeGen from PR 15011 in Azure/azure-rest-api-specs [NetAppFiles] Anf 13322 net app files api version 2021 06 01 (#15011) * Api version bump * Apply 2021-06-01 changes * Update readme * Change default on enum * Add s360 fixes * Add missing systemdata * Change defaultUserQuotaInKiBs default to 0 Co-authored-by: Audunn Baldvinsson --- .../mgmt/2019-05-01/netapp/CHANGELOG.md | 2 +- .../netapp/mgmt/2019-05-01/netapp/_meta.json | 2 +- .../netapp/mgmt/2019-05-01/netapp/accounts.go | 2 +- .../netapp/mgmt/2019-05-01/netapp/client.go | 2 +- .../mgmt/2019-05-01/netapp/mounttargets.go | 2 +- .../mgmt/2019-05-01/netapp/operations.go | 2 +- .../netapp/mgmt/2019-05-01/netapp/pools.go | 2 +- .../mgmt/2019-05-01/netapp/snapshots.go | 2 +- .../netapp/mgmt/2019-05-01/netapp/volumes.go | 2 +- .../mgmt/2019-06-01/netapp/CHANGELOG.md | 2 +- .../netapp/mgmt/2019-06-01/netapp/_meta.json | 2 +- .../netapp/mgmt/2019-06-01/netapp/accounts.go | 2 +- .../netapp/mgmt/2019-06-01/netapp/client.go | 2 +- .../netapp/mgmt/2019-06-01/netapp/models.go | 5 +- .../mgmt/2019-06-01/netapp/mounttargets.go | 2 +- .../mgmt/2019-06-01/netapp/operations.go | 2 +- .../netapp/mgmt/2019-06-01/netapp/pools.go | 2 +- .../mgmt/2019-06-01/netapp/snapshots.go | 2 +- .../netapp/mgmt/2019-06-01/netapp/volumes.go | 2 +- .../mgmt/2019-07-01/netapp/CHANGELOG.md | 2 +- .../netapp/mgmt/2019-07-01/netapp/_meta.json | 2 +- .../netapp/mgmt/2019-07-01/netapp/accounts.go | 2 +- .../netapp/mgmt/2019-07-01/netapp/client.go | 2 +- .../netapp/mgmt/2019-07-01/netapp/models.go | 7 +- .../mgmt/2019-07-01/netapp/mounttargets.go | 2 +- .../mgmt/2019-07-01/netapp/operations.go | 2 +- .../netapp/mgmt/2019-07-01/netapp/pools.go | 2 +- .../mgmt/2019-07-01/netapp/snapshots.go | 2 +- .../netapp/mgmt/2019-07-01/netapp/volumes.go | 2 +- .../mgmt/2019-08-01/netapp/CHANGELOG.md | 9 +- .../netapp/mgmt/2019-08-01/netapp/_meta.json | 2 +- .../netapp/mgmt/2019-08-01/netapp/accounts.go | 2 +- .../netapp/mgmt/2019-08-01/netapp/client.go | 2 +- .../netapp/mgmt/2019-08-01/netapp/models.go | 2 + .../mgmt/2019-08-01/netapp/mounttargets.go | 2 +- .../mgmt/2019-08-01/netapp/operations.go | 2 +- .../netapp/mgmt/2019-08-01/netapp/pools.go | 2 +- .../netapp/mgmt/2019-08-01/netapp/resource.go | 2 +- .../mgmt/2019-08-01/netapp/snapshots.go | 2 +- .../netapp/mgmt/2019-08-01/netapp/volumes.go | 2 +- .../mgmt/2019-10-01/netapp/CHANGELOG.md | 9 +- .../netapp/mgmt/2019-10-01/netapp/_meta.json | 2 +- .../netapp/mgmt/2019-10-01/netapp/accounts.go | 2 +- .../netapp/mgmt/2019-10-01/netapp/client.go | 2 +- .../netapp/mgmt/2019-10-01/netapp/models.go | 9 +- .../mgmt/2019-10-01/netapp/mounttargets.go | 2 +- .../mgmt/2019-10-01/netapp/operations.go | 2 +- .../netapp/mgmt/2019-10-01/netapp/pools.go | 2 +- .../netapp/mgmt/2019-10-01/netapp/resource.go | 2 +- .../mgmt/2019-10-01/netapp/snapshots.go | 2 +- .../netapp/mgmt/2019-10-01/netapp/volumes.go | 4 +- .../mgmt/2019-11-01/netapp/CHANGELOG.md | 9 +- .../netapp/mgmt/2019-11-01/netapp/_meta.json | 2 +- .../netapp/mgmt/2019-11-01/netapp/accounts.go | 2 +- .../netapp/mgmt/2019-11-01/netapp/client.go | 2 +- .../netapp/mgmt/2019-11-01/netapp/models.go | 9 +- .../mgmt/2019-11-01/netapp/operations.go | 2 +- .../netapp/mgmt/2019-11-01/netapp/pools.go | 2 +- .../netapp/mgmt/2019-11-01/netapp/resource.go | 2 +- .../mgmt/2019-11-01/netapp/snapshots.go | 2 +- .../netapp/mgmt/2019-11-01/netapp/volumes.go | 4 +- .../mgmt/2020-02-01/netapp/CHANGELOG.md | 8 +- .../netapp/mgmt/2020-02-01/netapp/_meta.json | 2 +- .../netapp/mgmt/2020-02-01/netapp/accounts.go | 2 +- .../netapp/mgmt/2020-02-01/netapp/client.go | 2 +- .../netapp/mgmt/2020-02-01/netapp/models.go | 9 +- .../mgmt/2020-02-01/netapp/operations.go | 2 +- .../netapp/mgmt/2020-02-01/netapp/pools.go | 2 +- .../netapp/mgmt/2020-02-01/netapp/resource.go | 2 +- .../mgmt/2020-02-01/netapp/snapshots.go | 2 +- .../netapp/mgmt/2020-02-01/netapp/volumes.go | 4 +- .../mgmt/2020-03-01/netapp/CHANGELOG.md | 7 +- .../netapp/mgmt/2020-03-01/netapp/_meta.json | 2 +- .../netapp/mgmt/2020-03-01/netapp/accounts.go | 2 +- .../netapp/mgmt/2020-03-01/netapp/client.go | 2 +- .../netapp/mgmt/2020-03-01/netapp/models.go | 7 +- .../mgmt/2020-03-01/netapp/operations.go | 2 +- .../netapp/mgmt/2020-03-01/netapp/pools.go | 2 +- .../netapp/mgmt/2020-03-01/netapp/resource.go | 2 +- .../mgmt/2020-03-01/netapp/snapshots.go | 2 +- .../netapp/mgmt/2020-03-01/netapp/volumes.go | 4 +- .../mgmt/2020-05-01/netapp/CHANGELOG.md | 17 +- .../netapp/mgmt/2020-05-01/netapp/_meta.json | 2 +- .../mgmt/2020-05-01/netapp/accountbackups.go | 2 +- .../netapp/mgmt/2020-05-01/netapp/accounts.go | 2 +- .../mgmt/2020-05-01/netapp/backuppolicies.go | 2 +- .../netapp/mgmt/2020-05-01/netapp/backups.go | 2 +- .../netapp/mgmt/2020-05-01/netapp/client.go | 2 +- .../netapp/mgmt/2020-05-01/netapp/enums.go | 15 + .../netapp/mgmt/2020-05-01/netapp/models.go | 11 +- .../mgmt/2020-05-01/netapp/operations.go | 2 +- .../netapp/mgmt/2020-05-01/netapp/pools.go | 2 +- .../netapp/mgmt/2020-05-01/netapp/resource.go | 2 +- .../2020-05-01/netapp/snapshotpolicies.go | 2 +- .../mgmt/2020-05-01/netapp/snapshots.go | 2 +- .../netapp/mgmt/2020-05-01/netapp/vaults.go | 2 +- .../netapp/mgmt/2020-05-01/netapp/volumes.go | 4 +- .../mgmt/2020-06-01/netapp/CHANGELOG.md | 26 +- .../netapp/mgmt/2020-06-01/netapp/_meta.json | 2 +- .../mgmt/2020-06-01/netapp/accountbackups.go | 2 +- .../netapp/mgmt/2020-06-01/netapp/accounts.go | 2 +- .../mgmt/2020-06-01/netapp/backuppolicies.go | 2 +- .../netapp/mgmt/2020-06-01/netapp/backups.go | 2 +- .../netapp/mgmt/2020-06-01/netapp/client.go | 2 +- .../netapp/mgmt/2020-06-01/netapp/enums.go | 25 +- .../netapp/mgmt/2020-06-01/netapp/models.go | 17 +- .../mgmt/2020-06-01/netapp/operations.go | 2 +- .../netapp/mgmt/2020-06-01/netapp/pools.go | 2 +- .../netapp/mgmt/2020-06-01/netapp/resource.go | 2 +- .../2020-06-01/netapp/snapshotpolicies.go | 2 +- .../mgmt/2020-06-01/netapp/snapshots.go | 2 +- .../netapp/mgmt/2020-06-01/netapp/vaults.go | 2 +- .../netapp/mgmt/2020-06-01/netapp/volumes.go | 6 +- .../mgmt/2020-07-01/netapp/CHANGELOG.md | 26 +- .../netapp/mgmt/2020-07-01/netapp/_meta.json | 2 +- .../mgmt/2020-07-01/netapp/accountbackups.go | 2 +- .../netapp/mgmt/2020-07-01/netapp/accounts.go | 2 +- .../mgmt/2020-07-01/netapp/backuppolicies.go | 2 +- .../netapp/mgmt/2020-07-01/netapp/backups.go | 2 +- .../netapp/mgmt/2020-07-01/netapp/client.go | 2 +- .../netapp/mgmt/2020-07-01/netapp/enums.go | 25 +- .../netapp/mgmt/2020-07-01/netapp/models.go | 17 +- .../mgmt/2020-07-01/netapp/operations.go | 2 +- .../netapp/mgmt/2020-07-01/netapp/pools.go | 2 +- .../netapp/mgmt/2020-07-01/netapp/resource.go | 2 +- .../2020-07-01/netapp/snapshotpolicies.go | 2 +- .../mgmt/2020-07-01/netapp/snapshots.go | 2 +- .../netapp/mgmt/2020-07-01/netapp/vaults.go | 2 +- .../netapp/mgmt/2020-07-01/netapp/volumes.go | 6 +- .../mgmt/2020-08-01/netapp/CHANGELOG.md | 26 +- .../netapp/mgmt/2020-08-01/netapp/_meta.json | 2 +- .../mgmt/2020-08-01/netapp/accountbackups.go | 2 +- .../netapp/mgmt/2020-08-01/netapp/accounts.go | 2 +- .../mgmt/2020-08-01/netapp/backuppolicies.go | 2 +- .../netapp/mgmt/2020-08-01/netapp/backups.go | 2 +- .../netapp/mgmt/2020-08-01/netapp/client.go | 2 +- .../netapp/mgmt/2020-08-01/netapp/enums.go | 25 +- .../netapp/mgmt/2020-08-01/netapp/models.go | 17 +- .../mgmt/2020-08-01/netapp/operations.go | 2 +- .../netapp/mgmt/2020-08-01/netapp/pools.go | 2 +- .../netapp/mgmt/2020-08-01/netapp/resource.go | 2 +- .../2020-08-01/netapp/snapshotpolicies.go | 2 +- .../mgmt/2020-08-01/netapp/snapshots.go | 2 +- .../netapp/mgmt/2020-08-01/netapp/vaults.go | 2 +- .../netapp/mgmt/2020-08-01/netapp/volumes.go | 6 +- .../mgmt/2020-09-01/netapp/CHANGELOG.md | 26 +- .../netapp/mgmt/2020-09-01/netapp/_meta.json | 2 +- .../mgmt/2020-09-01/netapp/accountbackups.go | 2 +- .../netapp/mgmt/2020-09-01/netapp/accounts.go | 2 +- .../mgmt/2020-09-01/netapp/backuppolicies.go | 2 +- .../netapp/mgmt/2020-09-01/netapp/backups.go | 2 +- .../netapp/mgmt/2020-09-01/netapp/client.go | 2 +- .../netapp/mgmt/2020-09-01/netapp/enums.go | 25 +- .../netapp/mgmt/2020-09-01/netapp/models.go | 17 +- .../mgmt/2020-09-01/netapp/operations.go | 2 +- .../netapp/mgmt/2020-09-01/netapp/pools.go | 2 +- .../netapp/mgmt/2020-09-01/netapp/resource.go | 2 +- .../2020-09-01/netapp/snapshotpolicies.go | 2 +- .../mgmt/2020-09-01/netapp/snapshots.go | 2 +- .../netapp/mgmt/2020-09-01/netapp/vaults.go | 2 +- .../netapp/mgmt/2020-09-01/netapp/volumes.go | 4 +- .../mgmt/2020-11-01/netapp/CHANGELOG.md | 26 +- .../netapp/mgmt/2020-11-01/netapp/_meta.json | 2 +- .../netapp/mgmt/2020-11-01/netapp/enums.go | 25 +- .../netapp/mgmt/2020-11-01/netapp/models.go | 10 +- .../mgmt/2020-12-01/netapp/CHANGELOG.md | 27 +- .../netapp/mgmt/2020-12-01/netapp/_meta.json | 2 +- .../netapp/mgmt/2020-12-01/netapp/enums.go | 25 +- .../netapp/mgmt/2020-12-01/netapp/models.go | 10 +- .../mgmt/2021-02-01/netapp/CHANGELOG.md | 2 +- .../netapp/mgmt/2021-02-01/netapp/_meta.json | 2 +- .../mgmt/2021-04-01/netapp/CHANGELOG.md | 10 +- .../netapp/mgmt/2021-04-01/netapp/_meta.json | 2 +- .../mgmt/2021-04-01/netapp/backuppolicies.go | 1 + .../netapp/mgmt/2021-04-01/netapp/backups.go | 1 + .../netapp/mgmt/2021-04-01/netapp/models.go | 22 + .../mgmt/2021-06-01/netapp/CHANGELOG.md | 2 + .../netapp/mgmt/2021-06-01/netapp/_meta.json | 11 + .../mgmt/2021-06-01/netapp/accountbackups.go | 289 ++ .../netapp/mgmt/2021-06-01/netapp/accounts.go | 626 +++ .../mgmt/2021-06-01/netapp/backuppolicies.go | 481 ++ .../netapp/mgmt/2021-06-01/netapp/backups.go | 738 +++ .../netapp/mgmt/2021-06-01/netapp/client.go | 41 + .../netapp/mgmt/2021-06-01/netapp/enums.go | 286 ++ .../netapp/mgmt/2021-06-01/netapp/models.go | 4333 +++++++++++++++++ .../2021-06-01/netapp/netappapi/interfaces.go | 137 + .../mgmt/2021-06-01/netapp/operations.go | 98 + .../netapp/mgmt/2021-06-01/netapp/pools.go | 549 +++ .../netapp/mgmt/2021-06-01/netapp/resource.go | 284 ++ .../2021-06-01/netapp/snapshotpolicies.go | 566 +++ .../mgmt/2021-06-01/netapp/snapshots.go | 543 +++ .../netapp/mgmt/2021-06-01/netapp/vaults.go | 116 + .../netapp/mgmt/2021-06-01/netapp/version.go | 19 + .../netapp/mgmt/2021-06-01/netapp/volumes.go | 1405 ++++++ .../mgmt/2017-08-15/netapp/CHANGELOG.md | 2 +- .../netapp/mgmt/2017-08-15/netapp/_meta.json | 2 +- .../netapp/mgmt/2017-08-15/netapp/accounts.go | 2 +- .../netapp/mgmt/2017-08-15/netapp/client.go | 2 +- .../mgmt/2017-08-15/netapp/mounttargets.go | 2 +- .../mgmt/2017-08-15/netapp/operations.go | 2 +- .../netapp/mgmt/2017-08-15/netapp/pools.go | 2 +- .../mgmt/2017-08-15/netapp/snapshots.go | 2 +- .../netapp/mgmt/2017-08-15/netapp/volumes.go | 2 +- .../2021-04-01-preview/netapp/CHANGELOG.md | 2 + .../mgmt/2021-04-01-preview/netapp/_meta.json | 11 + .../netapp/accountbackups.go | 289 ++ .../2021-04-01-preview/netapp/accounts.go | 512 ++ .../netapp/backuppolicies.go | 480 ++ .../mgmt/2021-04-01-preview/netapp/backups.go | 642 +++ .../mgmt/2021-04-01-preview/netapp/client.go | 41 + .../mgmt/2021-04-01-preview/netapp/enums.go | 277 ++ .../mgmt/2021-04-01-preview/netapp/models.go | 4195 ++++++++++++++++ .../netapp/netappapi/interfaces.go | 141 + .../2021-04-01-preview/netapp/operations.go | 98 + .../mgmt/2021-04-01-preview/netapp/pools.go | 548 +++ .../2021-04-01-preview/netapp/resource.go | 284 ++ .../netapp/resourceregioninfo.go | 106 + .../netapp/snapshotpolicies.go | 565 +++ .../2021-04-01-preview/netapp/snapshots.go | 543 +++ .../mgmt/2021-04-01-preview/netapp/vaults.go | 116 + .../mgmt/2021-04-01-preview/netapp/version.go | 19 + .../mgmt/2021-04-01-preview/netapp/volumes.go | 1401 ++++++ 222 files changed, 21372 insertions(+), 304 deletions(-) create mode 100644 services/netapp/mgmt/2021-06-01/netapp/CHANGELOG.md create mode 100644 services/netapp/mgmt/2021-06-01/netapp/_meta.json create mode 100644 services/netapp/mgmt/2021-06-01/netapp/accountbackups.go create mode 100644 services/netapp/mgmt/2021-06-01/netapp/accounts.go create mode 100644 services/netapp/mgmt/2021-06-01/netapp/backuppolicies.go create mode 100644 services/netapp/mgmt/2021-06-01/netapp/backups.go create mode 100644 services/netapp/mgmt/2021-06-01/netapp/client.go create mode 100644 services/netapp/mgmt/2021-06-01/netapp/enums.go create mode 100644 services/netapp/mgmt/2021-06-01/netapp/models.go create mode 100644 services/netapp/mgmt/2021-06-01/netapp/netappapi/interfaces.go create mode 100644 services/netapp/mgmt/2021-06-01/netapp/operations.go create mode 100644 services/netapp/mgmt/2021-06-01/netapp/pools.go create mode 100644 services/netapp/mgmt/2021-06-01/netapp/resource.go create mode 100644 services/netapp/mgmt/2021-06-01/netapp/snapshotpolicies.go create mode 100644 services/netapp/mgmt/2021-06-01/netapp/snapshots.go create mode 100644 services/netapp/mgmt/2021-06-01/netapp/vaults.go create mode 100644 services/netapp/mgmt/2021-06-01/netapp/version.go create mode 100644 services/netapp/mgmt/2021-06-01/netapp/volumes.go create mode 100644 services/preview/netapp/mgmt/2021-04-01-preview/netapp/CHANGELOG.md create mode 100644 services/preview/netapp/mgmt/2021-04-01-preview/netapp/_meta.json create mode 100644 services/preview/netapp/mgmt/2021-04-01-preview/netapp/accountbackups.go create mode 100644 services/preview/netapp/mgmt/2021-04-01-preview/netapp/accounts.go create mode 100644 services/preview/netapp/mgmt/2021-04-01-preview/netapp/backuppolicies.go create mode 100644 services/preview/netapp/mgmt/2021-04-01-preview/netapp/backups.go create mode 100644 services/preview/netapp/mgmt/2021-04-01-preview/netapp/client.go create mode 100644 services/preview/netapp/mgmt/2021-04-01-preview/netapp/enums.go create mode 100644 services/preview/netapp/mgmt/2021-04-01-preview/netapp/models.go create mode 100644 services/preview/netapp/mgmt/2021-04-01-preview/netapp/netappapi/interfaces.go create mode 100644 services/preview/netapp/mgmt/2021-04-01-preview/netapp/operations.go create mode 100644 services/preview/netapp/mgmt/2021-04-01-preview/netapp/pools.go create mode 100644 services/preview/netapp/mgmt/2021-04-01-preview/netapp/resource.go create mode 100644 services/preview/netapp/mgmt/2021-04-01-preview/netapp/resourceregioninfo.go create mode 100644 services/preview/netapp/mgmt/2021-04-01-preview/netapp/snapshotpolicies.go create mode 100644 services/preview/netapp/mgmt/2021-04-01-preview/netapp/snapshots.go create mode 100644 services/preview/netapp/mgmt/2021-04-01-preview/netapp/vaults.go create mode 100644 services/preview/netapp/mgmt/2021-04-01-preview/netapp/version.go create mode 100644 services/preview/netapp/mgmt/2021-04-01-preview/netapp/volumes.go diff --git a/services/netapp/mgmt/2019-05-01/netapp/CHANGELOG.md b/services/netapp/mgmt/2019-05-01/netapp/CHANGELOG.md index 52911e4cc5e4..a1ecf841edb0 100644 --- a/services/netapp/mgmt/2019-05-01/netapp/CHANGELOG.md +++ b/services/netapp/mgmt/2019-05-01/netapp/CHANGELOG.md @@ -1,2 +1,2 @@ -# Change History +# Unreleased diff --git a/services/netapp/mgmt/2019-05-01/netapp/_meta.json b/services/netapp/mgmt/2019-05-01/netapp/_meta.json index b765be1774a8..5ac42cad675f 100644 --- a/services/netapp/mgmt/2019-05-01/netapp/_meta.json +++ b/services/netapp/mgmt/2019-05-01/netapp/_meta.json @@ -1,5 +1,5 @@ { - "commit": "3c764635e7d442b3e74caf593029fcd440b3ef82", + "commit": "81ec17ce66f59c587024bfa8002fafb4436b83ef", "readme": "/_/azure-rest-api-specs/specification/netapp/resource-manager/readme.md", "tag": "package-netapp-2019-05-01", "use": "@microsoft.azure/autorest.go@2.1.183", diff --git a/services/netapp/mgmt/2019-05-01/netapp/accounts.go b/services/netapp/mgmt/2019-05-01/netapp/accounts.go index 1c99d1895c99..d3f09c374a4b 100644 --- a/services/netapp/mgmt/2019-05-01/netapp/accounts.go +++ b/services/netapp/mgmt/2019-05-01/netapp/accounts.go @@ -15,7 +15,7 @@ import ( "net/http" ) -// AccountsClient is the microsoft NetApp Azure Resource Provider specification +// AccountsClient is the microsoft NetApp Files Azure Resource Provider specification type AccountsClient struct { BaseClient } diff --git a/services/netapp/mgmt/2019-05-01/netapp/client.go b/services/netapp/mgmt/2019-05-01/netapp/client.go index 2ea4dc4ae0eb..0410b80ec1b9 100644 --- a/services/netapp/mgmt/2019-05-01/netapp/client.go +++ b/services/netapp/mgmt/2019-05-01/netapp/client.go @@ -1,6 +1,6 @@ // Package netapp implements the Azure ARM Netapp service API version 2019-05-01. // -// Microsoft NetApp Azure Resource Provider specification +// Microsoft NetApp Files Azure Resource Provider specification package netapp // Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/services/netapp/mgmt/2019-05-01/netapp/mounttargets.go b/services/netapp/mgmt/2019-05-01/netapp/mounttargets.go index 610ce6ea0cc7..d37f5e32d264 100644 --- a/services/netapp/mgmt/2019-05-01/netapp/mounttargets.go +++ b/services/netapp/mgmt/2019-05-01/netapp/mounttargets.go @@ -15,7 +15,7 @@ import ( "net/http" ) -// MountTargetsClient is the microsoft NetApp Azure Resource Provider specification +// MountTargetsClient is the microsoft NetApp Files Azure Resource Provider specification type MountTargetsClient struct { BaseClient } diff --git a/services/netapp/mgmt/2019-05-01/netapp/operations.go b/services/netapp/mgmt/2019-05-01/netapp/operations.go index e85c2a74f37d..1195087e58b4 100644 --- a/services/netapp/mgmt/2019-05-01/netapp/operations.go +++ b/services/netapp/mgmt/2019-05-01/netapp/operations.go @@ -14,7 +14,7 @@ import ( "net/http" ) -// OperationsClient is the microsoft NetApp Azure Resource Provider specification +// OperationsClient is the microsoft NetApp Files Azure Resource Provider specification type OperationsClient struct { BaseClient } diff --git a/services/netapp/mgmt/2019-05-01/netapp/pools.go b/services/netapp/mgmt/2019-05-01/netapp/pools.go index fc04f5970b37..e342f09e91a9 100644 --- a/services/netapp/mgmt/2019-05-01/netapp/pools.go +++ b/services/netapp/mgmt/2019-05-01/netapp/pools.go @@ -15,7 +15,7 @@ import ( "net/http" ) -// PoolsClient is the microsoft NetApp Azure Resource Provider specification +// PoolsClient is the microsoft NetApp Files Azure Resource Provider specification type PoolsClient struct { BaseClient } diff --git a/services/netapp/mgmt/2019-05-01/netapp/snapshots.go b/services/netapp/mgmt/2019-05-01/netapp/snapshots.go index 0591ae97ea0a..98a1b3b21258 100644 --- a/services/netapp/mgmt/2019-05-01/netapp/snapshots.go +++ b/services/netapp/mgmt/2019-05-01/netapp/snapshots.go @@ -15,7 +15,7 @@ import ( "net/http" ) -// SnapshotsClient is the microsoft NetApp Azure Resource Provider specification +// SnapshotsClient is the microsoft NetApp Files Azure Resource Provider specification type SnapshotsClient struct { BaseClient } diff --git a/services/netapp/mgmt/2019-05-01/netapp/volumes.go b/services/netapp/mgmt/2019-05-01/netapp/volumes.go index 70a5066a2b4e..86a95a5f8f23 100644 --- a/services/netapp/mgmt/2019-05-01/netapp/volumes.go +++ b/services/netapp/mgmt/2019-05-01/netapp/volumes.go @@ -15,7 +15,7 @@ import ( "net/http" ) -// VolumesClient is the microsoft NetApp Azure Resource Provider specification +// VolumesClient is the microsoft NetApp Files Azure Resource Provider specification type VolumesClient struct { BaseClient } diff --git a/services/netapp/mgmt/2019-06-01/netapp/CHANGELOG.md b/services/netapp/mgmt/2019-06-01/netapp/CHANGELOG.md index 52911e4cc5e4..a1ecf841edb0 100644 --- a/services/netapp/mgmt/2019-06-01/netapp/CHANGELOG.md +++ b/services/netapp/mgmt/2019-06-01/netapp/CHANGELOG.md @@ -1,2 +1,2 @@ -# Change History +# Unreleased diff --git a/services/netapp/mgmt/2019-06-01/netapp/_meta.json b/services/netapp/mgmt/2019-06-01/netapp/_meta.json index e83e748984f0..d155e7d4b0a8 100644 --- a/services/netapp/mgmt/2019-06-01/netapp/_meta.json +++ b/services/netapp/mgmt/2019-06-01/netapp/_meta.json @@ -1,5 +1,5 @@ { - "commit": "3c764635e7d442b3e74caf593029fcd440b3ef82", + "commit": "81ec17ce66f59c587024bfa8002fafb4436b83ef", "readme": "/_/azure-rest-api-specs/specification/netapp/resource-manager/readme.md", "tag": "package-netapp-2019-06-01", "use": "@microsoft.azure/autorest.go@2.1.183", diff --git a/services/netapp/mgmt/2019-06-01/netapp/accounts.go b/services/netapp/mgmt/2019-06-01/netapp/accounts.go index 5f9eae07c8cf..03673b380782 100644 --- a/services/netapp/mgmt/2019-06-01/netapp/accounts.go +++ b/services/netapp/mgmt/2019-06-01/netapp/accounts.go @@ -15,7 +15,7 @@ import ( "net/http" ) -// AccountsClient is the microsoft NetApp Azure Resource Provider specification +// AccountsClient is the microsoft NetApp Files Azure Resource Provider specification type AccountsClient struct { BaseClient } diff --git a/services/netapp/mgmt/2019-06-01/netapp/client.go b/services/netapp/mgmt/2019-06-01/netapp/client.go index bba5908f9189..63cad3c6467d 100644 --- a/services/netapp/mgmt/2019-06-01/netapp/client.go +++ b/services/netapp/mgmt/2019-06-01/netapp/client.go @@ -1,6 +1,6 @@ // Package netapp implements the Azure ARM Netapp service API version 2019-06-01. // -// Microsoft NetApp Azure Resource Provider specification +// Microsoft NetApp Files Azure Resource Provider specification package netapp // Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/services/netapp/mgmt/2019-06-01/netapp/models.go b/services/netapp/mgmt/2019-06-01/netapp/models.go index 71b0b7ad9b92..9bebfca7b748 100644 --- a/services/netapp/mgmt/2019-06-01/netapp/models.go +++ b/services/netapp/mgmt/2019-06-01/netapp/models.go @@ -1452,7 +1452,7 @@ type VolumeProperties struct { BaremetalTenantID *string `json:"baremetalTenantId,omitempty"` // SubnetID - The Azure Resource URI for a delegated subnet. Must have the delegation Microsoft.NetApp/volumes SubnetID *string `json:"subnetId,omitempty"` - // MountTargets - List of mount targets + // MountTargets - READ-ONLY; List of mount targets MountTargets *[]MountTargetProperties `json:"mountTargets,omitempty"` } @@ -1480,9 +1480,6 @@ func (vp VolumeProperties) MarshalJSON() ([]byte, error) { if vp.SubnetID != nil { objectMap["subnetId"] = vp.SubnetID } - if vp.MountTargets != nil { - objectMap["mountTargets"] = vp.MountTargets - } return json.Marshal(objectMap) } diff --git a/services/netapp/mgmt/2019-06-01/netapp/mounttargets.go b/services/netapp/mgmt/2019-06-01/netapp/mounttargets.go index 296270151a38..43db2e1cee64 100644 --- a/services/netapp/mgmt/2019-06-01/netapp/mounttargets.go +++ b/services/netapp/mgmt/2019-06-01/netapp/mounttargets.go @@ -15,7 +15,7 @@ import ( "net/http" ) -// MountTargetsClient is the microsoft NetApp Azure Resource Provider specification +// MountTargetsClient is the microsoft NetApp Files Azure Resource Provider specification type MountTargetsClient struct { BaseClient } diff --git a/services/netapp/mgmt/2019-06-01/netapp/operations.go b/services/netapp/mgmt/2019-06-01/netapp/operations.go index b1003c592906..5a398085f7fa 100644 --- a/services/netapp/mgmt/2019-06-01/netapp/operations.go +++ b/services/netapp/mgmt/2019-06-01/netapp/operations.go @@ -14,7 +14,7 @@ import ( "net/http" ) -// OperationsClient is the microsoft NetApp Azure Resource Provider specification +// OperationsClient is the microsoft NetApp Files Azure Resource Provider specification type OperationsClient struct { BaseClient } diff --git a/services/netapp/mgmt/2019-06-01/netapp/pools.go b/services/netapp/mgmt/2019-06-01/netapp/pools.go index 3a7347938d5d..b2060c8ab6a9 100644 --- a/services/netapp/mgmt/2019-06-01/netapp/pools.go +++ b/services/netapp/mgmt/2019-06-01/netapp/pools.go @@ -15,7 +15,7 @@ import ( "net/http" ) -// PoolsClient is the microsoft NetApp Azure Resource Provider specification +// PoolsClient is the microsoft NetApp Files Azure Resource Provider specification type PoolsClient struct { BaseClient } diff --git a/services/netapp/mgmt/2019-06-01/netapp/snapshots.go b/services/netapp/mgmt/2019-06-01/netapp/snapshots.go index 39f839dbeb65..80593876c5b7 100644 --- a/services/netapp/mgmt/2019-06-01/netapp/snapshots.go +++ b/services/netapp/mgmt/2019-06-01/netapp/snapshots.go @@ -15,7 +15,7 @@ import ( "net/http" ) -// SnapshotsClient is the microsoft NetApp Azure Resource Provider specification +// SnapshotsClient is the microsoft NetApp Files Azure Resource Provider specification type SnapshotsClient struct { BaseClient } diff --git a/services/netapp/mgmt/2019-06-01/netapp/volumes.go b/services/netapp/mgmt/2019-06-01/netapp/volumes.go index a35d641664a5..dd3595df8dd4 100644 --- a/services/netapp/mgmt/2019-06-01/netapp/volumes.go +++ b/services/netapp/mgmt/2019-06-01/netapp/volumes.go @@ -15,7 +15,7 @@ import ( "net/http" ) -// VolumesClient is the microsoft NetApp Azure Resource Provider specification +// VolumesClient is the microsoft NetApp Files Azure Resource Provider specification type VolumesClient struct { BaseClient } diff --git a/services/netapp/mgmt/2019-07-01/netapp/CHANGELOG.md b/services/netapp/mgmt/2019-07-01/netapp/CHANGELOG.md index 52911e4cc5e4..a1ecf841edb0 100644 --- a/services/netapp/mgmt/2019-07-01/netapp/CHANGELOG.md +++ b/services/netapp/mgmt/2019-07-01/netapp/CHANGELOG.md @@ -1,2 +1,2 @@ -# Change History +# Unreleased diff --git a/services/netapp/mgmt/2019-07-01/netapp/_meta.json b/services/netapp/mgmt/2019-07-01/netapp/_meta.json index 649fc9dcec1b..8ae2bba2a19f 100644 --- a/services/netapp/mgmt/2019-07-01/netapp/_meta.json +++ b/services/netapp/mgmt/2019-07-01/netapp/_meta.json @@ -1,5 +1,5 @@ { - "commit": "3c764635e7d442b3e74caf593029fcd440b3ef82", + "commit": "81ec17ce66f59c587024bfa8002fafb4436b83ef", "readme": "/_/azure-rest-api-specs/specification/netapp/resource-manager/readme.md", "tag": "package-netapp-2019-07-01", "use": "@microsoft.azure/autorest.go@2.1.183", diff --git a/services/netapp/mgmt/2019-07-01/netapp/accounts.go b/services/netapp/mgmt/2019-07-01/netapp/accounts.go index 4977573ec3b5..a6d2316e1a18 100644 --- a/services/netapp/mgmt/2019-07-01/netapp/accounts.go +++ b/services/netapp/mgmt/2019-07-01/netapp/accounts.go @@ -15,7 +15,7 @@ import ( "net/http" ) -// AccountsClient is the microsoft NetApp Azure Resource Provider specification +// AccountsClient is the microsoft NetApp Files Azure Resource Provider specification type AccountsClient struct { BaseClient } diff --git a/services/netapp/mgmt/2019-07-01/netapp/client.go b/services/netapp/mgmt/2019-07-01/netapp/client.go index 758159223918..9ec496cf80e1 100644 --- a/services/netapp/mgmt/2019-07-01/netapp/client.go +++ b/services/netapp/mgmt/2019-07-01/netapp/client.go @@ -1,6 +1,6 @@ // Package netapp implements the Azure ARM Netapp service API version 2019-07-01. // -// Microsoft NetApp Azure Resource Provider specification +// Microsoft NetApp Files Azure Resource Provider specification package netapp // Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/services/netapp/mgmt/2019-07-01/netapp/models.go b/services/netapp/mgmt/2019-07-01/netapp/models.go index 0d855edb1712..6ea92ee6e9cd 100644 --- a/services/netapp/mgmt/2019-07-01/netapp/models.go +++ b/services/netapp/mgmt/2019-07-01/netapp/models.go @@ -1442,7 +1442,7 @@ type VolumeProperties struct { UsageThreshold *int64 `json:"usageThreshold,omitempty"` // ExportPolicy - Set of export policy rules ExportPolicy *VolumePropertiesExportPolicy `json:"exportPolicy,omitempty"` - // ProtocolTypes - Set of protocol types + // ProtocolTypes - Set of protocol types, default NFSv3, CIFS fro SMB protocol ProtocolTypes *[]string `json:"protocolTypes,omitempty"` // ProvisioningState - READ-ONLY; Azure lifecycle management ProvisioningState *string `json:"provisioningState,omitempty"` @@ -1452,7 +1452,7 @@ type VolumeProperties struct { BaremetalTenantID *string `json:"baremetalTenantId,omitempty"` // SubnetID - The Azure Resource URI for a delegated subnet. Must have the delegation Microsoft.NetApp/volumes SubnetID *string `json:"subnetId,omitempty"` - // MountTargets - List of mount targets + // MountTargets - READ-ONLY; List of mount targets MountTargets *[]MountTargetProperties `json:"mountTargets,omitempty"` } @@ -1480,9 +1480,6 @@ func (vp VolumeProperties) MarshalJSON() ([]byte, error) { if vp.SubnetID != nil { objectMap["subnetId"] = vp.SubnetID } - if vp.MountTargets != nil { - objectMap["mountTargets"] = vp.MountTargets - } return json.Marshal(objectMap) } diff --git a/services/netapp/mgmt/2019-07-01/netapp/mounttargets.go b/services/netapp/mgmt/2019-07-01/netapp/mounttargets.go index 695ea6879de7..ac64629af906 100644 --- a/services/netapp/mgmt/2019-07-01/netapp/mounttargets.go +++ b/services/netapp/mgmt/2019-07-01/netapp/mounttargets.go @@ -15,7 +15,7 @@ import ( "net/http" ) -// MountTargetsClient is the microsoft NetApp Azure Resource Provider specification +// MountTargetsClient is the microsoft NetApp Files Azure Resource Provider specification type MountTargetsClient struct { BaseClient } diff --git a/services/netapp/mgmt/2019-07-01/netapp/operations.go b/services/netapp/mgmt/2019-07-01/netapp/operations.go index 27c1e837f8c6..a079d9e6984b 100644 --- a/services/netapp/mgmt/2019-07-01/netapp/operations.go +++ b/services/netapp/mgmt/2019-07-01/netapp/operations.go @@ -14,7 +14,7 @@ import ( "net/http" ) -// OperationsClient is the microsoft NetApp Azure Resource Provider specification +// OperationsClient is the microsoft NetApp Files Azure Resource Provider specification type OperationsClient struct { BaseClient } diff --git a/services/netapp/mgmt/2019-07-01/netapp/pools.go b/services/netapp/mgmt/2019-07-01/netapp/pools.go index 13af4ce9af4f..dbe95230a88c 100644 --- a/services/netapp/mgmt/2019-07-01/netapp/pools.go +++ b/services/netapp/mgmt/2019-07-01/netapp/pools.go @@ -15,7 +15,7 @@ import ( "net/http" ) -// PoolsClient is the microsoft NetApp Azure Resource Provider specification +// PoolsClient is the microsoft NetApp Files Azure Resource Provider specification type PoolsClient struct { BaseClient } diff --git a/services/netapp/mgmt/2019-07-01/netapp/snapshots.go b/services/netapp/mgmt/2019-07-01/netapp/snapshots.go index 259fad3e0566..af6405970ffe 100644 --- a/services/netapp/mgmt/2019-07-01/netapp/snapshots.go +++ b/services/netapp/mgmt/2019-07-01/netapp/snapshots.go @@ -15,7 +15,7 @@ import ( "net/http" ) -// SnapshotsClient is the microsoft NetApp Azure Resource Provider specification +// SnapshotsClient is the microsoft NetApp Files Azure Resource Provider specification type SnapshotsClient struct { BaseClient } diff --git a/services/netapp/mgmt/2019-07-01/netapp/volumes.go b/services/netapp/mgmt/2019-07-01/netapp/volumes.go index 92daf46ec100..88b6b74e405d 100644 --- a/services/netapp/mgmt/2019-07-01/netapp/volumes.go +++ b/services/netapp/mgmt/2019-07-01/netapp/volumes.go @@ -15,7 +15,7 @@ import ( "net/http" ) -// VolumesClient is the microsoft NetApp Azure Resource Provider specification +// VolumesClient is the microsoft NetApp Files Azure Resource Provider specification type VolumesClient struct { BaseClient } diff --git a/services/netapp/mgmt/2019-08-01/netapp/CHANGELOG.md b/services/netapp/mgmt/2019-08-01/netapp/CHANGELOG.md index 52911e4cc5e4..aee6a0bcc1e2 100644 --- a/services/netapp/mgmt/2019-08-01/netapp/CHANGELOG.md +++ b/services/netapp/mgmt/2019-08-01/netapp/CHANGELOG.md @@ -1,2 +1,9 @@ -# Change History +# Unreleased +## Additive Changes + +### Struct Changes + +#### New Struct Fields + +1. VolumeProperties.UsedBytes diff --git a/services/netapp/mgmt/2019-08-01/netapp/_meta.json b/services/netapp/mgmt/2019-08-01/netapp/_meta.json index 01c7a067cf86..57b45680485e 100644 --- a/services/netapp/mgmt/2019-08-01/netapp/_meta.json +++ b/services/netapp/mgmt/2019-08-01/netapp/_meta.json @@ -1,5 +1,5 @@ { - "commit": "3c764635e7d442b3e74caf593029fcd440b3ef82", + "commit": "81ec17ce66f59c587024bfa8002fafb4436b83ef", "readme": "/_/azure-rest-api-specs/specification/netapp/resource-manager/readme.md", "tag": "package-netapp-2019-08-01", "use": "@microsoft.azure/autorest.go@2.1.183", diff --git a/services/netapp/mgmt/2019-08-01/netapp/accounts.go b/services/netapp/mgmt/2019-08-01/netapp/accounts.go index 7bc8dbd9322a..70b09ad5a806 100644 --- a/services/netapp/mgmt/2019-08-01/netapp/accounts.go +++ b/services/netapp/mgmt/2019-08-01/netapp/accounts.go @@ -15,7 +15,7 @@ import ( "net/http" ) -// AccountsClient is the microsoft NetApp Azure Resource Provider specification +// AccountsClient is the microsoft NetApp Files Azure Resource Provider specification type AccountsClient struct { BaseClient } diff --git a/services/netapp/mgmt/2019-08-01/netapp/client.go b/services/netapp/mgmt/2019-08-01/netapp/client.go index a1ddf97db477..b4a078b259b1 100644 --- a/services/netapp/mgmt/2019-08-01/netapp/client.go +++ b/services/netapp/mgmt/2019-08-01/netapp/client.go @@ -1,6 +1,6 @@ // Package netapp implements the Azure ARM Netapp service API version 2019-08-01. // -// Microsoft NetApp Azure Resource Provider specification +// Microsoft NetApp Files Azure Resource Provider specification package netapp // Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/services/netapp/mgmt/2019-08-01/netapp/models.go b/services/netapp/mgmt/2019-08-01/netapp/models.go index 37910d44eb15..b9dbbe9d4133 100644 --- a/services/netapp/mgmt/2019-08-01/netapp/models.go +++ b/services/netapp/mgmt/2019-08-01/netapp/models.go @@ -1472,6 +1472,8 @@ type VolumeProperties struct { ServiceLevel ServiceLevel `json:"serviceLevel,omitempty"` // UsageThreshold - 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"` + // UsedBytes - READ-ONLY; Resource size in bytes, current storage usage for the volume in bytes + UsedBytes *int64 `json:"usedBytes,omitempty"` // ExportPolicy - Set of export policy rules ExportPolicy *VolumePropertiesExportPolicy `json:"exportPolicy,omitempty"` // ProtocolTypes - Set of protocol types diff --git a/services/netapp/mgmt/2019-08-01/netapp/mounttargets.go b/services/netapp/mgmt/2019-08-01/netapp/mounttargets.go index 2c3a032c3799..2f7613af436a 100644 --- a/services/netapp/mgmt/2019-08-01/netapp/mounttargets.go +++ b/services/netapp/mgmt/2019-08-01/netapp/mounttargets.go @@ -15,7 +15,7 @@ import ( "net/http" ) -// MountTargetsClient is the microsoft NetApp Azure Resource Provider specification +// MountTargetsClient is the microsoft NetApp Files Azure Resource Provider specification type MountTargetsClient struct { BaseClient } diff --git a/services/netapp/mgmt/2019-08-01/netapp/operations.go b/services/netapp/mgmt/2019-08-01/netapp/operations.go index aec5f7db6c1b..9042bdb504f8 100644 --- a/services/netapp/mgmt/2019-08-01/netapp/operations.go +++ b/services/netapp/mgmt/2019-08-01/netapp/operations.go @@ -14,7 +14,7 @@ import ( "net/http" ) -// OperationsClient is the microsoft NetApp Azure Resource Provider specification +// OperationsClient is the microsoft NetApp Files Azure Resource Provider specification type OperationsClient struct { BaseClient } diff --git a/services/netapp/mgmt/2019-08-01/netapp/pools.go b/services/netapp/mgmt/2019-08-01/netapp/pools.go index c6780aade151..a9b26f380e88 100644 --- a/services/netapp/mgmt/2019-08-01/netapp/pools.go +++ b/services/netapp/mgmt/2019-08-01/netapp/pools.go @@ -15,7 +15,7 @@ import ( "net/http" ) -// PoolsClient is the microsoft NetApp Azure Resource Provider specification +// PoolsClient is the microsoft NetApp Files Azure Resource Provider specification type PoolsClient struct { BaseClient } diff --git a/services/netapp/mgmt/2019-08-01/netapp/resource.go b/services/netapp/mgmt/2019-08-01/netapp/resource.go index b4505e57602e..74a08555fa77 100644 --- a/services/netapp/mgmt/2019-08-01/netapp/resource.go +++ b/services/netapp/mgmt/2019-08-01/netapp/resource.go @@ -15,7 +15,7 @@ import ( "net/http" ) -// ResourceClient is the microsoft NetApp Azure Resource Provider specification +// ResourceClient is the microsoft NetApp Files Azure Resource Provider specification type ResourceClient struct { BaseClient } diff --git a/services/netapp/mgmt/2019-08-01/netapp/snapshots.go b/services/netapp/mgmt/2019-08-01/netapp/snapshots.go index 5d8a8197e583..2b602ed07840 100644 --- a/services/netapp/mgmt/2019-08-01/netapp/snapshots.go +++ b/services/netapp/mgmt/2019-08-01/netapp/snapshots.go @@ -15,7 +15,7 @@ import ( "net/http" ) -// SnapshotsClient is the microsoft NetApp Azure Resource Provider specification +// SnapshotsClient is the microsoft NetApp Files Azure Resource Provider specification type SnapshotsClient struct { BaseClient } diff --git a/services/netapp/mgmt/2019-08-01/netapp/volumes.go b/services/netapp/mgmt/2019-08-01/netapp/volumes.go index 2fec143874c3..75250c076ad4 100644 --- a/services/netapp/mgmt/2019-08-01/netapp/volumes.go +++ b/services/netapp/mgmt/2019-08-01/netapp/volumes.go @@ -15,7 +15,7 @@ import ( "net/http" ) -// VolumesClient is the microsoft NetApp Azure Resource Provider specification +// VolumesClient is the microsoft NetApp Files Azure Resource Provider specification type VolumesClient struct { BaseClient } diff --git a/services/netapp/mgmt/2019-10-01/netapp/CHANGELOG.md b/services/netapp/mgmt/2019-10-01/netapp/CHANGELOG.md index 52911e4cc5e4..aee6a0bcc1e2 100644 --- a/services/netapp/mgmt/2019-10-01/netapp/CHANGELOG.md +++ b/services/netapp/mgmt/2019-10-01/netapp/CHANGELOG.md @@ -1,2 +1,9 @@ -# Change History +# Unreleased +## Additive Changes + +### Struct Changes + +#### New Struct Fields + +1. VolumeProperties.UsedBytes diff --git a/services/netapp/mgmt/2019-10-01/netapp/_meta.json b/services/netapp/mgmt/2019-10-01/netapp/_meta.json index 2fd962c81f7a..e0a6a1373def 100644 --- a/services/netapp/mgmt/2019-10-01/netapp/_meta.json +++ b/services/netapp/mgmt/2019-10-01/netapp/_meta.json @@ -1,5 +1,5 @@ { - "commit": "3c764635e7d442b3e74caf593029fcd440b3ef82", + "commit": "81ec17ce66f59c587024bfa8002fafb4436b83ef", "readme": "/_/azure-rest-api-specs/specification/netapp/resource-manager/readme.md", "tag": "package-netapp-2019-10-01", "use": "@microsoft.azure/autorest.go@2.1.183", diff --git a/services/netapp/mgmt/2019-10-01/netapp/accounts.go b/services/netapp/mgmt/2019-10-01/netapp/accounts.go index 1c63443e115f..20071a285424 100644 --- a/services/netapp/mgmt/2019-10-01/netapp/accounts.go +++ b/services/netapp/mgmt/2019-10-01/netapp/accounts.go @@ -15,7 +15,7 @@ import ( "net/http" ) -// AccountsClient is the microsoft NetApp Azure Resource Provider specification +// AccountsClient is the microsoft NetApp Files Azure Resource Provider specification type AccountsClient struct { BaseClient } diff --git a/services/netapp/mgmt/2019-10-01/netapp/client.go b/services/netapp/mgmt/2019-10-01/netapp/client.go index 14a4de2ff1ec..0d8c688c5efe 100644 --- a/services/netapp/mgmt/2019-10-01/netapp/client.go +++ b/services/netapp/mgmt/2019-10-01/netapp/client.go @@ -1,6 +1,6 @@ // Package netapp implements the Azure ARM Netapp service API version 2019-10-01. // -// Microsoft NetApp Azure Resource Provider specification +// Microsoft NetApp Files Azure Resource Provider specification package netapp // Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/services/netapp/mgmt/2019-10-01/netapp/models.go b/services/netapp/mgmt/2019-10-01/netapp/models.go index e1484680658a..ff0e4f475901 100644 --- a/services/netapp/mgmt/2019-10-01/netapp/models.go +++ b/services/netapp/mgmt/2019-10-01/netapp/models.go @@ -1495,9 +1495,11 @@ type VolumeProperties struct { ServiceLevel ServiceLevel `json:"serviceLevel,omitempty"` // UsageThreshold - 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"` + // UsedBytes - READ-ONLY; Resource size in bytes, current storage usage for the volume in bytes + UsedBytes *int64 `json:"usedBytes,omitempty"` // ExportPolicy - Set of export policy rules ExportPolicy *VolumePropertiesExportPolicy `json:"exportPolicy,omitempty"` - // ProtocolTypes - Set of protocol types + // ProtocolTypes - Set of protocol types, default NFSv3, CIFS for SMB protocol ProtocolTypes *[]string `json:"protocolTypes,omitempty"` // ProvisioningState - READ-ONLY; Azure lifecycle management ProvisioningState *string `json:"provisioningState,omitempty"` @@ -1507,7 +1509,7 @@ type VolumeProperties struct { BaremetalTenantID *string `json:"baremetalTenantId,omitempty"` // SubnetID - The Azure Resource URI for a delegated subnet. Must have the delegation Microsoft.NetApp/volumes SubnetID *string `json:"subnetId,omitempty"` - // MountTargets - List of mount targets + // MountTargets - READ-ONLY; List of mount targets MountTargets *[]MountTargetProperties `json:"mountTargets,omitempty"` // VolumeType - What type of volume is this VolumeType *string `json:"volumeType,omitempty"` @@ -1541,9 +1543,6 @@ func (vp VolumeProperties) MarshalJSON() ([]byte, error) { if vp.SubnetID != nil { objectMap["subnetId"] = vp.SubnetID } - if vp.MountTargets != nil { - objectMap["mountTargets"] = vp.MountTargets - } if vp.VolumeType != nil { objectMap["volumeType"] = vp.VolumeType } diff --git a/services/netapp/mgmt/2019-10-01/netapp/mounttargets.go b/services/netapp/mgmt/2019-10-01/netapp/mounttargets.go index d2aee7963f9e..d9c3421e74b6 100644 --- a/services/netapp/mgmt/2019-10-01/netapp/mounttargets.go +++ b/services/netapp/mgmt/2019-10-01/netapp/mounttargets.go @@ -15,7 +15,7 @@ import ( "net/http" ) -// MountTargetsClient is the microsoft NetApp Azure Resource Provider specification +// MountTargetsClient is the microsoft NetApp Files Azure Resource Provider specification type MountTargetsClient struct { BaseClient } diff --git a/services/netapp/mgmt/2019-10-01/netapp/operations.go b/services/netapp/mgmt/2019-10-01/netapp/operations.go index 3b3854834a29..a323337d4896 100644 --- a/services/netapp/mgmt/2019-10-01/netapp/operations.go +++ b/services/netapp/mgmt/2019-10-01/netapp/operations.go @@ -14,7 +14,7 @@ import ( "net/http" ) -// OperationsClient is the microsoft NetApp Azure Resource Provider specification +// OperationsClient is the microsoft NetApp Files Azure Resource Provider specification type OperationsClient struct { BaseClient } diff --git a/services/netapp/mgmt/2019-10-01/netapp/pools.go b/services/netapp/mgmt/2019-10-01/netapp/pools.go index 96ebe15bad35..2847edd88633 100644 --- a/services/netapp/mgmt/2019-10-01/netapp/pools.go +++ b/services/netapp/mgmt/2019-10-01/netapp/pools.go @@ -15,7 +15,7 @@ import ( "net/http" ) -// PoolsClient is the microsoft NetApp Azure Resource Provider specification +// PoolsClient is the microsoft NetApp Files Azure Resource Provider specification type PoolsClient struct { BaseClient } diff --git a/services/netapp/mgmt/2019-10-01/netapp/resource.go b/services/netapp/mgmt/2019-10-01/netapp/resource.go index 64fc218968f2..558ff182184b 100644 --- a/services/netapp/mgmt/2019-10-01/netapp/resource.go +++ b/services/netapp/mgmt/2019-10-01/netapp/resource.go @@ -15,7 +15,7 @@ import ( "net/http" ) -// ResourceClient is the microsoft NetApp Azure Resource Provider specification +// ResourceClient is the microsoft NetApp Files Azure Resource Provider specification type ResourceClient struct { BaseClient } diff --git a/services/netapp/mgmt/2019-10-01/netapp/snapshots.go b/services/netapp/mgmt/2019-10-01/netapp/snapshots.go index 7d5870e3482b..e5dc4e41a00a 100644 --- a/services/netapp/mgmt/2019-10-01/netapp/snapshots.go +++ b/services/netapp/mgmt/2019-10-01/netapp/snapshots.go @@ -15,7 +15,7 @@ import ( "net/http" ) -// SnapshotsClient is the microsoft NetApp Azure Resource Provider specification +// SnapshotsClient is the microsoft NetApp Files Azure Resource Provider specification type SnapshotsClient struct { BaseClient } diff --git a/services/netapp/mgmt/2019-10-01/netapp/volumes.go b/services/netapp/mgmt/2019-10-01/netapp/volumes.go index f9a6562a08de..9fc343350060 100644 --- a/services/netapp/mgmt/2019-10-01/netapp/volumes.go +++ b/services/netapp/mgmt/2019-10-01/netapp/volumes.go @@ -15,7 +15,7 @@ import ( "net/http" ) -// VolumesClient is the microsoft NetApp Azure Resource Provider specification +// VolumesClient is the microsoft NetApp Files Azure Resource Provider specification type VolumesClient struct { BaseClient } @@ -773,7 +773,7 @@ func (client VolumesClient) ReplicationStatusMethodResponder(resp *http.Response } // 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 source to destination. +// will reverse-resync the connection and sync from destination to source. // Parameters: // resourceGroupName - the name of the resource group. // accountName - the name of the NetApp account diff --git a/services/netapp/mgmt/2019-11-01/netapp/CHANGELOG.md b/services/netapp/mgmt/2019-11-01/netapp/CHANGELOG.md index 52911e4cc5e4..aee6a0bcc1e2 100644 --- a/services/netapp/mgmt/2019-11-01/netapp/CHANGELOG.md +++ b/services/netapp/mgmt/2019-11-01/netapp/CHANGELOG.md @@ -1,2 +1,9 @@ -# Change History +# Unreleased +## Additive Changes + +### Struct Changes + +#### New Struct Fields + +1. VolumeProperties.UsedBytes diff --git a/services/netapp/mgmt/2019-11-01/netapp/_meta.json b/services/netapp/mgmt/2019-11-01/netapp/_meta.json index 83930d4bf845..6e64bf84f466 100644 --- a/services/netapp/mgmt/2019-11-01/netapp/_meta.json +++ b/services/netapp/mgmt/2019-11-01/netapp/_meta.json @@ -1,5 +1,5 @@ { - "commit": "3c764635e7d442b3e74caf593029fcd440b3ef82", + "commit": "81ec17ce66f59c587024bfa8002fafb4436b83ef", "readme": "/_/azure-rest-api-specs/specification/netapp/resource-manager/readme.md", "tag": "package-netapp-2019-11-01", "use": "@microsoft.azure/autorest.go@2.1.183", diff --git a/services/netapp/mgmt/2019-11-01/netapp/accounts.go b/services/netapp/mgmt/2019-11-01/netapp/accounts.go index a1920de84d38..7e8dc7514a5b 100644 --- a/services/netapp/mgmt/2019-11-01/netapp/accounts.go +++ b/services/netapp/mgmt/2019-11-01/netapp/accounts.go @@ -15,7 +15,7 @@ import ( "net/http" ) -// AccountsClient is the microsoft NetApp Azure Resource Provider specification +// AccountsClient is the microsoft NetApp Files Azure Resource Provider specification type AccountsClient struct { BaseClient } diff --git a/services/netapp/mgmt/2019-11-01/netapp/client.go b/services/netapp/mgmt/2019-11-01/netapp/client.go index eab2a2a5a124..084b67febde1 100644 --- a/services/netapp/mgmt/2019-11-01/netapp/client.go +++ b/services/netapp/mgmt/2019-11-01/netapp/client.go @@ -1,6 +1,6 @@ // Package netapp implements the Azure ARM Netapp service API version 2019-11-01. // -// Microsoft NetApp Azure Resource Provider specification +// Microsoft NetApp Files Azure Resource Provider specification package netapp // Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/services/netapp/mgmt/2019-11-01/netapp/models.go b/services/netapp/mgmt/2019-11-01/netapp/models.go index d55cf8940a1e..5e64b0d1d914 100644 --- a/services/netapp/mgmt/2019-11-01/netapp/models.go +++ b/services/netapp/mgmt/2019-11-01/netapp/models.go @@ -1544,9 +1544,11 @@ type VolumeProperties struct { ServiceLevel ServiceLevel `json:"serviceLevel,omitempty"` // UsageThreshold - 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"` + // UsedBytes - READ-ONLY; Resource size in bytes, current storage usage for the volume in bytes + UsedBytes *int64 `json:"usedBytes,omitempty"` // ExportPolicy - Set of export policy rules ExportPolicy *VolumePropertiesExportPolicy `json:"exportPolicy,omitempty"` - // ProtocolTypes - Set of protocol types + // ProtocolTypes - Set of protocol types, default NFSv3, CIFS for SMB protocol ProtocolTypes *[]string `json:"protocolTypes,omitempty"` // ProvisioningState - READ-ONLY; Azure lifecycle management ProvisioningState *string `json:"provisioningState,omitempty"` @@ -1556,7 +1558,7 @@ type VolumeProperties struct { BaremetalTenantID *string `json:"baremetalTenantId,omitempty"` // SubnetID - The Azure Resource URI for a delegated subnet. Must have the delegation Microsoft.NetApp/volumes SubnetID *string `json:"subnetId,omitempty"` - // MountTargets - List of mount targets + // MountTargets - READ-ONLY; List of mount targets MountTargets *[]MountTargetProperties `json:"mountTargets,omitempty"` // VolumeType - What type of volume is this VolumeType *string `json:"volumeType,omitempty"` @@ -1590,9 +1592,6 @@ func (vp VolumeProperties) MarshalJSON() ([]byte, error) { if vp.SubnetID != nil { objectMap["subnetId"] = vp.SubnetID } - if vp.MountTargets != nil { - objectMap["mountTargets"] = vp.MountTargets - } if vp.VolumeType != nil { objectMap["volumeType"] = vp.VolumeType } diff --git a/services/netapp/mgmt/2019-11-01/netapp/operations.go b/services/netapp/mgmt/2019-11-01/netapp/operations.go index 105b6d8f0dda..f2dcc3f2478d 100644 --- a/services/netapp/mgmt/2019-11-01/netapp/operations.go +++ b/services/netapp/mgmt/2019-11-01/netapp/operations.go @@ -14,7 +14,7 @@ import ( "net/http" ) -// OperationsClient is the microsoft NetApp Azure Resource Provider specification +// OperationsClient is the microsoft NetApp Files Azure Resource Provider specification type OperationsClient struct { BaseClient } diff --git a/services/netapp/mgmt/2019-11-01/netapp/pools.go b/services/netapp/mgmt/2019-11-01/netapp/pools.go index 125e90551d4c..55629376cbeb 100644 --- a/services/netapp/mgmt/2019-11-01/netapp/pools.go +++ b/services/netapp/mgmt/2019-11-01/netapp/pools.go @@ -15,7 +15,7 @@ import ( "net/http" ) -// PoolsClient is the microsoft NetApp Azure Resource Provider specification +// PoolsClient is the microsoft NetApp Files Azure Resource Provider specification type PoolsClient struct { BaseClient } diff --git a/services/netapp/mgmt/2019-11-01/netapp/resource.go b/services/netapp/mgmt/2019-11-01/netapp/resource.go index 8ebb0f0ce6b7..7ba8a77909f2 100644 --- a/services/netapp/mgmt/2019-11-01/netapp/resource.go +++ b/services/netapp/mgmt/2019-11-01/netapp/resource.go @@ -15,7 +15,7 @@ import ( "net/http" ) -// ResourceClient is the microsoft NetApp Azure Resource Provider specification +// ResourceClient is the microsoft NetApp Files Azure Resource Provider specification type ResourceClient struct { BaseClient } diff --git a/services/netapp/mgmt/2019-11-01/netapp/snapshots.go b/services/netapp/mgmt/2019-11-01/netapp/snapshots.go index 51fb4c102d2d..761e49302b0d 100644 --- a/services/netapp/mgmt/2019-11-01/netapp/snapshots.go +++ b/services/netapp/mgmt/2019-11-01/netapp/snapshots.go @@ -15,7 +15,7 @@ import ( "net/http" ) -// SnapshotsClient is the microsoft NetApp Azure Resource Provider specification +// SnapshotsClient is the microsoft NetApp Files Azure Resource Provider specification type SnapshotsClient struct { BaseClient } diff --git a/services/netapp/mgmt/2019-11-01/netapp/volumes.go b/services/netapp/mgmt/2019-11-01/netapp/volumes.go index 79ce8def3b9f..7a28c6f96d8e 100644 --- a/services/netapp/mgmt/2019-11-01/netapp/volumes.go +++ b/services/netapp/mgmt/2019-11-01/netapp/volumes.go @@ -15,7 +15,7 @@ import ( "net/http" ) -// VolumesClient is the microsoft NetApp Azure Resource Provider specification +// VolumesClient is the microsoft NetApp Files Azure Resource Provider specification type VolumesClient struct { BaseClient } @@ -843,7 +843,7 @@ func (client VolumesClient) ReplicationStatusMethodResponder(resp *http.Response } // 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 source to destination. +// will reverse-resync the connection and sync from from destination to source. // Parameters: // resourceGroupName - the name of the resource group. // accountName - the name of the NetApp account diff --git a/services/netapp/mgmt/2020-02-01/netapp/CHANGELOG.md b/services/netapp/mgmt/2020-02-01/netapp/CHANGELOG.md index 1984ed2e57f2..aee6a0bcc1e2 100644 --- a/services/netapp/mgmt/2020-02-01/netapp/CHANGELOG.md +++ b/services/netapp/mgmt/2020-02-01/netapp/CHANGELOG.md @@ -1,7 +1,9 @@ -# Change History +# Unreleased ## Additive Changes -### New Funcs +### Struct Changes -1. SnapshotProperties.MarshalJSON() ([]byte, error) +#### New Struct Fields + +1. VolumeProperties.UsedBytes diff --git a/services/netapp/mgmt/2020-02-01/netapp/_meta.json b/services/netapp/mgmt/2020-02-01/netapp/_meta.json index 01f4b2e34f35..b8c8dc7d3ef8 100644 --- a/services/netapp/mgmt/2020-02-01/netapp/_meta.json +++ b/services/netapp/mgmt/2020-02-01/netapp/_meta.json @@ -1,5 +1,5 @@ { - "commit": "3c764635e7d442b3e74caf593029fcd440b3ef82", + "commit": "81ec17ce66f59c587024bfa8002fafb4436b83ef", "readme": "/_/azure-rest-api-specs/specification/netapp/resource-manager/readme.md", "tag": "package-netapp-2020-02-01", "use": "@microsoft.azure/autorest.go@2.1.183", diff --git a/services/netapp/mgmt/2020-02-01/netapp/accounts.go b/services/netapp/mgmt/2020-02-01/netapp/accounts.go index 0663004b6a2e..7e3a620147ce 100644 --- a/services/netapp/mgmt/2020-02-01/netapp/accounts.go +++ b/services/netapp/mgmt/2020-02-01/netapp/accounts.go @@ -15,7 +15,7 @@ import ( "net/http" ) -// AccountsClient is the microsoft NetApp Azure Resource Provider specification +// AccountsClient is the microsoft NetApp Files Azure Resource Provider specification type AccountsClient struct { BaseClient } diff --git a/services/netapp/mgmt/2020-02-01/netapp/client.go b/services/netapp/mgmt/2020-02-01/netapp/client.go index 4550404c9dde..921c055ba4ab 100644 --- a/services/netapp/mgmt/2020-02-01/netapp/client.go +++ b/services/netapp/mgmt/2020-02-01/netapp/client.go @@ -1,6 +1,6 @@ // Package netapp implements the Azure ARM Netapp service API version 2020-02-01. // -// Microsoft NetApp Azure Resource Provider specification +// Microsoft NetApp Files Azure Resource Provider specification package netapp // Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/services/netapp/mgmt/2020-02-01/netapp/models.go b/services/netapp/mgmt/2020-02-01/netapp/models.go index 34cb8b26c2da..1f71eb7cf254 100644 --- a/services/netapp/mgmt/2020-02-01/netapp/models.go +++ b/services/netapp/mgmt/2020-02-01/netapp/models.go @@ -1584,9 +1584,11 @@ type VolumeProperties struct { ServiceLevel VolumeServiceLevel `json:"serviceLevel,omitempty"` // UsageThreshold - 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"` + // UsedBytes - READ-ONLY; Resource size in bytes, current storage usage for the volume in bytes + UsedBytes *int64 `json:"usedBytes,omitempty"` // ExportPolicy - Set of export policy rules ExportPolicy *VolumePropertiesExportPolicy `json:"exportPolicy,omitempty"` - // ProtocolTypes - Set of protocol types + // ProtocolTypes - Set of protocol types, default NFSv3, CIFS for SMB protocol ProtocolTypes *[]string `json:"protocolTypes,omitempty"` // ProvisioningState - READ-ONLY; Azure lifecycle management ProvisioningState *string `json:"provisioningState,omitempty"` @@ -1596,7 +1598,7 @@ type VolumeProperties struct { BaremetalTenantID *string `json:"baremetalTenantId,omitempty"` // SubnetID - The Azure Resource URI for a delegated subnet. Must have the delegation Microsoft.NetApp/volumes SubnetID *string `json:"subnetId,omitempty"` - // MountTargets - List of mount targets + // MountTargets - READ-ONLY; List of mount targets MountTargets *[]MountTargetProperties `json:"mountTargets,omitempty"` // VolumeType - What type of volume is this VolumeType *string `json:"volumeType,omitempty"` @@ -1632,9 +1634,6 @@ func (vp VolumeProperties) MarshalJSON() ([]byte, error) { if vp.SubnetID != nil { objectMap["subnetId"] = vp.SubnetID } - if vp.MountTargets != nil { - objectMap["mountTargets"] = vp.MountTargets - } if vp.VolumeType != nil { objectMap["volumeType"] = vp.VolumeType } diff --git a/services/netapp/mgmt/2020-02-01/netapp/operations.go b/services/netapp/mgmt/2020-02-01/netapp/operations.go index 7eda55e1e906..0bf9d6f134ef 100644 --- a/services/netapp/mgmt/2020-02-01/netapp/operations.go +++ b/services/netapp/mgmt/2020-02-01/netapp/operations.go @@ -14,7 +14,7 @@ import ( "net/http" ) -// OperationsClient is the microsoft NetApp Azure Resource Provider specification +// OperationsClient is the microsoft NetApp Files Azure Resource Provider specification type OperationsClient struct { BaseClient } diff --git a/services/netapp/mgmt/2020-02-01/netapp/pools.go b/services/netapp/mgmt/2020-02-01/netapp/pools.go index c7f3a78cf7bf..20f20ce35bc0 100644 --- a/services/netapp/mgmt/2020-02-01/netapp/pools.go +++ b/services/netapp/mgmt/2020-02-01/netapp/pools.go @@ -15,7 +15,7 @@ import ( "net/http" ) -// PoolsClient is the microsoft NetApp Azure Resource Provider specification +// PoolsClient is the microsoft NetApp Files Azure Resource Provider specification type PoolsClient struct { BaseClient } diff --git a/services/netapp/mgmt/2020-02-01/netapp/resource.go b/services/netapp/mgmt/2020-02-01/netapp/resource.go index d4a458228219..67237cc65676 100644 --- a/services/netapp/mgmt/2020-02-01/netapp/resource.go +++ b/services/netapp/mgmt/2020-02-01/netapp/resource.go @@ -15,7 +15,7 @@ import ( "net/http" ) -// ResourceClient is the microsoft NetApp Azure Resource Provider specification +// ResourceClient is the microsoft NetApp Files Azure Resource Provider specification type ResourceClient struct { BaseClient } diff --git a/services/netapp/mgmt/2020-02-01/netapp/snapshots.go b/services/netapp/mgmt/2020-02-01/netapp/snapshots.go index 0d4b3cc28c58..092a29d99063 100644 --- a/services/netapp/mgmt/2020-02-01/netapp/snapshots.go +++ b/services/netapp/mgmt/2020-02-01/netapp/snapshots.go @@ -15,7 +15,7 @@ import ( "net/http" ) -// SnapshotsClient is the microsoft NetApp Azure Resource Provider specification +// SnapshotsClient is the microsoft NetApp Files Azure Resource Provider specification type SnapshotsClient struct { BaseClient } diff --git a/services/netapp/mgmt/2020-02-01/netapp/volumes.go b/services/netapp/mgmt/2020-02-01/netapp/volumes.go index 2642d4b272ad..1ed4cacf4396 100644 --- a/services/netapp/mgmt/2020-02-01/netapp/volumes.go +++ b/services/netapp/mgmt/2020-02-01/netapp/volumes.go @@ -15,7 +15,7 @@ import ( "net/http" ) -// VolumesClient is the microsoft NetApp Azure Resource Provider specification +// VolumesClient is the microsoft NetApp Files Azure Resource Provider specification type VolumesClient struct { BaseClient } @@ -843,7 +843,7 @@ func (client VolumesClient) ReplicationStatusMethodResponder(resp *http.Response } // 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 source to destination. +// will reverse-resync the connection and sync from destination to source. // Parameters: // resourceGroupName - the name of the resource group. // accountName - the name of the NetApp account diff --git a/services/netapp/mgmt/2020-03-01/netapp/CHANGELOG.md b/services/netapp/mgmt/2020-03-01/netapp/CHANGELOG.md index 1984ed2e57f2..a1ecf841edb0 100644 --- a/services/netapp/mgmt/2020-03-01/netapp/CHANGELOG.md +++ b/services/netapp/mgmt/2020-03-01/netapp/CHANGELOG.md @@ -1,7 +1,2 @@ -# Change History +# Unreleased -## Additive Changes - -### New Funcs - -1. SnapshotProperties.MarshalJSON() ([]byte, error) diff --git a/services/netapp/mgmt/2020-03-01/netapp/_meta.json b/services/netapp/mgmt/2020-03-01/netapp/_meta.json index a3a0bec6167c..4b67a81ea1c0 100644 --- a/services/netapp/mgmt/2020-03-01/netapp/_meta.json +++ b/services/netapp/mgmt/2020-03-01/netapp/_meta.json @@ -1,5 +1,5 @@ { - "commit": "3c764635e7d442b3e74caf593029fcd440b3ef82", + "commit": "81ec17ce66f59c587024bfa8002fafb4436b83ef", "readme": "/_/azure-rest-api-specs/specification/netapp/resource-manager/readme.md", "tag": "package-netapp-2020-03-01", "use": "@microsoft.azure/autorest.go@2.1.183", diff --git a/services/netapp/mgmt/2020-03-01/netapp/accounts.go b/services/netapp/mgmt/2020-03-01/netapp/accounts.go index b7e738e40b60..c316f1c4e9b4 100644 --- a/services/netapp/mgmt/2020-03-01/netapp/accounts.go +++ b/services/netapp/mgmt/2020-03-01/netapp/accounts.go @@ -15,7 +15,7 @@ import ( "net/http" ) -// AccountsClient is the microsoft NetApp Azure Resource Provider specification +// AccountsClient is the microsoft NetApp Files Azure Resource Provider specification type AccountsClient struct { BaseClient } diff --git a/services/netapp/mgmt/2020-03-01/netapp/client.go b/services/netapp/mgmt/2020-03-01/netapp/client.go index 3a2009c90771..fa34b5eafd89 100644 --- a/services/netapp/mgmt/2020-03-01/netapp/client.go +++ b/services/netapp/mgmt/2020-03-01/netapp/client.go @@ -1,6 +1,6 @@ // Package netapp implements the Azure ARM Netapp service API version 2020-03-01. // -// Microsoft NetApp Azure Resource Provider specification +// Microsoft NetApp Files Azure Resource Provider specification package netapp // Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/services/netapp/mgmt/2020-03-01/netapp/models.go b/services/netapp/mgmt/2020-03-01/netapp/models.go index 22507610d980..6f1e6212fb2f 100644 --- a/services/netapp/mgmt/2020-03-01/netapp/models.go +++ b/services/netapp/mgmt/2020-03-01/netapp/models.go @@ -1586,7 +1586,7 @@ type VolumeProperties struct { UsageThreshold *int64 `json:"usageThreshold,omitempty"` // ExportPolicy - Set of export policy rules ExportPolicy *VolumePropertiesExportPolicy `json:"exportPolicy,omitempty"` - // ProtocolTypes - Set of protocol types + // ProtocolTypes - Set of protocol types, default NFSv3, CIFS for SMB protocol ProtocolTypes *[]string `json:"protocolTypes,omitempty"` // ProvisioningState - READ-ONLY; Azure lifecycle management ProvisioningState *string `json:"provisioningState,omitempty"` @@ -1596,7 +1596,7 @@ type VolumeProperties struct { BaremetalTenantID *string `json:"baremetalTenantId,omitempty"` // SubnetID - The Azure Resource URI for a delegated subnet. Must have the delegation Microsoft.NetApp/volumes SubnetID *string `json:"subnetId,omitempty"` - // MountTargets - List of mount targets + // MountTargets - READ-ONLY; List of mount targets MountTargets *[]MountTargetProperties `json:"mountTargets,omitempty"` // VolumeType - What type of volume is this VolumeType *string `json:"volumeType,omitempty"` @@ -1632,9 +1632,6 @@ func (vp VolumeProperties) MarshalJSON() ([]byte, error) { if vp.SubnetID != nil { objectMap["subnetId"] = vp.SubnetID } - if vp.MountTargets != nil { - objectMap["mountTargets"] = vp.MountTargets - } if vp.VolumeType != nil { objectMap["volumeType"] = vp.VolumeType } diff --git a/services/netapp/mgmt/2020-03-01/netapp/operations.go b/services/netapp/mgmt/2020-03-01/netapp/operations.go index acbb0da59dd5..375187c3f869 100644 --- a/services/netapp/mgmt/2020-03-01/netapp/operations.go +++ b/services/netapp/mgmt/2020-03-01/netapp/operations.go @@ -14,7 +14,7 @@ import ( "net/http" ) -// OperationsClient is the microsoft NetApp Azure Resource Provider specification +// OperationsClient is the microsoft NetApp Files Azure Resource Provider specification type OperationsClient struct { BaseClient } diff --git a/services/netapp/mgmt/2020-03-01/netapp/pools.go b/services/netapp/mgmt/2020-03-01/netapp/pools.go index 4a7d599bac6f..bf916971c813 100644 --- a/services/netapp/mgmt/2020-03-01/netapp/pools.go +++ b/services/netapp/mgmt/2020-03-01/netapp/pools.go @@ -15,7 +15,7 @@ import ( "net/http" ) -// PoolsClient is the microsoft NetApp Azure Resource Provider specification +// PoolsClient is the microsoft NetApp Files Azure Resource Provider specification type PoolsClient struct { BaseClient } diff --git a/services/netapp/mgmt/2020-03-01/netapp/resource.go b/services/netapp/mgmt/2020-03-01/netapp/resource.go index 1050fadbc1e6..d28af7b1222f 100644 --- a/services/netapp/mgmt/2020-03-01/netapp/resource.go +++ b/services/netapp/mgmt/2020-03-01/netapp/resource.go @@ -15,7 +15,7 @@ import ( "net/http" ) -// ResourceClient is the microsoft NetApp Azure Resource Provider specification +// ResourceClient is the microsoft NetApp Files Azure Resource Provider specification type ResourceClient struct { BaseClient } diff --git a/services/netapp/mgmt/2020-03-01/netapp/snapshots.go b/services/netapp/mgmt/2020-03-01/netapp/snapshots.go index d12e8cf7121b..b002907ee6d7 100644 --- a/services/netapp/mgmt/2020-03-01/netapp/snapshots.go +++ b/services/netapp/mgmt/2020-03-01/netapp/snapshots.go @@ -15,7 +15,7 @@ import ( "net/http" ) -// SnapshotsClient is the microsoft NetApp Azure Resource Provider specification +// SnapshotsClient is the microsoft NetApp Files Azure Resource Provider specification type SnapshotsClient struct { BaseClient } diff --git a/services/netapp/mgmt/2020-03-01/netapp/volumes.go b/services/netapp/mgmt/2020-03-01/netapp/volumes.go index fce10064956f..3fb3b9fbcec7 100644 --- a/services/netapp/mgmt/2020-03-01/netapp/volumes.go +++ b/services/netapp/mgmt/2020-03-01/netapp/volumes.go @@ -15,7 +15,7 @@ import ( "net/http" ) -// VolumesClient is the microsoft NetApp Azure Resource Provider specification +// VolumesClient is the microsoft NetApp Files Azure Resource Provider specification type VolumesClient struct { BaseClient } @@ -843,7 +843,7 @@ func (client VolumesClient) ReplicationStatusMethodResponder(resp *http.Response } // 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 source to destination. +// will reverse-resync the connection and sync from destination to source. // Parameters: // resourceGroupName - the name of the resource group. // accountName - the name of the NetApp account diff --git a/services/netapp/mgmt/2020-05-01/netapp/CHANGELOG.md b/services/netapp/mgmt/2020-05-01/netapp/CHANGELOG.md index 1984ed2e57f2..e719af10d065 100644 --- a/services/netapp/mgmt/2020-05-01/netapp/CHANGELOG.md +++ b/services/netapp/mgmt/2020-05-01/netapp/CHANGELOG.md @@ -1,7 +1,20 @@ -# Change History +# Unreleased + +## Breaking Changes + +### Signature Changes + +#### Struct Fields + +1. BackupProperties.BackupType changed type from *string to BackupType ## Additive Changes +### New Constants + +1. BackupType.Manual +1. BackupType.Scheduled + ### New Funcs -1. SnapshotProperties.MarshalJSON() ([]byte, error) +1. PossibleBackupTypeValues() []BackupType diff --git a/services/netapp/mgmt/2020-05-01/netapp/_meta.json b/services/netapp/mgmt/2020-05-01/netapp/_meta.json index 42a13fa3aafe..9e2667dfbb92 100644 --- a/services/netapp/mgmt/2020-05-01/netapp/_meta.json +++ b/services/netapp/mgmt/2020-05-01/netapp/_meta.json @@ -1,5 +1,5 @@ { - "commit": "3c764635e7d442b3e74caf593029fcd440b3ef82", + "commit": "81ec17ce66f59c587024bfa8002fafb4436b83ef", "readme": "/_/azure-rest-api-specs/specification/netapp/resource-manager/readme.md", "tag": "package-netapp-2020-05-01", "use": "@microsoft.azure/autorest.go@2.1.183", diff --git a/services/netapp/mgmt/2020-05-01/netapp/accountbackups.go b/services/netapp/mgmt/2020-05-01/netapp/accountbackups.go index 096170fe2e0e..0bad7198bc53 100644 --- a/services/netapp/mgmt/2020-05-01/netapp/accountbackups.go +++ b/services/netapp/mgmt/2020-05-01/netapp/accountbackups.go @@ -15,7 +15,7 @@ import ( "net/http" ) -// AccountBackupsClient is the microsoft NetApp Azure Resource Provider specification +// AccountBackupsClient is the microsoft NetApp Files Azure Resource Provider specification type AccountBackupsClient struct { BaseClient } diff --git a/services/netapp/mgmt/2020-05-01/netapp/accounts.go b/services/netapp/mgmt/2020-05-01/netapp/accounts.go index 320997e299c6..ffa7d1fb09c4 100644 --- a/services/netapp/mgmt/2020-05-01/netapp/accounts.go +++ b/services/netapp/mgmt/2020-05-01/netapp/accounts.go @@ -15,7 +15,7 @@ import ( "net/http" ) -// AccountsClient is the microsoft NetApp Azure Resource Provider specification +// AccountsClient is the microsoft NetApp Files Azure Resource Provider specification type AccountsClient struct { BaseClient } diff --git a/services/netapp/mgmt/2020-05-01/netapp/backuppolicies.go b/services/netapp/mgmt/2020-05-01/netapp/backuppolicies.go index 8c8b6d9f9136..03a8cecfa0bd 100644 --- a/services/netapp/mgmt/2020-05-01/netapp/backuppolicies.go +++ b/services/netapp/mgmt/2020-05-01/netapp/backuppolicies.go @@ -15,7 +15,7 @@ import ( "net/http" ) -// BackupPoliciesClient is the microsoft NetApp Azure Resource Provider specification +// BackupPoliciesClient is the microsoft NetApp Files Azure Resource Provider specification type BackupPoliciesClient struct { BaseClient } diff --git a/services/netapp/mgmt/2020-05-01/netapp/backups.go b/services/netapp/mgmt/2020-05-01/netapp/backups.go index 6d8ed4a875b9..3436a49113fa 100644 --- a/services/netapp/mgmt/2020-05-01/netapp/backups.go +++ b/services/netapp/mgmt/2020-05-01/netapp/backups.go @@ -15,7 +15,7 @@ import ( "net/http" ) -// BackupsClient is the microsoft NetApp Azure Resource Provider specification +// BackupsClient is the microsoft NetApp Files Azure Resource Provider specification type BackupsClient struct { BaseClient } diff --git a/services/netapp/mgmt/2020-05-01/netapp/client.go b/services/netapp/mgmt/2020-05-01/netapp/client.go index 0b5edf65f1f9..6b5938951781 100644 --- a/services/netapp/mgmt/2020-05-01/netapp/client.go +++ b/services/netapp/mgmt/2020-05-01/netapp/client.go @@ -1,6 +1,6 @@ // Package netapp implements the Azure ARM Netapp service API version 2020-05-01. // -// Microsoft NetApp Azure Resource Provider specification +// Microsoft NetApp Files Azure Resource Provider specification package netapp // Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/services/netapp/mgmt/2020-05-01/netapp/enums.go b/services/netapp/mgmt/2020-05-01/netapp/enums.go index de929b93ddac..7ae108a54cb3 100644 --- a/services/netapp/mgmt/2020-05-01/netapp/enums.go +++ b/services/netapp/mgmt/2020-05-01/netapp/enums.go @@ -6,6 +6,21 @@ package netapp // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. +// BackupType enumerates the values for backup type. +type BackupType string + +const ( + // Manual Manual backup + Manual BackupType = "Manual" + // Scheduled Scheduled backup + Scheduled BackupType = "Scheduled" +) + +// PossibleBackupTypeValues returns an array of possible values for the BackupType const type. +func PossibleBackupTypeValues() []BackupType { + return []BackupType{Manual, Scheduled} +} + // CheckNameResourceTypes enumerates the values for check name resource types. type CheckNameResourceTypes string diff --git a/services/netapp/mgmt/2020-05-01/netapp/models.go b/services/netapp/mgmt/2020-05-01/netapp/models.go index 7c895154bbd0..9d776d03d4b7 100644 --- a/services/netapp/mgmt/2020-05-01/netapp/models.go +++ b/services/netapp/mgmt/2020-05-01/netapp/models.go @@ -977,8 +977,8 @@ type BackupProperties struct { Size *int64 `json:"size,omitempty"` // Label - Label for backup Label *string `json:"label,omitempty"` - // BackupType - READ-ONLY; Type of backup adhoc or scheduled - BackupType *string `json:"backupType,omitempty"` + // BackupType - READ-ONLY; Type of backup Manual or Scheduled. Possible values include: 'Manual', 'Scheduled' + BackupType BackupType `json:"backupType,omitempty"` } // MarshalJSON is the custom marshaler for BackupProperties. @@ -2835,7 +2835,7 @@ type VolumeProperties struct { UsageThreshold *int64 `json:"usageThreshold,omitempty"` // ExportPolicy - Set of export policy rules ExportPolicy *VolumePropertiesExportPolicy `json:"exportPolicy,omitempty"` - // ProtocolTypes - Set of protocol types + // ProtocolTypes - Set of protocol types, default NFSv3, CIFS for SMB protocol ProtocolTypes *[]string `json:"protocolTypes,omitempty"` // ProvisioningState - READ-ONLY; Azure lifecycle management ProvisioningState *string `json:"provisioningState,omitempty"` @@ -2847,7 +2847,7 @@ type VolumeProperties struct { BaremetalTenantID *string `json:"baremetalTenantId,omitempty"` // SubnetID - The Azure Resource URI for a delegated subnet. Must have the delegation Microsoft.NetApp/volumes SubnetID *string `json:"subnetId,omitempty"` - // MountTargets - List of mount targets + // MountTargets - READ-ONLY; List of mount targets MountTargets *[]MountTargetProperties `json:"mountTargets,omitempty"` // VolumeType - What type of volume is this VolumeType *string `json:"volumeType,omitempty"` @@ -2888,9 +2888,6 @@ func (vp VolumeProperties) MarshalJSON() ([]byte, error) { if vp.SubnetID != nil { objectMap["subnetId"] = vp.SubnetID } - if vp.MountTargets != nil { - objectMap["mountTargets"] = vp.MountTargets - } if vp.VolumeType != nil { objectMap["volumeType"] = vp.VolumeType } diff --git a/services/netapp/mgmt/2020-05-01/netapp/operations.go b/services/netapp/mgmt/2020-05-01/netapp/operations.go index fbf82938974e..221dc09ecd58 100644 --- a/services/netapp/mgmt/2020-05-01/netapp/operations.go +++ b/services/netapp/mgmt/2020-05-01/netapp/operations.go @@ -14,7 +14,7 @@ import ( "net/http" ) -// OperationsClient is the microsoft NetApp Azure Resource Provider specification +// OperationsClient is the microsoft NetApp Files Azure Resource Provider specification type OperationsClient struct { BaseClient } diff --git a/services/netapp/mgmt/2020-05-01/netapp/pools.go b/services/netapp/mgmt/2020-05-01/netapp/pools.go index db5547b3bc22..370afb452ed5 100644 --- a/services/netapp/mgmt/2020-05-01/netapp/pools.go +++ b/services/netapp/mgmt/2020-05-01/netapp/pools.go @@ -15,7 +15,7 @@ import ( "net/http" ) -// PoolsClient is the microsoft NetApp Azure Resource Provider specification +// PoolsClient is the microsoft NetApp Files Azure Resource Provider specification type PoolsClient struct { BaseClient } diff --git a/services/netapp/mgmt/2020-05-01/netapp/resource.go b/services/netapp/mgmt/2020-05-01/netapp/resource.go index 5b75b4d51a80..fa428e67072e 100644 --- a/services/netapp/mgmt/2020-05-01/netapp/resource.go +++ b/services/netapp/mgmt/2020-05-01/netapp/resource.go @@ -15,7 +15,7 @@ import ( "net/http" ) -// ResourceClient is the microsoft NetApp Azure Resource Provider specification +// ResourceClient is the microsoft NetApp Files Azure Resource Provider specification type ResourceClient struct { BaseClient } diff --git a/services/netapp/mgmt/2020-05-01/netapp/snapshotpolicies.go b/services/netapp/mgmt/2020-05-01/netapp/snapshotpolicies.go index 3763827963cd..a4b1b254fe72 100644 --- a/services/netapp/mgmt/2020-05-01/netapp/snapshotpolicies.go +++ b/services/netapp/mgmt/2020-05-01/netapp/snapshotpolicies.go @@ -15,7 +15,7 @@ import ( "net/http" ) -// SnapshotPoliciesClient is the microsoft NetApp Azure Resource Provider specification +// SnapshotPoliciesClient is the microsoft NetApp Files Azure Resource Provider specification type SnapshotPoliciesClient struct { BaseClient } diff --git a/services/netapp/mgmt/2020-05-01/netapp/snapshots.go b/services/netapp/mgmt/2020-05-01/netapp/snapshots.go index 52c86cb5efc5..55cab4479b88 100644 --- a/services/netapp/mgmt/2020-05-01/netapp/snapshots.go +++ b/services/netapp/mgmt/2020-05-01/netapp/snapshots.go @@ -15,7 +15,7 @@ import ( "net/http" ) -// SnapshotsClient is the microsoft NetApp Azure Resource Provider specification +// SnapshotsClient is the microsoft NetApp Files Azure Resource Provider specification type SnapshotsClient struct { BaseClient } diff --git a/services/netapp/mgmt/2020-05-01/netapp/vaults.go b/services/netapp/mgmt/2020-05-01/netapp/vaults.go index c9d45dc3bb1d..23ef0d102997 100644 --- a/services/netapp/mgmt/2020-05-01/netapp/vaults.go +++ b/services/netapp/mgmt/2020-05-01/netapp/vaults.go @@ -15,7 +15,7 @@ import ( "net/http" ) -// VaultsClient is the microsoft NetApp Azure Resource Provider specification +// VaultsClient is the microsoft NetApp Files Azure Resource Provider specification type VaultsClient struct { BaseClient } diff --git a/services/netapp/mgmt/2020-05-01/netapp/volumes.go b/services/netapp/mgmt/2020-05-01/netapp/volumes.go index 0ac6ad939b57..89caaa399454 100644 --- a/services/netapp/mgmt/2020-05-01/netapp/volumes.go +++ b/services/netapp/mgmt/2020-05-01/netapp/volumes.go @@ -15,7 +15,7 @@ import ( "net/http" ) -// VolumesClient is the microsoft NetApp Azure Resource Provider specification +// VolumesClient is the microsoft NetApp Files Azure Resource Provider specification type VolumesClient struct { BaseClient } @@ -1053,7 +1053,7 @@ func (client VolumesClient) ReplicationStatusMethodResponder(resp *http.Response } // 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 source to destination. +// will reverse-resync the connection and sync from destination to source. // Parameters: // resourceGroupName - the name of the resource group. // accountName - the name of the NetApp account diff --git a/services/netapp/mgmt/2020-06-01/netapp/CHANGELOG.md b/services/netapp/mgmt/2020-06-01/netapp/CHANGELOG.md index 1984ed2e57f2..a5415c33a3a9 100644 --- a/services/netapp/mgmt/2020-06-01/netapp/CHANGELOG.md +++ b/services/netapp/mgmt/2020-06-01/netapp/CHANGELOG.md @@ -1,7 +1,29 @@ -# Change History +# Unreleased + +## Breaking Changes + +### Removed Constants + +1. QosType.Auto + +### Signature Changes + +#### Const Types + +1. Manual changed type from QosType to BackupType + +#### Struct Fields + +1. BackupProperties.BackupType changed type from *string to BackupType ## Additive Changes +### New Constants + +1. BackupType.Scheduled +1. QosType.QosTypeAuto +1. QosType.QosTypeManual + ### New Funcs -1. SnapshotProperties.MarshalJSON() ([]byte, error) +1. PossibleBackupTypeValues() []BackupType diff --git a/services/netapp/mgmt/2020-06-01/netapp/_meta.json b/services/netapp/mgmt/2020-06-01/netapp/_meta.json index 410b0ac4e08a..84c0c5da661e 100644 --- a/services/netapp/mgmt/2020-06-01/netapp/_meta.json +++ b/services/netapp/mgmt/2020-06-01/netapp/_meta.json @@ -1,5 +1,5 @@ { - "commit": "3c764635e7d442b3e74caf593029fcd440b3ef82", + "commit": "81ec17ce66f59c587024bfa8002fafb4436b83ef", "readme": "/_/azure-rest-api-specs/specification/netapp/resource-manager/readme.md", "tag": "package-netapp-2020-06-01", "use": "@microsoft.azure/autorest.go@2.1.183", diff --git a/services/netapp/mgmt/2020-06-01/netapp/accountbackups.go b/services/netapp/mgmt/2020-06-01/netapp/accountbackups.go index 500bcd2933aa..33ed7f0d153d 100644 --- a/services/netapp/mgmt/2020-06-01/netapp/accountbackups.go +++ b/services/netapp/mgmt/2020-06-01/netapp/accountbackups.go @@ -15,7 +15,7 @@ import ( "net/http" ) -// AccountBackupsClient is the microsoft NetApp Azure Resource Provider specification +// AccountBackupsClient is the microsoft NetApp Files Azure Resource Provider specification type AccountBackupsClient struct { BaseClient } diff --git a/services/netapp/mgmt/2020-06-01/netapp/accounts.go b/services/netapp/mgmt/2020-06-01/netapp/accounts.go index ce4cf9f0b8a4..8d58c802924d 100644 --- a/services/netapp/mgmt/2020-06-01/netapp/accounts.go +++ b/services/netapp/mgmt/2020-06-01/netapp/accounts.go @@ -15,7 +15,7 @@ import ( "net/http" ) -// AccountsClient is the microsoft NetApp Azure Resource Provider specification +// AccountsClient is the microsoft NetApp Files Azure Resource Provider specification type AccountsClient struct { BaseClient } diff --git a/services/netapp/mgmt/2020-06-01/netapp/backuppolicies.go b/services/netapp/mgmt/2020-06-01/netapp/backuppolicies.go index 2b9e95b30d9e..c9c8f005dad5 100644 --- a/services/netapp/mgmt/2020-06-01/netapp/backuppolicies.go +++ b/services/netapp/mgmt/2020-06-01/netapp/backuppolicies.go @@ -15,7 +15,7 @@ import ( "net/http" ) -// BackupPoliciesClient is the microsoft NetApp Azure Resource Provider specification +// BackupPoliciesClient is the microsoft NetApp Files Azure Resource Provider specification type BackupPoliciesClient struct { BaseClient } diff --git a/services/netapp/mgmt/2020-06-01/netapp/backups.go b/services/netapp/mgmt/2020-06-01/netapp/backups.go index 21eab44363f8..77a59a91e9d3 100644 --- a/services/netapp/mgmt/2020-06-01/netapp/backups.go +++ b/services/netapp/mgmt/2020-06-01/netapp/backups.go @@ -15,7 +15,7 @@ import ( "net/http" ) -// BackupsClient is the microsoft NetApp Azure Resource Provider specification +// BackupsClient is the microsoft NetApp Files Azure Resource Provider specification type BackupsClient struct { BaseClient } diff --git a/services/netapp/mgmt/2020-06-01/netapp/client.go b/services/netapp/mgmt/2020-06-01/netapp/client.go index 6b2c03785d53..b6ea6aa88de4 100644 --- a/services/netapp/mgmt/2020-06-01/netapp/client.go +++ b/services/netapp/mgmt/2020-06-01/netapp/client.go @@ -1,6 +1,6 @@ // Package netapp implements the Azure ARM Netapp service API version 2020-06-01. // -// Microsoft NetApp Azure Resource Provider specification +// Microsoft NetApp Files Azure Resource Provider specification package netapp // Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/services/netapp/mgmt/2020-06-01/netapp/enums.go b/services/netapp/mgmt/2020-06-01/netapp/enums.go index d9a077191155..42e74827d9c3 100644 --- a/services/netapp/mgmt/2020-06-01/netapp/enums.go +++ b/services/netapp/mgmt/2020-06-01/netapp/enums.go @@ -27,6 +27,21 @@ func PossibleActiveDirectoryStatusValues() []ActiveDirectoryStatus { return []ActiveDirectoryStatus{Created, Deleted, Error, InUse, Updating} } +// BackupType enumerates the values for backup type. +type BackupType string + +const ( + // Manual Manual backup + Manual BackupType = "Manual" + // Scheduled Scheduled backup + Scheduled BackupType = "Scheduled" +) + +// PossibleBackupTypeValues returns an array of possible values for the BackupType const type. +func PossibleBackupTypeValues() []BackupType { + return []BackupType{Manual, Scheduled} +} + // CheckNameResourceTypes enumerates the values for check name resource types. type CheckNameResourceTypes string @@ -116,15 +131,15 @@ func PossibleMirrorStateValues() []MirrorState { type QosType string const ( - // Auto qos type Auto - Auto QosType = "Auto" - // Manual qos type Manual - Manual QosType = "Manual" + // QosTypeAuto qos type Auto + QosTypeAuto QosType = "Auto" + // QosTypeManual qos type Manual + QosTypeManual QosType = "Manual" ) // PossibleQosTypeValues returns an array of possible values for the QosType const type. func PossibleQosTypeValues() []QosType { - return []QosType{Auto, Manual} + return []QosType{QosTypeAuto, QosTypeManual} } // RelationshipStatus enumerates the values for relationship status. diff --git a/services/netapp/mgmt/2020-06-01/netapp/models.go b/services/netapp/mgmt/2020-06-01/netapp/models.go index 13f586b91d5a..a2725e0fbdfe 100644 --- a/services/netapp/mgmt/2020-06-01/netapp/models.go +++ b/services/netapp/mgmt/2020-06-01/netapp/models.go @@ -1025,8 +1025,8 @@ type BackupProperties struct { Size *int64 `json:"size,omitempty"` // Label - Label for backup Label *string `json:"label,omitempty"` - // BackupType - READ-ONLY; Type of backup adhoc or scheduled - BackupType *string `json:"backupType,omitempty"` + // BackupType - READ-ONLY; Type of backup Manual or Scheduled. Possible values include: 'Manual', 'Scheduled' + BackupType BackupType `json:"backupType,omitempty"` } // MarshalJSON is the custom marshaler for BackupProperties. @@ -1689,7 +1689,7 @@ type PoolChangeRequest struct { type PoolPatchProperties struct { // Size - Provisioned size of the pool (in bytes). Allowed values are in 4TiB chunks (value must be multiply of 4398046511104). Size *int64 `json:"size,omitempty"` - // QosType - The qos type of the pool. Possible values include: 'Auto', 'Manual' + // QosType - The qos type of the pool. Possible values include: 'QosTypeAuto', 'QosTypeManual' QosType QosType `json:"qosType,omitempty"` } @@ -1707,7 +1707,7 @@ type PoolProperties struct { TotalThroughputMibps *float64 `json:"totalThroughputMibps,omitempty"` // UtilizedThroughputMibps - READ-ONLY; Utilized throughput of pool in Mibps UtilizedThroughputMibps *float64 `json:"utilizedThroughputMibps,omitempty"` - // QosType - The qos type of the pool. Possible values include: 'Auto', 'Manual' + // QosType - The qos type of the pool. Possible values include: 'QosTypeAuto', 'QosTypeManual' QosType QosType `json:"qosType,omitempty"` } @@ -2893,7 +2893,7 @@ type VolumeProperties struct { UsageThreshold *int64 `json:"usageThreshold,omitempty"` // ExportPolicy - Set of export policy rules ExportPolicy *VolumePropertiesExportPolicy `json:"exportPolicy,omitempty"` - // ProtocolTypes - Set of protocol types + // ProtocolTypes - Set of protocol types, default NFSv3, CIFS for SMB protocol ProtocolTypes *[]string `json:"protocolTypes,omitempty"` // ProvisioningState - READ-ONLY; Azure lifecycle management ProvisioningState *string `json:"provisioningState,omitempty"` @@ -2905,7 +2905,7 @@ type VolumeProperties struct { BaremetalTenantID *string `json:"baremetalTenantId,omitempty"` // SubnetID - The Azure Resource URI for a delegated subnet. Must have the delegation Microsoft.NetApp/volumes SubnetID *string `json:"subnetId,omitempty"` - // MountTargets - List of mount targets + // MountTargets - READ-ONLY; List of mount targets MountTargets *[]MountTargetProperties `json:"mountTargets,omitempty"` // VolumeType - What type of volume is this VolumeType *string `json:"volumeType,omitempty"` @@ -2917,7 +2917,7 @@ type VolumeProperties struct { SnapshotDirectoryVisible *bool `json:"snapshotDirectoryVisible,omitempty"` // KerberosEnabled - Describe if a volume is KerberosEnabled. To be use with swagger version 2020-05-01 or later KerberosEnabled *bool `json:"kerberosEnabled,omitempty"` - // SecurityStyle - The security style of volume. Possible values include: 'Ntfs', 'Unix' + // SecurityStyle - The security style of volume, default unix, defaults to ntfs for dual protocol or CIFS protocol. Possible values include: 'Ntfs', 'Unix' SecurityStyle SecurityStyle `json:"securityStyle,omitempty"` ThroughputMibps *float64 `json:"throughputMibps,omitempty"` } @@ -2949,9 +2949,6 @@ func (vp VolumeProperties) MarshalJSON() ([]byte, error) { if vp.SubnetID != nil { objectMap["subnetId"] = vp.SubnetID } - if vp.MountTargets != nil { - objectMap["mountTargets"] = vp.MountTargets - } if vp.VolumeType != nil { objectMap["volumeType"] = vp.VolumeType } diff --git a/services/netapp/mgmt/2020-06-01/netapp/operations.go b/services/netapp/mgmt/2020-06-01/netapp/operations.go index 9256ad902b0a..22744f8e67be 100644 --- a/services/netapp/mgmt/2020-06-01/netapp/operations.go +++ b/services/netapp/mgmt/2020-06-01/netapp/operations.go @@ -14,7 +14,7 @@ import ( "net/http" ) -// OperationsClient is the microsoft NetApp Azure Resource Provider specification +// OperationsClient is the microsoft NetApp Files Azure Resource Provider specification type OperationsClient struct { BaseClient } diff --git a/services/netapp/mgmt/2020-06-01/netapp/pools.go b/services/netapp/mgmt/2020-06-01/netapp/pools.go index c22d909e51ec..11ea92d4458a 100644 --- a/services/netapp/mgmt/2020-06-01/netapp/pools.go +++ b/services/netapp/mgmt/2020-06-01/netapp/pools.go @@ -15,7 +15,7 @@ import ( "net/http" ) -// PoolsClient is the microsoft NetApp Azure Resource Provider specification +// PoolsClient is the microsoft NetApp Files Azure Resource Provider specification type PoolsClient struct { BaseClient } diff --git a/services/netapp/mgmt/2020-06-01/netapp/resource.go b/services/netapp/mgmt/2020-06-01/netapp/resource.go index 3a40f15944d5..775354c89072 100644 --- a/services/netapp/mgmt/2020-06-01/netapp/resource.go +++ b/services/netapp/mgmt/2020-06-01/netapp/resource.go @@ -15,7 +15,7 @@ import ( "net/http" ) -// ResourceClient is the microsoft NetApp Azure Resource Provider specification +// ResourceClient is the microsoft NetApp Files Azure Resource Provider specification type ResourceClient struct { BaseClient } diff --git a/services/netapp/mgmt/2020-06-01/netapp/snapshotpolicies.go b/services/netapp/mgmt/2020-06-01/netapp/snapshotpolicies.go index 96475b2821d3..6926a6f5567c 100644 --- a/services/netapp/mgmt/2020-06-01/netapp/snapshotpolicies.go +++ b/services/netapp/mgmt/2020-06-01/netapp/snapshotpolicies.go @@ -15,7 +15,7 @@ import ( "net/http" ) -// SnapshotPoliciesClient is the microsoft NetApp Azure Resource Provider specification +// SnapshotPoliciesClient is the microsoft NetApp Files Azure Resource Provider specification type SnapshotPoliciesClient struct { BaseClient } diff --git a/services/netapp/mgmt/2020-06-01/netapp/snapshots.go b/services/netapp/mgmt/2020-06-01/netapp/snapshots.go index 5ce10aa6ab17..f77f86fa40cf 100644 --- a/services/netapp/mgmt/2020-06-01/netapp/snapshots.go +++ b/services/netapp/mgmt/2020-06-01/netapp/snapshots.go @@ -15,7 +15,7 @@ import ( "net/http" ) -// SnapshotsClient is the microsoft NetApp Azure Resource Provider specification +// SnapshotsClient is the microsoft NetApp Files Azure Resource Provider specification type SnapshotsClient struct { BaseClient } diff --git a/services/netapp/mgmt/2020-06-01/netapp/vaults.go b/services/netapp/mgmt/2020-06-01/netapp/vaults.go index c308b6d86675..bce0b7f68f01 100644 --- a/services/netapp/mgmt/2020-06-01/netapp/vaults.go +++ b/services/netapp/mgmt/2020-06-01/netapp/vaults.go @@ -15,7 +15,7 @@ import ( "net/http" ) -// VaultsClient is the microsoft NetApp Azure Resource Provider specification +// VaultsClient is the microsoft NetApp Files Azure Resource Provider specification type VaultsClient struct { BaseClient } diff --git a/services/netapp/mgmt/2020-06-01/netapp/volumes.go b/services/netapp/mgmt/2020-06-01/netapp/volumes.go index b8698c0caa42..7d482ee6ad75 100644 --- a/services/netapp/mgmt/2020-06-01/netapp/volumes.go +++ b/services/netapp/mgmt/2020-06-01/netapp/volumes.go @@ -15,7 +15,7 @@ import ( "net/http" ) -// VolumesClient is the microsoft NetApp Azure Resource Provider specification +// VolumesClient is the microsoft NetApp Files Azure Resource Provider specification type VolumesClient struct { BaseClient } @@ -292,7 +292,7 @@ func (client VolumesClient) CreateOrUpdate(ctx context.Context, body Volume, res }}, {Target: "body.VolumeProperties.ThroughputMibps", Name: validation.Null, Rule: false, Chain: []validation.Constraint{{Target: "body.VolumeProperties.ThroughputMibps", Name: validation.InclusiveMaximum, Rule: float64(4500), Chain: nil}, - {Target: "body.VolumeProperties.ThroughputMibps", Name: validation.InclusiveMinimum, Rule: float64(1), Chain: nil}, + {Target: "body.VolumeProperties.ThroughputMibps", Name: validation.InclusiveMinimum, Rule: float64(0), Chain: nil}, {Target: "body.VolumeProperties.ThroughputMibps", Name: validation.MultipleOf, Rule: 0.001, Chain: nil}, }}, }}}}, @@ -1058,7 +1058,7 @@ func (client VolumesClient) ReplicationStatusMethodResponder(resp *http.Response } // 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 source to destination. +// will reverse-resync the connection and sync from destination to source. // Parameters: // resourceGroupName - the name of the resource group. // accountName - the name of the NetApp account diff --git a/services/netapp/mgmt/2020-07-01/netapp/CHANGELOG.md b/services/netapp/mgmt/2020-07-01/netapp/CHANGELOG.md index 1984ed2e57f2..a5415c33a3a9 100644 --- a/services/netapp/mgmt/2020-07-01/netapp/CHANGELOG.md +++ b/services/netapp/mgmt/2020-07-01/netapp/CHANGELOG.md @@ -1,7 +1,29 @@ -# Change History +# Unreleased + +## Breaking Changes + +### Removed Constants + +1. QosType.Auto + +### Signature Changes + +#### Const Types + +1. Manual changed type from QosType to BackupType + +#### Struct Fields + +1. BackupProperties.BackupType changed type from *string to BackupType ## Additive Changes +### New Constants + +1. BackupType.Scheduled +1. QosType.QosTypeAuto +1. QosType.QosTypeManual + ### New Funcs -1. SnapshotProperties.MarshalJSON() ([]byte, error) +1. PossibleBackupTypeValues() []BackupType diff --git a/services/netapp/mgmt/2020-07-01/netapp/_meta.json b/services/netapp/mgmt/2020-07-01/netapp/_meta.json index 3a9fec65c5a8..fa6593827762 100644 --- a/services/netapp/mgmt/2020-07-01/netapp/_meta.json +++ b/services/netapp/mgmt/2020-07-01/netapp/_meta.json @@ -1,5 +1,5 @@ { - "commit": "3c764635e7d442b3e74caf593029fcd440b3ef82", + "commit": "81ec17ce66f59c587024bfa8002fafb4436b83ef", "readme": "/_/azure-rest-api-specs/specification/netapp/resource-manager/readme.md", "tag": "package-netapp-2020-07-01", "use": "@microsoft.azure/autorest.go@2.1.183", diff --git a/services/netapp/mgmt/2020-07-01/netapp/accountbackups.go b/services/netapp/mgmt/2020-07-01/netapp/accountbackups.go index 751f5a317eeb..da312641a3d2 100644 --- a/services/netapp/mgmt/2020-07-01/netapp/accountbackups.go +++ b/services/netapp/mgmt/2020-07-01/netapp/accountbackups.go @@ -15,7 +15,7 @@ import ( "net/http" ) -// AccountBackupsClient is the microsoft NetApp Azure Resource Provider specification +// AccountBackupsClient is the microsoft NetApp Files Azure Resource Provider specification type AccountBackupsClient struct { BaseClient } diff --git a/services/netapp/mgmt/2020-07-01/netapp/accounts.go b/services/netapp/mgmt/2020-07-01/netapp/accounts.go index ad9cab0d4be5..b9de69029eae 100644 --- a/services/netapp/mgmt/2020-07-01/netapp/accounts.go +++ b/services/netapp/mgmt/2020-07-01/netapp/accounts.go @@ -15,7 +15,7 @@ import ( "net/http" ) -// AccountsClient is the microsoft NetApp Azure Resource Provider specification +// AccountsClient is the microsoft NetApp Files Azure Resource Provider specification type AccountsClient struct { BaseClient } diff --git a/services/netapp/mgmt/2020-07-01/netapp/backuppolicies.go b/services/netapp/mgmt/2020-07-01/netapp/backuppolicies.go index 2de34ddfed06..baadfc4c48f5 100644 --- a/services/netapp/mgmt/2020-07-01/netapp/backuppolicies.go +++ b/services/netapp/mgmt/2020-07-01/netapp/backuppolicies.go @@ -15,7 +15,7 @@ import ( "net/http" ) -// BackupPoliciesClient is the microsoft NetApp Azure Resource Provider specification +// BackupPoliciesClient is the microsoft NetApp Files Azure Resource Provider specification type BackupPoliciesClient struct { BaseClient } diff --git a/services/netapp/mgmt/2020-07-01/netapp/backups.go b/services/netapp/mgmt/2020-07-01/netapp/backups.go index 273e27d15460..0304389751dd 100644 --- a/services/netapp/mgmt/2020-07-01/netapp/backups.go +++ b/services/netapp/mgmt/2020-07-01/netapp/backups.go @@ -15,7 +15,7 @@ import ( "net/http" ) -// BackupsClient is the microsoft NetApp Azure Resource Provider specification +// BackupsClient is the microsoft NetApp Files Azure Resource Provider specification type BackupsClient struct { BaseClient } diff --git a/services/netapp/mgmt/2020-07-01/netapp/client.go b/services/netapp/mgmt/2020-07-01/netapp/client.go index a0ae054469a1..5a6893197b54 100644 --- a/services/netapp/mgmt/2020-07-01/netapp/client.go +++ b/services/netapp/mgmt/2020-07-01/netapp/client.go @@ -1,6 +1,6 @@ // Package netapp implements the Azure ARM Netapp service API version 2020-07-01. // -// Microsoft NetApp Azure Resource Provider specification +// Microsoft NetApp Files Azure Resource Provider specification package netapp // Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/services/netapp/mgmt/2020-07-01/netapp/enums.go b/services/netapp/mgmt/2020-07-01/netapp/enums.go index d9a077191155..42e74827d9c3 100644 --- a/services/netapp/mgmt/2020-07-01/netapp/enums.go +++ b/services/netapp/mgmt/2020-07-01/netapp/enums.go @@ -27,6 +27,21 @@ func PossibleActiveDirectoryStatusValues() []ActiveDirectoryStatus { return []ActiveDirectoryStatus{Created, Deleted, Error, InUse, Updating} } +// BackupType enumerates the values for backup type. +type BackupType string + +const ( + // Manual Manual backup + Manual BackupType = "Manual" + // Scheduled Scheduled backup + Scheduled BackupType = "Scheduled" +) + +// PossibleBackupTypeValues returns an array of possible values for the BackupType const type. +func PossibleBackupTypeValues() []BackupType { + return []BackupType{Manual, Scheduled} +} + // CheckNameResourceTypes enumerates the values for check name resource types. type CheckNameResourceTypes string @@ -116,15 +131,15 @@ func PossibleMirrorStateValues() []MirrorState { type QosType string const ( - // Auto qos type Auto - Auto QosType = "Auto" - // Manual qos type Manual - Manual QosType = "Manual" + // QosTypeAuto qos type Auto + QosTypeAuto QosType = "Auto" + // QosTypeManual qos type Manual + QosTypeManual QosType = "Manual" ) // PossibleQosTypeValues returns an array of possible values for the QosType const type. func PossibleQosTypeValues() []QosType { - return []QosType{Auto, Manual} + return []QosType{QosTypeAuto, QosTypeManual} } // RelationshipStatus enumerates the values for relationship status. diff --git a/services/netapp/mgmt/2020-07-01/netapp/models.go b/services/netapp/mgmt/2020-07-01/netapp/models.go index b9d239662b86..3ec73a4b4f0b 100644 --- a/services/netapp/mgmt/2020-07-01/netapp/models.go +++ b/services/netapp/mgmt/2020-07-01/netapp/models.go @@ -1082,8 +1082,8 @@ type BackupProperties struct { Size *int64 `json:"size,omitempty"` // Label - Label for backup Label *string `json:"label,omitempty"` - // BackupType - READ-ONLY; Type of backup adhoc or scheduled - BackupType *string `json:"backupType,omitempty"` + // BackupType - READ-ONLY; Type of backup Manual or Scheduled. Possible values include: 'Manual', 'Scheduled' + BackupType BackupType `json:"backupType,omitempty"` } // MarshalJSON is the custom marshaler for BackupProperties. @@ -1746,7 +1746,7 @@ type PoolChangeRequest struct { type PoolPatchProperties struct { // Size - Provisioned size of the pool (in bytes). Allowed values are in 4TiB chunks (value must be multiply of 4398046511104). Size *int64 `json:"size,omitempty"` - // QosType - The qos type of the pool. Possible values include: 'Auto', 'Manual' + // QosType - The qos type of the pool. Possible values include: 'QosTypeAuto', 'QosTypeManual' QosType QosType `json:"qosType,omitempty"` } @@ -1764,7 +1764,7 @@ type PoolProperties struct { TotalThroughputMibps *float64 `json:"totalThroughputMibps,omitempty"` // UtilizedThroughputMibps - READ-ONLY; Utilized throughput of pool in Mibps UtilizedThroughputMibps *float64 `json:"utilizedThroughputMibps,omitempty"` - // QosType - The qos type of the pool. Possible values include: 'Auto', 'Manual' + // QosType - The qos type of the pool. Possible values include: 'QosTypeAuto', 'QosTypeManual' QosType QosType `json:"qosType,omitempty"` } @@ -2950,7 +2950,7 @@ type VolumeProperties struct { UsageThreshold *int64 `json:"usageThreshold,omitempty"` // ExportPolicy - Set of export policy rules ExportPolicy *VolumePropertiesExportPolicy `json:"exportPolicy,omitempty"` - // ProtocolTypes - Set of protocol types + // ProtocolTypes - Set of protocol types, default NFSv3, CIFS for SMB protocol ProtocolTypes *[]string `json:"protocolTypes,omitempty"` // ProvisioningState - READ-ONLY; Azure lifecycle management ProvisioningState *string `json:"provisioningState,omitempty"` @@ -2962,7 +2962,7 @@ type VolumeProperties struct { BaremetalTenantID *string `json:"baremetalTenantId,omitempty"` // SubnetID - The Azure Resource URI for a delegated subnet. Must have the delegation Microsoft.NetApp/volumes SubnetID *string `json:"subnetId,omitempty"` - // MountTargets - List of mount targets + // MountTargets - READ-ONLY; List of mount targets MountTargets *[]MountTargetProperties `json:"mountTargets,omitempty"` // VolumeType - What type of volume is this VolumeType *string `json:"volumeType,omitempty"` @@ -2974,7 +2974,7 @@ type VolumeProperties struct { SnapshotDirectoryVisible *bool `json:"snapshotDirectoryVisible,omitempty"` // KerberosEnabled - Describe if a volume is KerberosEnabled. To be use with swagger version 2020-05-01 or later KerberosEnabled *bool `json:"kerberosEnabled,omitempty"` - // SecurityStyle - The security style of volume. Possible values include: 'Ntfs', 'Unix' + // SecurityStyle - The security style of volume, default unix, ntfs for dual protocol or CIFS protocol. Possible values include: 'Ntfs', 'Unix' SecurityStyle SecurityStyle `json:"securityStyle,omitempty"` ThroughputMibps *float64 `json:"throughputMibps,omitempty"` } @@ -3006,9 +3006,6 @@ func (vp VolumeProperties) MarshalJSON() ([]byte, error) { if vp.SubnetID != nil { objectMap["subnetId"] = vp.SubnetID } - if vp.MountTargets != nil { - objectMap["mountTargets"] = vp.MountTargets - } if vp.VolumeType != nil { objectMap["volumeType"] = vp.VolumeType } diff --git a/services/netapp/mgmt/2020-07-01/netapp/operations.go b/services/netapp/mgmt/2020-07-01/netapp/operations.go index 26ee654839fd..2cf7c028e920 100644 --- a/services/netapp/mgmt/2020-07-01/netapp/operations.go +++ b/services/netapp/mgmt/2020-07-01/netapp/operations.go @@ -14,7 +14,7 @@ import ( "net/http" ) -// OperationsClient is the microsoft NetApp Azure Resource Provider specification +// OperationsClient is the microsoft NetApp Files Azure Resource Provider specification type OperationsClient struct { BaseClient } diff --git a/services/netapp/mgmt/2020-07-01/netapp/pools.go b/services/netapp/mgmt/2020-07-01/netapp/pools.go index b48de0018fec..834158ed0722 100644 --- a/services/netapp/mgmt/2020-07-01/netapp/pools.go +++ b/services/netapp/mgmt/2020-07-01/netapp/pools.go @@ -15,7 +15,7 @@ import ( "net/http" ) -// PoolsClient is the microsoft NetApp Azure Resource Provider specification +// PoolsClient is the microsoft NetApp Files Azure Resource Provider specification type PoolsClient struct { BaseClient } diff --git a/services/netapp/mgmt/2020-07-01/netapp/resource.go b/services/netapp/mgmt/2020-07-01/netapp/resource.go index ff34c4d8a8e3..891ef423127c 100644 --- a/services/netapp/mgmt/2020-07-01/netapp/resource.go +++ b/services/netapp/mgmt/2020-07-01/netapp/resource.go @@ -15,7 +15,7 @@ import ( "net/http" ) -// ResourceClient is the microsoft NetApp Azure Resource Provider specification +// ResourceClient is the microsoft NetApp Files Azure Resource Provider specification type ResourceClient struct { BaseClient } diff --git a/services/netapp/mgmt/2020-07-01/netapp/snapshotpolicies.go b/services/netapp/mgmt/2020-07-01/netapp/snapshotpolicies.go index 036977acd904..eb24952e9bcc 100644 --- a/services/netapp/mgmt/2020-07-01/netapp/snapshotpolicies.go +++ b/services/netapp/mgmt/2020-07-01/netapp/snapshotpolicies.go @@ -15,7 +15,7 @@ import ( "net/http" ) -// SnapshotPoliciesClient is the microsoft NetApp Azure Resource Provider specification +// SnapshotPoliciesClient is the microsoft NetApp Files Azure Resource Provider specification type SnapshotPoliciesClient struct { BaseClient } diff --git a/services/netapp/mgmt/2020-07-01/netapp/snapshots.go b/services/netapp/mgmt/2020-07-01/netapp/snapshots.go index d0d4235fddd2..c81751bda71c 100644 --- a/services/netapp/mgmt/2020-07-01/netapp/snapshots.go +++ b/services/netapp/mgmt/2020-07-01/netapp/snapshots.go @@ -15,7 +15,7 @@ import ( "net/http" ) -// SnapshotsClient is the microsoft NetApp Azure Resource Provider specification +// SnapshotsClient is the microsoft NetApp Files Azure Resource Provider specification type SnapshotsClient struct { BaseClient } diff --git a/services/netapp/mgmt/2020-07-01/netapp/vaults.go b/services/netapp/mgmt/2020-07-01/netapp/vaults.go index 0a15202a2515..6ac627de1be2 100644 --- a/services/netapp/mgmt/2020-07-01/netapp/vaults.go +++ b/services/netapp/mgmt/2020-07-01/netapp/vaults.go @@ -15,7 +15,7 @@ import ( "net/http" ) -// VaultsClient is the microsoft NetApp Azure Resource Provider specification +// VaultsClient is the microsoft NetApp Files Azure Resource Provider specification type VaultsClient struct { BaseClient } diff --git a/services/netapp/mgmt/2020-07-01/netapp/volumes.go b/services/netapp/mgmt/2020-07-01/netapp/volumes.go index 2bb3719073a0..6ae6bdc62b1f 100644 --- a/services/netapp/mgmt/2020-07-01/netapp/volumes.go +++ b/services/netapp/mgmt/2020-07-01/netapp/volumes.go @@ -15,7 +15,7 @@ import ( "net/http" ) -// VolumesClient is the microsoft NetApp Azure Resource Provider specification +// VolumesClient is the microsoft NetApp Files Azure Resource Provider specification type VolumesClient struct { BaseClient } @@ -287,7 +287,7 @@ func (client VolumesClient) CreateOrUpdate(ctx context.Context, body Volume, res }}, {Target: "body.VolumeProperties.ThroughputMibps", Name: validation.Null, Rule: false, Chain: []validation.Constraint{{Target: "body.VolumeProperties.ThroughputMibps", Name: validation.InclusiveMaximum, Rule: float64(4500), Chain: nil}, - {Target: "body.VolumeProperties.ThroughputMibps", Name: validation.InclusiveMinimum, Rule: float64(1), Chain: nil}, + {Target: "body.VolumeProperties.ThroughputMibps", Name: validation.InclusiveMinimum, Rule: float64(0), Chain: nil}, {Target: "body.VolumeProperties.ThroughputMibps", Name: validation.MultipleOf, Rule: 0.001, Chain: nil}, }}, }}}}, @@ -1053,7 +1053,7 @@ func (client VolumesClient) ReplicationStatusMethodResponder(resp *http.Response } // 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 source to destination. +// will reverse-resync the connection and sync from destination to source. // Parameters: // resourceGroupName - the name of the resource group. // accountName - the name of the NetApp account diff --git a/services/netapp/mgmt/2020-08-01/netapp/CHANGELOG.md b/services/netapp/mgmt/2020-08-01/netapp/CHANGELOG.md index 1984ed2e57f2..a5415c33a3a9 100644 --- a/services/netapp/mgmt/2020-08-01/netapp/CHANGELOG.md +++ b/services/netapp/mgmt/2020-08-01/netapp/CHANGELOG.md @@ -1,7 +1,29 @@ -# Change History +# Unreleased + +## Breaking Changes + +### Removed Constants + +1. QosType.Auto + +### Signature Changes + +#### Const Types + +1. Manual changed type from QosType to BackupType + +#### Struct Fields + +1. BackupProperties.BackupType changed type from *string to BackupType ## Additive Changes +### New Constants + +1. BackupType.Scheduled +1. QosType.QosTypeAuto +1. QosType.QosTypeManual + ### New Funcs -1. SnapshotProperties.MarshalJSON() ([]byte, error) +1. PossibleBackupTypeValues() []BackupType diff --git a/services/netapp/mgmt/2020-08-01/netapp/_meta.json b/services/netapp/mgmt/2020-08-01/netapp/_meta.json index 72a4b4afe30b..35ba9d244f41 100644 --- a/services/netapp/mgmt/2020-08-01/netapp/_meta.json +++ b/services/netapp/mgmt/2020-08-01/netapp/_meta.json @@ -1,5 +1,5 @@ { - "commit": "3c764635e7d442b3e74caf593029fcd440b3ef82", + "commit": "81ec17ce66f59c587024bfa8002fafb4436b83ef", "readme": "/_/azure-rest-api-specs/specification/netapp/resource-manager/readme.md", "tag": "package-netapp-2020-08-01", "use": "@microsoft.azure/autorest.go@2.1.183", diff --git a/services/netapp/mgmt/2020-08-01/netapp/accountbackups.go b/services/netapp/mgmt/2020-08-01/netapp/accountbackups.go index 6f79f2d16ff8..8a635be9c248 100644 --- a/services/netapp/mgmt/2020-08-01/netapp/accountbackups.go +++ b/services/netapp/mgmt/2020-08-01/netapp/accountbackups.go @@ -15,7 +15,7 @@ import ( "net/http" ) -// AccountBackupsClient is the microsoft NetApp Azure Resource Provider specification +// AccountBackupsClient is the microsoft NetApp Files Azure Resource Provider specification type AccountBackupsClient struct { BaseClient } diff --git a/services/netapp/mgmt/2020-08-01/netapp/accounts.go b/services/netapp/mgmt/2020-08-01/netapp/accounts.go index 45be8ccaae69..61b457affb5b 100644 --- a/services/netapp/mgmt/2020-08-01/netapp/accounts.go +++ b/services/netapp/mgmt/2020-08-01/netapp/accounts.go @@ -15,7 +15,7 @@ import ( "net/http" ) -// AccountsClient is the microsoft NetApp Azure Resource Provider specification +// AccountsClient is the microsoft NetApp Files Azure Resource Provider specification type AccountsClient struct { BaseClient } diff --git a/services/netapp/mgmt/2020-08-01/netapp/backuppolicies.go b/services/netapp/mgmt/2020-08-01/netapp/backuppolicies.go index 322a8ccefab5..03b2b13e4482 100644 --- a/services/netapp/mgmt/2020-08-01/netapp/backuppolicies.go +++ b/services/netapp/mgmt/2020-08-01/netapp/backuppolicies.go @@ -15,7 +15,7 @@ import ( "net/http" ) -// BackupPoliciesClient is the microsoft NetApp Azure Resource Provider specification +// BackupPoliciesClient is the microsoft NetApp Files Azure Resource Provider specification type BackupPoliciesClient struct { BaseClient } diff --git a/services/netapp/mgmt/2020-08-01/netapp/backups.go b/services/netapp/mgmt/2020-08-01/netapp/backups.go index 20bd1d9483c6..43997930fe42 100644 --- a/services/netapp/mgmt/2020-08-01/netapp/backups.go +++ b/services/netapp/mgmt/2020-08-01/netapp/backups.go @@ -15,7 +15,7 @@ import ( "net/http" ) -// BackupsClient is the microsoft NetApp Azure Resource Provider specification +// BackupsClient is the microsoft NetApp Files Azure Resource Provider specification type BackupsClient struct { BaseClient } diff --git a/services/netapp/mgmt/2020-08-01/netapp/client.go b/services/netapp/mgmt/2020-08-01/netapp/client.go index e57641d72fae..d023e93825f7 100644 --- a/services/netapp/mgmt/2020-08-01/netapp/client.go +++ b/services/netapp/mgmt/2020-08-01/netapp/client.go @@ -1,6 +1,6 @@ // Package netapp implements the Azure ARM Netapp service API version 2020-08-01. // -// Microsoft NetApp Azure Resource Provider specification +// Microsoft NetApp Files Azure Resource Provider specification package netapp // Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/services/netapp/mgmt/2020-08-01/netapp/enums.go b/services/netapp/mgmt/2020-08-01/netapp/enums.go index d9a077191155..42e74827d9c3 100644 --- a/services/netapp/mgmt/2020-08-01/netapp/enums.go +++ b/services/netapp/mgmt/2020-08-01/netapp/enums.go @@ -27,6 +27,21 @@ func PossibleActiveDirectoryStatusValues() []ActiveDirectoryStatus { return []ActiveDirectoryStatus{Created, Deleted, Error, InUse, Updating} } +// BackupType enumerates the values for backup type. +type BackupType string + +const ( + // Manual Manual backup + Manual BackupType = "Manual" + // Scheduled Scheduled backup + Scheduled BackupType = "Scheduled" +) + +// PossibleBackupTypeValues returns an array of possible values for the BackupType const type. +func PossibleBackupTypeValues() []BackupType { + return []BackupType{Manual, Scheduled} +} + // CheckNameResourceTypes enumerates the values for check name resource types. type CheckNameResourceTypes string @@ -116,15 +131,15 @@ func PossibleMirrorStateValues() []MirrorState { type QosType string const ( - // Auto qos type Auto - Auto QosType = "Auto" - // Manual qos type Manual - Manual QosType = "Manual" + // QosTypeAuto qos type Auto + QosTypeAuto QosType = "Auto" + // QosTypeManual qos type Manual + QosTypeManual QosType = "Manual" ) // PossibleQosTypeValues returns an array of possible values for the QosType const type. func PossibleQosTypeValues() []QosType { - return []QosType{Auto, Manual} + return []QosType{QosTypeAuto, QosTypeManual} } // RelationshipStatus enumerates the values for relationship status. diff --git a/services/netapp/mgmt/2020-08-01/netapp/models.go b/services/netapp/mgmt/2020-08-01/netapp/models.go index 9a764f7ea009..451a5808f6f2 100644 --- a/services/netapp/mgmt/2020-08-01/netapp/models.go +++ b/services/netapp/mgmt/2020-08-01/netapp/models.go @@ -1082,8 +1082,8 @@ type BackupProperties struct { Size *int64 `json:"size,omitempty"` // Label - Label for backup Label *string `json:"label,omitempty"` - // BackupType - READ-ONLY; Type of backup adhoc or scheduled - BackupType *string `json:"backupType,omitempty"` + // BackupType - READ-ONLY; Type of backup Manual or Scheduled. Possible values include: 'Manual', 'Scheduled' + BackupType BackupType `json:"backupType,omitempty"` } // MarshalJSON is the custom marshaler for BackupProperties. @@ -1746,7 +1746,7 @@ type PoolChangeRequest struct { type PoolPatchProperties struct { // Size - Provisioned size of the pool (in bytes). Allowed values are in 4TiB chunks (value must be multiply of 4398046511104). Size *int64 `json:"size,omitempty"` - // QosType - The qos type of the pool. Possible values include: 'Auto', 'Manual' + // QosType - The qos type of the pool. Possible values include: 'QosTypeAuto', 'QosTypeManual' QosType QosType `json:"qosType,omitempty"` } @@ -1764,7 +1764,7 @@ type PoolProperties struct { TotalThroughputMibps *float64 `json:"totalThroughputMibps,omitempty"` // UtilizedThroughputMibps - READ-ONLY; Utilized throughput of pool in Mibps UtilizedThroughputMibps *float64 `json:"utilizedThroughputMibps,omitempty"` - // QosType - The qos type of the pool. Possible values include: 'Auto', 'Manual' + // QosType - The qos type of the pool. Possible values include: 'QosTypeAuto', 'QosTypeManual' QosType QosType `json:"qosType,omitempty"` } @@ -2950,7 +2950,7 @@ type VolumeProperties struct { UsageThreshold *int64 `json:"usageThreshold,omitempty"` // ExportPolicy - Set of export policy rules ExportPolicy *VolumePropertiesExportPolicy `json:"exportPolicy,omitempty"` - // ProtocolTypes - Set of protocol types + // ProtocolTypes - Set of protocol types, default NFSv3, CIFS for SMB protocol ProtocolTypes *[]string `json:"protocolTypes,omitempty"` // ProvisioningState - READ-ONLY; Azure lifecycle management ProvisioningState *string `json:"provisioningState,omitempty"` @@ -2962,7 +2962,7 @@ type VolumeProperties struct { BaremetalTenantID *string `json:"baremetalTenantId,omitempty"` // SubnetID - The Azure Resource URI for a delegated subnet. Must have the delegation Microsoft.NetApp/volumes SubnetID *string `json:"subnetId,omitempty"` - // MountTargets - List of mount targets + // MountTargets - READ-ONLY; List of mount targets MountTargets *[]MountTargetProperties `json:"mountTargets,omitempty"` // VolumeType - What type of volume is this VolumeType *string `json:"volumeType,omitempty"` @@ -2974,7 +2974,7 @@ type VolumeProperties struct { SnapshotDirectoryVisible *bool `json:"snapshotDirectoryVisible,omitempty"` // KerberosEnabled - Describe if a volume is KerberosEnabled. To be use with swagger version 2020-05-01 or later KerberosEnabled *bool `json:"kerberosEnabled,omitempty"` - // SecurityStyle - The security style of volume. Possible values include: 'Ntfs', 'Unix' + // SecurityStyle - The security style of volume, default unix, ntfs for dual protocol or CIFS protocol. Possible values include: 'Ntfs', 'Unix' SecurityStyle SecurityStyle `json:"securityStyle,omitempty"` ThroughputMibps *float64 `json:"throughputMibps,omitempty"` } @@ -3006,9 +3006,6 @@ func (vp VolumeProperties) MarshalJSON() ([]byte, error) { if vp.SubnetID != nil { objectMap["subnetId"] = vp.SubnetID } - if vp.MountTargets != nil { - objectMap["mountTargets"] = vp.MountTargets - } if vp.VolumeType != nil { objectMap["volumeType"] = vp.VolumeType } diff --git a/services/netapp/mgmt/2020-08-01/netapp/operations.go b/services/netapp/mgmt/2020-08-01/netapp/operations.go index a78ad44b22ef..a040d103bb9f 100644 --- a/services/netapp/mgmt/2020-08-01/netapp/operations.go +++ b/services/netapp/mgmt/2020-08-01/netapp/operations.go @@ -14,7 +14,7 @@ import ( "net/http" ) -// OperationsClient is the microsoft NetApp Azure Resource Provider specification +// OperationsClient is the microsoft NetApp Files Azure Resource Provider specification type OperationsClient struct { BaseClient } diff --git a/services/netapp/mgmt/2020-08-01/netapp/pools.go b/services/netapp/mgmt/2020-08-01/netapp/pools.go index 5038b0443055..181298180c40 100644 --- a/services/netapp/mgmt/2020-08-01/netapp/pools.go +++ b/services/netapp/mgmt/2020-08-01/netapp/pools.go @@ -15,7 +15,7 @@ import ( "net/http" ) -// PoolsClient is the microsoft NetApp Azure Resource Provider specification +// PoolsClient is the microsoft NetApp Files Azure Resource Provider specification type PoolsClient struct { BaseClient } diff --git a/services/netapp/mgmt/2020-08-01/netapp/resource.go b/services/netapp/mgmt/2020-08-01/netapp/resource.go index 8bcc741d0134..cfc2e81ec147 100644 --- a/services/netapp/mgmt/2020-08-01/netapp/resource.go +++ b/services/netapp/mgmt/2020-08-01/netapp/resource.go @@ -15,7 +15,7 @@ import ( "net/http" ) -// ResourceClient is the microsoft NetApp Azure Resource Provider specification +// ResourceClient is the microsoft NetApp Files Azure Resource Provider specification type ResourceClient struct { BaseClient } diff --git a/services/netapp/mgmt/2020-08-01/netapp/snapshotpolicies.go b/services/netapp/mgmt/2020-08-01/netapp/snapshotpolicies.go index 383c2cfa4975..f16521be4d9c 100644 --- a/services/netapp/mgmt/2020-08-01/netapp/snapshotpolicies.go +++ b/services/netapp/mgmt/2020-08-01/netapp/snapshotpolicies.go @@ -15,7 +15,7 @@ import ( "net/http" ) -// SnapshotPoliciesClient is the microsoft NetApp Azure Resource Provider specification +// SnapshotPoliciesClient is the microsoft NetApp Files Azure Resource Provider specification type SnapshotPoliciesClient struct { BaseClient } diff --git a/services/netapp/mgmt/2020-08-01/netapp/snapshots.go b/services/netapp/mgmt/2020-08-01/netapp/snapshots.go index 2e2b2ecdc805..517be4341e20 100644 --- a/services/netapp/mgmt/2020-08-01/netapp/snapshots.go +++ b/services/netapp/mgmt/2020-08-01/netapp/snapshots.go @@ -15,7 +15,7 @@ import ( "net/http" ) -// SnapshotsClient is the microsoft NetApp Azure Resource Provider specification +// SnapshotsClient is the microsoft NetApp Files Azure Resource Provider specification type SnapshotsClient struct { BaseClient } diff --git a/services/netapp/mgmt/2020-08-01/netapp/vaults.go b/services/netapp/mgmt/2020-08-01/netapp/vaults.go index 8d7f0f07645c..dbf0af197196 100644 --- a/services/netapp/mgmt/2020-08-01/netapp/vaults.go +++ b/services/netapp/mgmt/2020-08-01/netapp/vaults.go @@ -15,7 +15,7 @@ import ( "net/http" ) -// VaultsClient is the microsoft NetApp Azure Resource Provider specification +// VaultsClient is the microsoft NetApp Files Azure Resource Provider specification type VaultsClient struct { BaseClient } diff --git a/services/netapp/mgmt/2020-08-01/netapp/volumes.go b/services/netapp/mgmt/2020-08-01/netapp/volumes.go index 9b4ecce7d94d..f1e0e64c878e 100644 --- a/services/netapp/mgmt/2020-08-01/netapp/volumes.go +++ b/services/netapp/mgmt/2020-08-01/netapp/volumes.go @@ -15,7 +15,7 @@ import ( "net/http" ) -// VolumesClient is the microsoft NetApp Azure Resource Provider specification +// VolumesClient is the microsoft NetApp Files Azure Resource Provider specification type VolumesClient struct { BaseClient } @@ -287,7 +287,7 @@ func (client VolumesClient) CreateOrUpdate(ctx context.Context, body Volume, res }}, {Target: "body.VolumeProperties.ThroughputMibps", Name: validation.Null, Rule: false, Chain: []validation.Constraint{{Target: "body.VolumeProperties.ThroughputMibps", Name: validation.InclusiveMaximum, Rule: float64(4500), Chain: nil}, - {Target: "body.VolumeProperties.ThroughputMibps", Name: validation.InclusiveMinimum, Rule: float64(1), Chain: nil}, + {Target: "body.VolumeProperties.ThroughputMibps", Name: validation.InclusiveMinimum, Rule: float64(0), Chain: nil}, {Target: "body.VolumeProperties.ThroughputMibps", Name: validation.MultipleOf, Rule: 0.001, Chain: nil}, }}, }}}}, @@ -1053,7 +1053,7 @@ func (client VolumesClient) ReplicationStatusMethodResponder(resp *http.Response } // 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 source to destination. +// will reverse-resync the connection and sync from destination to source. // Parameters: // resourceGroupName - the name of the resource group. // accountName - the name of the NetApp account diff --git a/services/netapp/mgmt/2020-09-01/netapp/CHANGELOG.md b/services/netapp/mgmt/2020-09-01/netapp/CHANGELOG.md index 1984ed2e57f2..a5415c33a3a9 100644 --- a/services/netapp/mgmt/2020-09-01/netapp/CHANGELOG.md +++ b/services/netapp/mgmt/2020-09-01/netapp/CHANGELOG.md @@ -1,7 +1,29 @@ -# Change History +# Unreleased + +## Breaking Changes + +### Removed Constants + +1. QosType.Auto + +### Signature Changes + +#### Const Types + +1. Manual changed type from QosType to BackupType + +#### Struct Fields + +1. BackupProperties.BackupType changed type from *string to BackupType ## Additive Changes +### New Constants + +1. BackupType.Scheduled +1. QosType.QosTypeAuto +1. QosType.QosTypeManual + ### New Funcs -1. SnapshotProperties.MarshalJSON() ([]byte, error) +1. PossibleBackupTypeValues() []BackupType diff --git a/services/netapp/mgmt/2020-09-01/netapp/_meta.json b/services/netapp/mgmt/2020-09-01/netapp/_meta.json index 21310b188192..65384c3d3cf8 100644 --- a/services/netapp/mgmt/2020-09-01/netapp/_meta.json +++ b/services/netapp/mgmt/2020-09-01/netapp/_meta.json @@ -1,5 +1,5 @@ { - "commit": "b08824e05817297a4b2874d8db5e6fc8c29349c9", + "commit": "81ec17ce66f59c587024bfa8002fafb4436b83ef", "readme": "/_/azure-rest-api-specs/specification/netapp/resource-manager/readme.md", "tag": "package-netapp-2020-09-01", "use": "@microsoft.azure/autorest.go@2.1.183", diff --git a/services/netapp/mgmt/2020-09-01/netapp/accountbackups.go b/services/netapp/mgmt/2020-09-01/netapp/accountbackups.go index f1138442f4b2..149b67e3f708 100644 --- a/services/netapp/mgmt/2020-09-01/netapp/accountbackups.go +++ b/services/netapp/mgmt/2020-09-01/netapp/accountbackups.go @@ -15,7 +15,7 @@ import ( "net/http" ) -// AccountBackupsClient is the microsoft NetApp Azure Resource Provider specification +// AccountBackupsClient is the microsoft NetApp Files Azure Resource Provider specification type AccountBackupsClient struct { BaseClient } diff --git a/services/netapp/mgmt/2020-09-01/netapp/accounts.go b/services/netapp/mgmt/2020-09-01/netapp/accounts.go index 4c2661c05aa3..143cb7ecd605 100644 --- a/services/netapp/mgmt/2020-09-01/netapp/accounts.go +++ b/services/netapp/mgmt/2020-09-01/netapp/accounts.go @@ -15,7 +15,7 @@ import ( "net/http" ) -// AccountsClient is the microsoft NetApp Azure Resource Provider specification +// AccountsClient is the microsoft NetApp Files Azure Resource Provider specification type AccountsClient struct { BaseClient } diff --git a/services/netapp/mgmt/2020-09-01/netapp/backuppolicies.go b/services/netapp/mgmt/2020-09-01/netapp/backuppolicies.go index e10ef1c349f9..0623442bdd29 100644 --- a/services/netapp/mgmt/2020-09-01/netapp/backuppolicies.go +++ b/services/netapp/mgmt/2020-09-01/netapp/backuppolicies.go @@ -15,7 +15,7 @@ import ( "net/http" ) -// BackupPoliciesClient is the microsoft NetApp Azure Resource Provider specification +// BackupPoliciesClient is the microsoft NetApp Files Azure Resource Provider specification type BackupPoliciesClient struct { BaseClient } diff --git a/services/netapp/mgmt/2020-09-01/netapp/backups.go b/services/netapp/mgmt/2020-09-01/netapp/backups.go index 3abfbec8d0f1..f306508836ce 100644 --- a/services/netapp/mgmt/2020-09-01/netapp/backups.go +++ b/services/netapp/mgmt/2020-09-01/netapp/backups.go @@ -15,7 +15,7 @@ import ( "net/http" ) -// BackupsClient is the microsoft NetApp Azure Resource Provider specification +// BackupsClient is the microsoft NetApp Files Azure Resource Provider specification type BackupsClient struct { BaseClient } diff --git a/services/netapp/mgmt/2020-09-01/netapp/client.go b/services/netapp/mgmt/2020-09-01/netapp/client.go index 70baabe7df6a..9b2d2d98789e 100644 --- a/services/netapp/mgmt/2020-09-01/netapp/client.go +++ b/services/netapp/mgmt/2020-09-01/netapp/client.go @@ -1,6 +1,6 @@ // Package netapp implements the Azure ARM Netapp service API version 2020-09-01. // -// Microsoft NetApp Azure Resource Provider specification +// Microsoft NetApp Files Azure Resource Provider specification package netapp // Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/services/netapp/mgmt/2020-09-01/netapp/enums.go b/services/netapp/mgmt/2020-09-01/netapp/enums.go index d9a077191155..42e74827d9c3 100644 --- a/services/netapp/mgmt/2020-09-01/netapp/enums.go +++ b/services/netapp/mgmt/2020-09-01/netapp/enums.go @@ -27,6 +27,21 @@ func PossibleActiveDirectoryStatusValues() []ActiveDirectoryStatus { return []ActiveDirectoryStatus{Created, Deleted, Error, InUse, Updating} } +// BackupType enumerates the values for backup type. +type BackupType string + +const ( + // Manual Manual backup + Manual BackupType = "Manual" + // Scheduled Scheduled backup + Scheduled BackupType = "Scheduled" +) + +// PossibleBackupTypeValues returns an array of possible values for the BackupType const type. +func PossibleBackupTypeValues() []BackupType { + return []BackupType{Manual, Scheduled} +} + // CheckNameResourceTypes enumerates the values for check name resource types. type CheckNameResourceTypes string @@ -116,15 +131,15 @@ func PossibleMirrorStateValues() []MirrorState { type QosType string const ( - // Auto qos type Auto - Auto QosType = "Auto" - // Manual qos type Manual - Manual QosType = "Manual" + // QosTypeAuto qos type Auto + QosTypeAuto QosType = "Auto" + // QosTypeManual qos type Manual + QosTypeManual QosType = "Manual" ) // PossibleQosTypeValues returns an array of possible values for the QosType const type. func PossibleQosTypeValues() []QosType { - return []QosType{Auto, Manual} + return []QosType{QosTypeAuto, QosTypeManual} } // RelationshipStatus enumerates the values for relationship status. diff --git a/services/netapp/mgmt/2020-09-01/netapp/models.go b/services/netapp/mgmt/2020-09-01/netapp/models.go index 49c21090b397..41757b49fd86 100644 --- a/services/netapp/mgmt/2020-09-01/netapp/models.go +++ b/services/netapp/mgmt/2020-09-01/netapp/models.go @@ -1089,8 +1089,8 @@ type BackupProperties struct { Size *int64 `json:"size,omitempty"` // Label - Label for backup Label *string `json:"label,omitempty"` - // BackupType - READ-ONLY; Type of backup adhoc or scheduled - BackupType *string `json:"backupType,omitempty"` + // BackupType - READ-ONLY; Type of backup Manual or Scheduled. Possible values include: 'Manual', 'Scheduled' + BackupType BackupType `json:"backupType,omitempty"` } // MarshalJSON is the custom marshaler for BackupProperties. @@ -1753,7 +1753,7 @@ type PoolChangeRequest struct { type PoolPatchProperties struct { // Size - Provisioned size of the pool (in bytes). Allowed values are in 4TiB chunks (value must be multiply of 4398046511104). Size *int64 `json:"size,omitempty"` - // QosType - The qos type of the pool. Possible values include: 'Auto', 'Manual' + // QosType - The qos type of the pool. Possible values include: 'QosTypeAuto', 'QosTypeManual' QosType QosType `json:"qosType,omitempty"` } @@ -1771,7 +1771,7 @@ type PoolProperties struct { TotalThroughputMibps *float64 `json:"totalThroughputMibps,omitempty"` // UtilizedThroughputMibps - READ-ONLY; Utilized throughput of pool in Mibps UtilizedThroughputMibps *float64 `json:"utilizedThroughputMibps,omitempty"` - // QosType - The qos type of the pool. Possible values include: 'Auto', 'Manual' + // QosType - The qos type of the pool. Possible values include: 'QosTypeAuto', 'QosTypeManual' QosType QosType `json:"qosType,omitempty"` } @@ -3109,7 +3109,7 @@ type VolumeProperties struct { UsageThreshold *int64 `json:"usageThreshold,omitempty"` // ExportPolicy - Set of export policy rules ExportPolicy *VolumePropertiesExportPolicy `json:"exportPolicy,omitempty"` - // ProtocolTypes - Set of protocol types + // ProtocolTypes - Set of protocol types, default NFSv3, CIFS for SMB protocol ProtocolTypes *[]string `json:"protocolTypes,omitempty"` // ProvisioningState - READ-ONLY; Azure lifecycle management ProvisioningState *string `json:"provisioningState,omitempty"` @@ -3121,7 +3121,7 @@ type VolumeProperties struct { BaremetalTenantID *string `json:"baremetalTenantId,omitempty"` // SubnetID - The Azure Resource URI for a delegated subnet. Must have the delegation Microsoft.NetApp/volumes SubnetID *string `json:"subnetId,omitempty"` - // MountTargets - List of mount targets + // MountTargets - READ-ONLY; List of mount targets MountTargets *[]MountTargetProperties `json:"mountTargets,omitempty"` // VolumeType - What type of volume is this VolumeType *string `json:"volumeType,omitempty"` @@ -3133,7 +3133,7 @@ type VolumeProperties struct { SnapshotDirectoryVisible *bool `json:"snapshotDirectoryVisible,omitempty"` // KerberosEnabled - Describe if a volume is KerberosEnabled. To be use with swagger version 2020-05-01 or later KerberosEnabled *bool `json:"kerberosEnabled,omitempty"` - // SecurityStyle - The security style of volume. Possible values include: 'Ntfs', 'Unix' + // SecurityStyle - The security style of volume, default unix, ntfs for dual protocol or CIFS protocol. Possible values include: 'Ntfs', 'Unix' SecurityStyle SecurityStyle `json:"securityStyle,omitempty"` // SmbEncryption - 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"` @@ -3169,9 +3169,6 @@ func (vp VolumeProperties) MarshalJSON() ([]byte, error) { if vp.SubnetID != nil { objectMap["subnetId"] = vp.SubnetID } - if vp.MountTargets != nil { - objectMap["mountTargets"] = vp.MountTargets - } if vp.VolumeType != nil { objectMap["volumeType"] = vp.VolumeType } diff --git a/services/netapp/mgmt/2020-09-01/netapp/operations.go b/services/netapp/mgmt/2020-09-01/netapp/operations.go index 94a8a88f7f23..6d283e78e7c4 100644 --- a/services/netapp/mgmt/2020-09-01/netapp/operations.go +++ b/services/netapp/mgmt/2020-09-01/netapp/operations.go @@ -14,7 +14,7 @@ import ( "net/http" ) -// OperationsClient is the microsoft NetApp Azure Resource Provider specification +// OperationsClient is the microsoft NetApp Files Azure Resource Provider specification type OperationsClient struct { BaseClient } diff --git a/services/netapp/mgmt/2020-09-01/netapp/pools.go b/services/netapp/mgmt/2020-09-01/netapp/pools.go index f5349d0218ef..e349295e07f6 100644 --- a/services/netapp/mgmt/2020-09-01/netapp/pools.go +++ b/services/netapp/mgmt/2020-09-01/netapp/pools.go @@ -15,7 +15,7 @@ import ( "net/http" ) -// PoolsClient is the microsoft NetApp Azure Resource Provider specification +// PoolsClient is the microsoft NetApp Files Azure Resource Provider specification type PoolsClient struct { BaseClient } diff --git a/services/netapp/mgmt/2020-09-01/netapp/resource.go b/services/netapp/mgmt/2020-09-01/netapp/resource.go index 016f74f4d613..fe74a48cb465 100644 --- a/services/netapp/mgmt/2020-09-01/netapp/resource.go +++ b/services/netapp/mgmt/2020-09-01/netapp/resource.go @@ -15,7 +15,7 @@ import ( "net/http" ) -// ResourceClient is the microsoft NetApp Azure Resource Provider specification +// ResourceClient is the microsoft NetApp Files Azure Resource Provider specification type ResourceClient struct { BaseClient } diff --git a/services/netapp/mgmt/2020-09-01/netapp/snapshotpolicies.go b/services/netapp/mgmt/2020-09-01/netapp/snapshotpolicies.go index 312fa0de334f..b2e73d00fad3 100644 --- a/services/netapp/mgmt/2020-09-01/netapp/snapshotpolicies.go +++ b/services/netapp/mgmt/2020-09-01/netapp/snapshotpolicies.go @@ -15,7 +15,7 @@ import ( "net/http" ) -// SnapshotPoliciesClient is the microsoft NetApp Azure Resource Provider specification +// SnapshotPoliciesClient is the microsoft NetApp Files Azure Resource Provider specification type SnapshotPoliciesClient struct { BaseClient } diff --git a/services/netapp/mgmt/2020-09-01/netapp/snapshots.go b/services/netapp/mgmt/2020-09-01/netapp/snapshots.go index 9b1017d0b326..5a9c2f56c31d 100644 --- a/services/netapp/mgmt/2020-09-01/netapp/snapshots.go +++ b/services/netapp/mgmt/2020-09-01/netapp/snapshots.go @@ -15,7 +15,7 @@ import ( "net/http" ) -// SnapshotsClient is the microsoft NetApp Azure Resource Provider specification +// SnapshotsClient is the microsoft NetApp Files Azure Resource Provider specification type SnapshotsClient struct { BaseClient } diff --git a/services/netapp/mgmt/2020-09-01/netapp/vaults.go b/services/netapp/mgmt/2020-09-01/netapp/vaults.go index 70a1d2872500..63c32086de3b 100644 --- a/services/netapp/mgmt/2020-09-01/netapp/vaults.go +++ b/services/netapp/mgmt/2020-09-01/netapp/vaults.go @@ -15,7 +15,7 @@ import ( "net/http" ) -// VaultsClient is the microsoft NetApp Azure Resource Provider specification +// VaultsClient is the microsoft NetApp Files Azure Resource Provider specification type VaultsClient struct { BaseClient } diff --git a/services/netapp/mgmt/2020-09-01/netapp/volumes.go b/services/netapp/mgmt/2020-09-01/netapp/volumes.go index def72e3d9ecd..b6fa20735237 100644 --- a/services/netapp/mgmt/2020-09-01/netapp/volumes.go +++ b/services/netapp/mgmt/2020-09-01/netapp/volumes.go @@ -15,7 +15,7 @@ import ( "net/http" ) -// VolumesClient is the microsoft NetApp Azure Resource Provider specification +// VolumesClient is the microsoft NetApp Files Azure Resource Provider specification type VolumesClient struct { BaseClient } @@ -287,7 +287,7 @@ func (client VolumesClient) CreateOrUpdate(ctx context.Context, body Volume, res }}, {Target: "body.VolumeProperties.ThroughputMibps", Name: validation.Null, Rule: false, Chain: []validation.Constraint{{Target: "body.VolumeProperties.ThroughputMibps", Name: validation.InclusiveMaximum, Rule: float64(4500), Chain: nil}, - {Target: "body.VolumeProperties.ThroughputMibps", Name: validation.InclusiveMinimum, Rule: float64(1), Chain: nil}, + {Target: "body.VolumeProperties.ThroughputMibps", Name: validation.InclusiveMinimum, Rule: float64(0), Chain: nil}, {Target: "body.VolumeProperties.ThroughputMibps", Name: validation.MultipleOf, Rule: 0.001, Chain: nil}, }}, }}}}, diff --git a/services/netapp/mgmt/2020-11-01/netapp/CHANGELOG.md b/services/netapp/mgmt/2020-11-01/netapp/CHANGELOG.md index 1984ed2e57f2..a5415c33a3a9 100644 --- a/services/netapp/mgmt/2020-11-01/netapp/CHANGELOG.md +++ b/services/netapp/mgmt/2020-11-01/netapp/CHANGELOG.md @@ -1,7 +1,29 @@ -# Change History +# Unreleased + +## Breaking Changes + +### Removed Constants + +1. QosType.Auto + +### Signature Changes + +#### Const Types + +1. Manual changed type from QosType to BackupType + +#### Struct Fields + +1. BackupProperties.BackupType changed type from *string to BackupType ## Additive Changes +### New Constants + +1. BackupType.Scheduled +1. QosType.QosTypeAuto +1. QosType.QosTypeManual + ### New Funcs -1. SnapshotProperties.MarshalJSON() ([]byte, error) +1. PossibleBackupTypeValues() []BackupType diff --git a/services/netapp/mgmt/2020-11-01/netapp/_meta.json b/services/netapp/mgmt/2020-11-01/netapp/_meta.json index 4540e45860e3..5be4a2bd2c2f 100644 --- a/services/netapp/mgmt/2020-11-01/netapp/_meta.json +++ b/services/netapp/mgmt/2020-11-01/netapp/_meta.json @@ -1,5 +1,5 @@ { - "commit": "92ab22b49bd085116af0c61fada2c6c360702e9e", + "commit": "81ec17ce66f59c587024bfa8002fafb4436b83ef", "readme": "/_/azure-rest-api-specs/specification/netapp/resource-manager/readme.md", "tag": "package-netapp-2020-11-01", "use": "@microsoft.azure/autorest.go@2.1.183", diff --git a/services/netapp/mgmt/2020-11-01/netapp/enums.go b/services/netapp/mgmt/2020-11-01/netapp/enums.go index ccffe9b76e48..ba8e7a005b75 100644 --- a/services/netapp/mgmt/2020-11-01/netapp/enums.go +++ b/services/netapp/mgmt/2020-11-01/netapp/enums.go @@ -27,6 +27,21 @@ func PossibleActiveDirectoryStatusValues() []ActiveDirectoryStatus { return []ActiveDirectoryStatus{Created, Deleted, Error, InUse, Updating} } +// BackupType enumerates the values for backup type. +type BackupType string + +const ( + // Manual Manual backup + Manual BackupType = "Manual" + // Scheduled Scheduled backup + Scheduled BackupType = "Scheduled" +) + +// PossibleBackupTypeValues returns an array of possible values for the BackupType const type. +func PossibleBackupTypeValues() []BackupType { + return []BackupType{Manual, Scheduled} +} + // CheckNameResourceTypes enumerates the values for check name resource types. type CheckNameResourceTypes string @@ -148,15 +163,15 @@ func PossibleMirrorStateValues() []MirrorState { type QosType string const ( - // Auto qos type Auto - Auto QosType = "Auto" - // Manual qos type Manual - Manual QosType = "Manual" + // QosTypeAuto qos type Auto + QosTypeAuto QosType = "Auto" + // QosTypeManual qos type Manual + QosTypeManual QosType = "Manual" ) // PossibleQosTypeValues returns an array of possible values for the QosType const type. func PossibleQosTypeValues() []QosType { - return []QosType{Auto, Manual} + return []QosType{QosTypeAuto, QosTypeManual} } // RelationshipStatus enumerates the values for relationship status. diff --git a/services/netapp/mgmt/2020-11-01/netapp/models.go b/services/netapp/mgmt/2020-11-01/netapp/models.go index 133f62399830..cdda849eee41 100644 --- a/services/netapp/mgmt/2020-11-01/netapp/models.go +++ b/services/netapp/mgmt/2020-11-01/netapp/models.go @@ -1268,8 +1268,8 @@ type BackupProperties struct { Size *int64 `json:"size,omitempty"` // Label - Label for backup Label *string `json:"label,omitempty"` - // BackupType - READ-ONLY; Type of backup adhoc or scheduled - BackupType *string `json:"backupType,omitempty"` + // BackupType - READ-ONLY; Type of backup Manual or Scheduled. Possible values include: 'Manual', 'Scheduled' + BackupType BackupType `json:"backupType,omitempty"` // FailureReason - READ-ONLY; Failure reason FailureReason *string `json:"failureReason,omitempty"` } @@ -2143,7 +2143,7 @@ type PoolChangeRequest struct { type PoolPatchProperties struct { // Size - Provisioned size of the pool (in bytes). Allowed values are in 4TiB chunks (value must be multiply of 4398046511104). Size *int64 `json:"size,omitempty"` - // QosType - The qos type of the pool. Possible values include: 'Auto', 'Manual' + // QosType - The qos type of the pool. Possible values include: 'QosTypeAuto', 'QosTypeManual' QosType QosType `json:"qosType,omitempty"` } @@ -2161,7 +2161,7 @@ type PoolProperties struct { TotalThroughputMibps *float64 `json:"totalThroughputMibps,omitempty"` // UtilizedThroughputMibps - READ-ONLY; Utilized throughput of pool in Mibps UtilizedThroughputMibps *float64 `json:"utilizedThroughputMibps,omitempty"` - // QosType - The qos type of the pool. Possible values include: 'Auto', 'Manual' + // QosType - The qos type of the pool. Possible values include: 'QosTypeAuto', 'QosTypeManual' QosType QosType `json:"qosType,omitempty"` } @@ -3558,7 +3558,7 @@ type VolumeProperties struct { UsageThreshold *int64 `json:"usageThreshold,omitempty"` // ExportPolicy - Set of export policy rules ExportPolicy *VolumePropertiesExportPolicy `json:"exportPolicy,omitempty"` - // ProtocolTypes - Set of protocol types, default NFSv3, CIFS fro SMB protocol + // ProtocolTypes - Set of protocol types, default NFSv3, CIFS for SMB protocol ProtocolTypes *[]string `json:"protocolTypes,omitempty"` // ProvisioningState - READ-ONLY; Azure lifecycle management ProvisioningState *string `json:"provisioningState,omitempty"` diff --git a/services/netapp/mgmt/2020-12-01/netapp/CHANGELOG.md b/services/netapp/mgmt/2020-12-01/netapp/CHANGELOG.md index 6c2e61661036..a5415c33a3a9 100644 --- a/services/netapp/mgmt/2020-12-01/netapp/CHANGELOG.md +++ b/services/netapp/mgmt/2020-12-01/netapp/CHANGELOG.md @@ -1,8 +1,29 @@ -# Change History +# Unreleased + +## Breaking Changes + +### Removed Constants + +1. QosType.Auto + +### Signature Changes + +#### Const Types + +1. Manual changed type from QosType to BackupType + +#### Struct Fields + +1. BackupProperties.BackupType changed type from *string to BackupType ## Additive Changes +### New Constants + +1. BackupType.Scheduled +1. QosType.QosTypeAuto +1. QosType.QosTypeManual + ### New Funcs -1. BackupStatus.MarshalJSON() ([]byte, error) -1. SnapshotProperties.MarshalJSON() ([]byte, error) +1. PossibleBackupTypeValues() []BackupType diff --git a/services/netapp/mgmt/2020-12-01/netapp/_meta.json b/services/netapp/mgmt/2020-12-01/netapp/_meta.json index 8f77702fd460..43d727c28cc4 100644 --- a/services/netapp/mgmt/2020-12-01/netapp/_meta.json +++ b/services/netapp/mgmt/2020-12-01/netapp/_meta.json @@ -1,5 +1,5 @@ { - "commit": "8d3b22458da4bb9309c0207c2ebc1903de741249", + "commit": "81ec17ce66f59c587024bfa8002fafb4436b83ef", "readme": "/_/azure-rest-api-specs/specification/netapp/resource-manager/readme.md", "tag": "package-netapp-2020-12-01", "use": "@microsoft.azure/autorest.go@2.1.183", diff --git a/services/netapp/mgmt/2020-12-01/netapp/enums.go b/services/netapp/mgmt/2020-12-01/netapp/enums.go index 93a16e69c14e..62c786f1aa7b 100644 --- a/services/netapp/mgmt/2020-12-01/netapp/enums.go +++ b/services/netapp/mgmt/2020-12-01/netapp/enums.go @@ -27,6 +27,21 @@ func PossibleActiveDirectoryStatusValues() []ActiveDirectoryStatus { return []ActiveDirectoryStatus{Created, Deleted, Error, InUse, Updating} } +// BackupType enumerates the values for backup type. +type BackupType string + +const ( + // Manual Manual backup + Manual BackupType = "Manual" + // Scheduled Scheduled backup + Scheduled BackupType = "Scheduled" +) + +// PossibleBackupTypeValues returns an array of possible values for the BackupType const type. +func PossibleBackupTypeValues() []BackupType { + return []BackupType{Manual, Scheduled} +} + // CheckNameResourceTypes enumerates the values for check name resource types. type CheckNameResourceTypes string @@ -135,15 +150,15 @@ func PossibleMirrorStateValues() []MirrorState { type QosType string const ( - // Auto qos type Auto - Auto QosType = "Auto" - // Manual qos type Manual - Manual QosType = "Manual" + // QosTypeAuto qos type Auto + QosTypeAuto QosType = "Auto" + // QosTypeManual qos type Manual + QosTypeManual QosType = "Manual" ) // PossibleQosTypeValues returns an array of possible values for the QosType const type. func PossibleQosTypeValues() []QosType { - return []QosType{Auto, Manual} + return []QosType{QosTypeAuto, QosTypeManual} } // RelationshipStatus enumerates the values for relationship status. diff --git a/services/netapp/mgmt/2020-12-01/netapp/models.go b/services/netapp/mgmt/2020-12-01/netapp/models.go index 9cae52cffc35..ee52bb3f4dbd 100644 --- a/services/netapp/mgmt/2020-12-01/netapp/models.go +++ b/services/netapp/mgmt/2020-12-01/netapp/models.go @@ -1273,8 +1273,8 @@ type BackupProperties struct { Size *int64 `json:"size,omitempty"` // Label - Label for backup Label *string `json:"label,omitempty"` - // BackupType - READ-ONLY; Type of backup adhoc or scheduled - BackupType *string `json:"backupType,omitempty"` + // BackupType - READ-ONLY; Type of backup Manual or Scheduled. Possible values include: 'Manual', 'Scheduled' + BackupType BackupType `json:"backupType,omitempty"` // FailureReason - READ-ONLY; Failure reason FailureReason *string `json:"failureReason,omitempty"` // VolumeName - READ-ONLY; Volume name @@ -2171,7 +2171,7 @@ type PoolChangeRequest struct { type PoolPatchProperties struct { // Size - Provisioned size of the pool (in bytes). Allowed values are in 4TiB chunks (value must be multiply of 4398046511104). Size *int64 `json:"size,omitempty"` - // QosType - The qos type of the pool. Possible values include: 'Auto', 'Manual' + // QosType - The qos type of the pool. Possible values include: 'QosTypeAuto', 'QosTypeManual' QosType QosType `json:"qosType,omitempty"` } @@ -2189,7 +2189,7 @@ type PoolProperties struct { TotalThroughputMibps *float64 `json:"totalThroughputMibps,omitempty"` // UtilizedThroughputMibps - READ-ONLY; Utilized throughput of pool in Mibps UtilizedThroughputMibps *float64 `json:"utilizedThroughputMibps,omitempty"` - // QosType - The qos type of the pool. Possible values include: 'Auto', 'Manual' + // QosType - The qos type of the pool. Possible values include: 'QosTypeAuto', 'QosTypeManual' QosType QosType `json:"qosType,omitempty"` } @@ -3603,7 +3603,7 @@ type VolumeProperties struct { UsageThreshold *int64 `json:"usageThreshold,omitempty"` // ExportPolicy - Set of export policy rules ExportPolicy *VolumePropertiesExportPolicy `json:"exportPolicy,omitempty"` - // ProtocolTypes - Set of protocol types, default NFSv3, CIFS fro SMB protocol + // ProtocolTypes - Set of protocol types, default NFSv3, CIFS for SMB protocol ProtocolTypes *[]string `json:"protocolTypes,omitempty"` // ProvisioningState - READ-ONLY; Azure lifecycle management ProvisioningState *string `json:"provisioningState,omitempty"` diff --git a/services/netapp/mgmt/2021-02-01/netapp/CHANGELOG.md b/services/netapp/mgmt/2021-02-01/netapp/CHANGELOG.md index 52911e4cc5e4..a1ecf841edb0 100644 --- a/services/netapp/mgmt/2021-02-01/netapp/CHANGELOG.md +++ b/services/netapp/mgmt/2021-02-01/netapp/CHANGELOG.md @@ -1,2 +1,2 @@ -# Change History +# Unreleased diff --git a/services/netapp/mgmt/2021-02-01/netapp/_meta.json b/services/netapp/mgmt/2021-02-01/netapp/_meta.json index de82b9e4aa96..c60c05ff4f4b 100644 --- a/services/netapp/mgmt/2021-02-01/netapp/_meta.json +++ b/services/netapp/mgmt/2021-02-01/netapp/_meta.json @@ -1,5 +1,5 @@ { - "commit": "e6ee3d4f6a29f081eddada399bd1cb373133af02", + "commit": "81ec17ce66f59c587024bfa8002fafb4436b83ef", "readme": "/_/azure-rest-api-specs/specification/netapp/resource-manager/readme.md", "tag": "package-netapp-2021-02-01", "use": "@microsoft.azure/autorest.go@2.1.183", diff --git a/services/netapp/mgmt/2021-04-01/netapp/CHANGELOG.md b/services/netapp/mgmt/2021-04-01/netapp/CHANGELOG.md index 52911e4cc5e4..963a5a77adbb 100644 --- a/services/netapp/mgmt/2021-04-01/netapp/CHANGELOG.md +++ b/services/netapp/mgmt/2021-04-01/netapp/CHANGELOG.md @@ -1,2 +1,10 @@ -# Change History +# Unreleased +## Additive Changes + +### Struct Changes + +#### New Struct Fields + +1. Backup.SystemData +1. BackupPolicy.SystemData diff --git a/services/netapp/mgmt/2021-04-01/netapp/_meta.json b/services/netapp/mgmt/2021-04-01/netapp/_meta.json index ffb178c93d17..4f4891c8134d 100644 --- a/services/netapp/mgmt/2021-04-01/netapp/_meta.json +++ b/services/netapp/mgmt/2021-04-01/netapp/_meta.json @@ -1,5 +1,5 @@ { - "commit": "ef7ffaa1ae68ab17dba86d8e0be5fd1fb615ef64", + "commit": "81ec17ce66f59c587024bfa8002fafb4436b83ef", "readme": "/_/azure-rest-api-specs/specification/netapp/resource-manager/readme.md", "tag": "package-netapp-2021-04-01", "use": "@microsoft.azure/autorest.go@2.1.183", diff --git a/services/netapp/mgmt/2021-04-01/netapp/backuppolicies.go b/services/netapp/mgmt/2021-04-01/netapp/backuppolicies.go index ddb4e4c9ce18..c144496e1991 100644 --- a/services/netapp/mgmt/2021-04-01/netapp/backuppolicies.go +++ b/services/netapp/mgmt/2021-04-01/netapp/backuppolicies.go @@ -91,6 +91,7 @@ func (client BackupPoliciesClient) CreatePreparer(ctx context.Context, resourceG body.ID = nil body.Name = nil body.Type = nil + body.SystemData = nil preparer := autorest.CreatePreparer( autorest.AsContentType("application/json; charset=utf-8"), autorest.AsPut(), diff --git a/services/netapp/mgmt/2021-04-01/netapp/backups.go b/services/netapp/mgmt/2021-04-01/netapp/backups.go index 6dca692d11f5..c7d3aac7be25 100644 --- a/services/netapp/mgmt/2021-04-01/netapp/backups.go +++ b/services/netapp/mgmt/2021-04-01/netapp/backups.go @@ -109,6 +109,7 @@ func (client BackupsClient) CreatePreparer(ctx context.Context, resourceGroupNam body.ID = nil body.Name = nil body.Type = nil + body.SystemData = nil preparer := autorest.CreatePreparer( autorest.AsContentType("application/json; charset=utf-8"), autorest.AsPut(), diff --git a/services/netapp/mgmt/2021-04-01/netapp/models.go b/services/netapp/mgmt/2021-04-01/netapp/models.go index 64186d558e7a..9459372bd3ad 100644 --- a/services/netapp/mgmt/2021-04-01/netapp/models.go +++ b/services/netapp/mgmt/2021-04-01/netapp/models.go @@ -702,6 +702,8 @@ type Backup struct { Type *string `json:"type,omitempty"` // BackupProperties - Backup Properties *BackupProperties `json:"properties,omitempty"` + // SystemData - READ-ONLY; The system meta data relating to this resource. + SystemData *SystemData `json:"systemData,omitempty"` } // MarshalJSON is the custom marshaler for Backup. @@ -770,6 +772,15 @@ func (b *Backup) UnmarshalJSON(body []byte) error { } b.BackupProperties = &backupProperties } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + b.SystemData = &systemData + } } } @@ -972,6 +983,8 @@ type BackupPolicy struct { Type *string `json:"type,omitempty"` // Tags - Resource tags Tags map[string]*string `json:"tags"` + // SystemData - READ-ONLY; The system meta data relating to this resource. + SystemData *SystemData `json:"systemData,omitempty"` // BackupPolicyProperties - Backup policy Properties *BackupPolicyProperties `json:"properties,omitempty"` } @@ -1045,6 +1058,15 @@ func (bp *BackupPolicy) UnmarshalJSON(body []byte) error { } bp.Tags = tags } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + bp.SystemData = &systemData + } case "properties": if v != nil { var backupPolicyProperties BackupPolicyProperties diff --git a/services/netapp/mgmt/2021-06-01/netapp/CHANGELOG.md b/services/netapp/mgmt/2021-06-01/netapp/CHANGELOG.md new file mode 100644 index 000000000000..a1ecf841edb0 --- /dev/null +++ b/services/netapp/mgmt/2021-06-01/netapp/CHANGELOG.md @@ -0,0 +1,2 @@ +# Unreleased + diff --git a/services/netapp/mgmt/2021-06-01/netapp/_meta.json b/services/netapp/mgmt/2021-06-01/netapp/_meta.json new file mode 100644 index 000000000000..deb3d2987af3 --- /dev/null +++ b/services/netapp/mgmt/2021-06-01/netapp/_meta.json @@ -0,0 +1,11 @@ +{ + "commit": "81ec17ce66f59c587024bfa8002fafb4436b83ef", + "readme": "/_/azure-rest-api-specs/specification/netapp/resource-manager/readme.md", + "tag": "package-netapp-2021-06-01", + "use": "@microsoft.azure/autorest.go@2.1.183", + "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", + "autorest_command": "autorest --use=@microsoft.azure/autorest.go@2.1.183 --tag=package-netapp-2021-06-01 --go-sdk-folder=/_/azure-sdk-for-go --go --verbose --use-onever --version=V2 --go.license-header=MICROSOFT_MIT_NO_VERSION /_/azure-rest-api-specs/specification/netapp/resource-manager/readme.md", + "additional_properties": { + "additional_options": "--go --verbose --use-onever --version=V2 --go.license-header=MICROSOFT_MIT_NO_VERSION" + } +} \ No newline at end of file diff --git a/services/netapp/mgmt/2021-06-01/netapp/accountbackups.go b/services/netapp/mgmt/2021-06-01/netapp/accountbackups.go new file mode 100644 index 000000000000..881bea19effd --- /dev/null +++ b/services/netapp/mgmt/2021-06-01/netapp/accountbackups.go @@ -0,0 +1,289 @@ +package netapp + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// AccountBackupsClient is the microsoft NetApp Files Azure Resource Provider specification +type AccountBackupsClient struct { + BaseClient +} + +// NewAccountBackupsClient creates an instance of the AccountBackupsClient client. +func NewAccountBackupsClient(subscriptionID string) AccountBackupsClient { + return NewAccountBackupsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewAccountBackupsClientWithBaseURI creates an instance of the AccountBackupsClient client using a custom endpoint. +// Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewAccountBackupsClientWithBaseURI(baseURI string, subscriptionID string) AccountBackupsClient { + return AccountBackupsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Delete delete the specified Backup for a Netapp Account +// Parameters: +// resourceGroupName - the name of the resource group. +// accountName - the name of the NetApp account +// backupName - the name of the backup +func (client AccountBackupsClient) Delete(ctx context.Context, resourceGroupName string, accountName string, backupName string) (result AccountBackupsDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AccountBackupsClient.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("netapp.AccountBackupsClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, accountName, backupName) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.AccountBackupsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.AccountBackupsClient", "Delete", nil, "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client AccountBackupsClient) DeletePreparer(ctx context.Context, resourceGroupName string, accountName string, backupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "backupName": autorest.Encode("path", backupName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/accountBackups/{backupName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client AccountBackupsClient) DeleteSender(req *http.Request) (future AccountBackupsDeleteFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client AccountBackupsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets the specified backup for a Netapp Account +// Parameters: +// resourceGroupName - the name of the resource group. +// accountName - the name of the NetApp account +// backupName - the name of the backup +func (client AccountBackupsClient) Get(ctx context.Context, resourceGroupName string, accountName string, backupName string) (result Backup, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AccountBackupsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("netapp.AccountBackupsClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, accountName, backupName) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.AccountBackupsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "netapp.AccountBackupsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.AccountBackupsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client AccountBackupsClient) GetPreparer(ctx context.Context, resourceGroupName string, accountName string, backupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "backupName": autorest.Encode("path", backupName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/accountBackups/{backupName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client AccountBackupsClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client AccountBackupsClient) GetResponder(resp *http.Response) (result Backup, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List list all Backups for a Netapp Account +// Parameters: +// resourceGroupName - the name of the resource group. +// accountName - the name of the NetApp account +func (client AccountBackupsClient) List(ctx context.Context, resourceGroupName string, accountName string) (result BackupsList, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AccountBackupsClient.List") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("netapp.AccountBackupsClient", "List", err.Error()) + } + + req, err := client.ListPreparer(ctx, resourceGroupName, accountName) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.AccountBackupsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "netapp.AccountBackupsClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.AccountBackupsClient", "List", resp, "Failure responding to request") + return + } + + return +} + +// ListPreparer prepares the List request. +func (client AccountBackupsClient) ListPreparer(ctx context.Context, resourceGroupName string, accountName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/accountBackups", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client AccountBackupsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client AccountBackupsClient) ListResponder(resp *http.Response) (result BackupsList, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/netapp/mgmt/2021-06-01/netapp/accounts.go b/services/netapp/mgmt/2021-06-01/netapp/accounts.go new file mode 100644 index 000000000000..aeea392c9960 --- /dev/null +++ b/services/netapp/mgmt/2021-06-01/netapp/accounts.go @@ -0,0 +1,626 @@ +package netapp + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// AccountsClient is the microsoft NetApp Files Azure Resource Provider specification +type AccountsClient struct { + BaseClient +} + +// NewAccountsClient creates an instance of the AccountsClient client. +func NewAccountsClient(subscriptionID string) AccountsClient { + return NewAccountsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewAccountsClientWithBaseURI creates an instance of the AccountsClient client using a custom endpoint. Use this +// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewAccountsClientWithBaseURI(baseURI string, subscriptionID string) AccountsClient { + return AccountsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate create or update the specified NetApp account within the resource group +// Parameters: +// body - netApp Account object supplied in the body of the operation. +// resourceGroupName - the name of the resource group. +// accountName - the name of the NetApp account +func (client AccountsClient) CreateOrUpdate(ctx context.Context, body Account, resourceGroupName string, accountName string) (result AccountsCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AccountsClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: body, + Constraints: []validation.Constraint{{Target: "body.Location", Name: validation.Null, Rule: true, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("netapp.AccountsClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, body, resourceGroupName, accountName) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.AccountsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.AccountsClient", "CreateOrUpdate", nil, "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client AccountsClient) CreateOrUpdatePreparer(ctx context.Context, body Account, resourceGroupName string, accountName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + body.ID = nil + body.Name = nil + body.Etag = nil + body.Type = nil + body.SystemData = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}", pathParameters), + autorest.WithJSON(body), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client AccountsClient) CreateOrUpdateSender(req *http.Request) (future AccountsCreateOrUpdateFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client AccountsClient) CreateOrUpdateResponder(resp *http.Response) (result Account, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete delete the specified NetApp account +// Parameters: +// resourceGroupName - the name of the resource group. +// accountName - the name of the NetApp account +func (client AccountsClient) Delete(ctx context.Context, resourceGroupName string, accountName string) (result AccountsDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AccountsClient.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("netapp.AccountsClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, accountName) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.AccountsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.AccountsClient", "Delete", nil, "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client AccountsClient) DeletePreparer(ctx context.Context, resourceGroupName string, accountName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client AccountsClient) DeleteSender(req *http.Request) (future AccountsDeleteFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client AccountsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get get the NetApp account +// Parameters: +// resourceGroupName - the name of the resource group. +// accountName - the name of the NetApp account +func (client AccountsClient) Get(ctx context.Context, resourceGroupName string, accountName string) (result Account, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AccountsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("netapp.AccountsClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, accountName) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.AccountsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "netapp.AccountsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.AccountsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client AccountsClient) GetPreparer(ctx context.Context, resourceGroupName string, accountName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client AccountsClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client AccountsClient) GetResponder(resp *http.Response) (result Account, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List list and describe all NetApp accounts in the resource group. +// Parameters: +// resourceGroupName - the name of the resource group. +func (client AccountsClient) List(ctx context.Context, resourceGroupName string) (result AccountListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AccountsClient.List") + defer func() { + sc := -1 + if result.al.Response.Response != nil { + sc = result.al.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("netapp.AccountsClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.AccountsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.al.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "netapp.AccountsClient", "List", resp, "Failure sending request") + return + } + + result.al, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.AccountsClient", "List", resp, "Failure responding to request") + return + } + if result.al.hasNextLink() && result.al.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client AccountsClient) ListPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client AccountsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client AccountsClient) ListResponder(resp *http.Response) (result AccountList, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client AccountsClient) listNextResults(ctx context.Context, lastResults AccountList) (result AccountList, err error) { + req, err := lastResults.accountListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "netapp.AccountsClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "netapp.AccountsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.AccountsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client AccountsClient) ListComplete(ctx context.Context, resourceGroupName string) (result AccountListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AccountsClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, resourceGroupName) + return +} + +// ListBySubscription list and describe all NetApp accounts in the subscription. +func (client AccountsClient) ListBySubscription(ctx context.Context) (result AccountListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AccountsClient.ListBySubscription") + defer func() { + sc := -1 + if result.al.Response.Response != nil { + sc = result.al.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listBySubscriptionNextResults + req, err := client.ListBySubscriptionPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.AccountsClient", "ListBySubscription", nil, "Failure preparing request") + return + } + + resp, err := client.ListBySubscriptionSender(req) + if err != nil { + result.al.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "netapp.AccountsClient", "ListBySubscription", resp, "Failure sending request") + return + } + + result.al, err = client.ListBySubscriptionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.AccountsClient", "ListBySubscription", resp, "Failure responding to request") + return + } + if result.al.hasNextLink() && result.al.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListBySubscriptionPreparer prepares the ListBySubscription request. +func (client AccountsClient) ListBySubscriptionPreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.NetApp/netAppAccounts", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListBySubscriptionSender sends the ListBySubscription request. The method will close the +// http.Response Body if it receives an error. +func (client AccountsClient) ListBySubscriptionSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListBySubscriptionResponder handles the response to the ListBySubscription request. The method always +// closes the http.Response Body. +func (client AccountsClient) ListBySubscriptionResponder(resp *http.Response) (result AccountList, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listBySubscriptionNextResults retrieves the next set of results, if any. +func (client AccountsClient) listBySubscriptionNextResults(ctx context.Context, lastResults AccountList) (result AccountList, err error) { + req, err := lastResults.accountListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "netapp.AccountsClient", "listBySubscriptionNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListBySubscriptionSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "netapp.AccountsClient", "listBySubscriptionNextResults", resp, "Failure sending next results request") + } + result, err = client.ListBySubscriptionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.AccountsClient", "listBySubscriptionNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListBySubscriptionComplete enumerates all values, automatically crossing page boundaries as required. +func (client AccountsClient) ListBySubscriptionComplete(ctx context.Context) (result AccountListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AccountsClient.ListBySubscription") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListBySubscription(ctx) + return +} + +// Update patch the specified NetApp account +// Parameters: +// body - netApp Account object supplied in the body of the operation. +// resourceGroupName - the name of the resource group. +// accountName - the name of the NetApp account +func (client AccountsClient) Update(ctx context.Context, body AccountPatch, resourceGroupName string, accountName string) (result AccountsUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AccountsClient.Update") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("netapp.AccountsClient", "Update", err.Error()) + } + + req, err := client.UpdatePreparer(ctx, body, resourceGroupName, accountName) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.AccountsClient", "Update", nil, "Failure preparing request") + return + } + + result, err = client.UpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.AccountsClient", "Update", nil, "Failure sending request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client AccountsClient) UpdatePreparer(ctx context.Context, body AccountPatch, resourceGroupName string, accountName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + body.ID = nil + body.Name = nil + body.Type = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}", pathParameters), + autorest.WithJSON(body), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client AccountsClient) UpdateSender(req *http.Request) (future AccountsUpdateFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client AccountsClient) UpdateResponder(resp *http.Response) (result Account, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/netapp/mgmt/2021-06-01/netapp/backuppolicies.go b/services/netapp/mgmt/2021-06-01/netapp/backuppolicies.go new file mode 100644 index 000000000000..5ed7acc601fc --- /dev/null +++ b/services/netapp/mgmt/2021-06-01/netapp/backuppolicies.go @@ -0,0 +1,481 @@ +package netapp + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// BackupPoliciesClient is the microsoft NetApp Files Azure Resource Provider specification +type BackupPoliciesClient struct { + BaseClient +} + +// NewBackupPoliciesClient creates an instance of the BackupPoliciesClient client. +func NewBackupPoliciesClient(subscriptionID string) BackupPoliciesClient { + return NewBackupPoliciesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewBackupPoliciesClientWithBaseURI creates an instance of the BackupPoliciesClient client using a custom endpoint. +// Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewBackupPoliciesClientWithBaseURI(baseURI string, subscriptionID string) BackupPoliciesClient { + return BackupPoliciesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Create create a backup policy for Netapp Account +// Parameters: +// resourceGroupName - the name of the resource group. +// accountName - the name of the NetApp account +// backupPolicyName - backup policy Name which uniquely identify backup policy. +// body - backup policy object supplied in the body of the operation. +func (client BackupPoliciesClient) Create(ctx context.Context, resourceGroupName string, accountName string, backupPolicyName string, body BackupPolicy) (result BackupPoliciesCreateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BackupPoliciesClient.Create") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: body, + Constraints: []validation.Constraint{{Target: "body.Location", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "body.BackupPolicyProperties", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("netapp.BackupPoliciesClient", "Create", err.Error()) + } + + req, err := client.CreatePreparer(ctx, resourceGroupName, accountName, backupPolicyName, body) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.BackupPoliciesClient", "Create", nil, "Failure preparing request") + return + } + + result, err = client.CreateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.BackupPoliciesClient", "Create", nil, "Failure sending request") + return + } + + return +} + +// CreatePreparer prepares the Create request. +func (client BackupPoliciesClient) CreatePreparer(ctx context.Context, resourceGroupName string, accountName string, backupPolicyName string, body BackupPolicy) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "backupPolicyName": autorest.Encode("path", backupPolicyName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + body.ID = nil + body.Name = nil + body.Etag = nil + body.Type = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/backupPolicies/{backupPolicyName}", pathParameters), + autorest.WithJSON(body), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateSender sends the Create request. The method will close the +// http.Response Body if it receives an error. +func (client BackupPoliciesClient) CreateSender(req *http.Request) (future BackupPoliciesCreateFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateResponder handles the response to the Create request. The method always +// closes the http.Response Body. +func (client BackupPoliciesClient) CreateResponder(resp *http.Response) (result BackupPolicy, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete delete backup policy +// Parameters: +// resourceGroupName - the name of the resource group. +// accountName - the name of the NetApp account +// backupPolicyName - backup policy Name which uniquely identify backup policy. +func (client BackupPoliciesClient) Delete(ctx context.Context, resourceGroupName string, accountName string, backupPolicyName string) (result BackupPoliciesDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BackupPoliciesClient.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("netapp.BackupPoliciesClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, accountName, backupPolicyName) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.BackupPoliciesClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.BackupPoliciesClient", "Delete", nil, "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client BackupPoliciesClient) DeletePreparer(ctx context.Context, resourceGroupName string, accountName string, backupPolicyName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "backupPolicyName": autorest.Encode("path", backupPolicyName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/backupPolicies/{backupPolicyName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client BackupPoliciesClient) DeleteSender(req *http.Request) (future BackupPoliciesDeleteFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client BackupPoliciesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get get a particular backup Policy +// Parameters: +// resourceGroupName - the name of the resource group. +// accountName - the name of the NetApp account +// backupPolicyName - backup policy Name which uniquely identify backup policy. +func (client BackupPoliciesClient) Get(ctx context.Context, resourceGroupName string, accountName string, backupPolicyName string) (result BackupPolicy, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BackupPoliciesClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("netapp.BackupPoliciesClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, accountName, backupPolicyName) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.BackupPoliciesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "netapp.BackupPoliciesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.BackupPoliciesClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client BackupPoliciesClient) GetPreparer(ctx context.Context, resourceGroupName string, accountName string, backupPolicyName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "backupPolicyName": autorest.Encode("path", backupPolicyName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/backupPolicies/{backupPolicyName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client BackupPoliciesClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client BackupPoliciesClient) GetResponder(resp *http.Response) (result BackupPolicy, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List list backup policies for Netapp Account +// Parameters: +// resourceGroupName - the name of the resource group. +// accountName - the name of the NetApp account +func (client BackupPoliciesClient) List(ctx context.Context, resourceGroupName string, accountName string) (result BackupPoliciesList, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BackupPoliciesClient.List") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("netapp.BackupPoliciesClient", "List", err.Error()) + } + + req, err := client.ListPreparer(ctx, resourceGroupName, accountName) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.BackupPoliciesClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "netapp.BackupPoliciesClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.BackupPoliciesClient", "List", resp, "Failure responding to request") + return + } + + return +} + +// ListPreparer prepares the List request. +func (client BackupPoliciesClient) ListPreparer(ctx context.Context, resourceGroupName string, accountName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/backupPolicies", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client BackupPoliciesClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client BackupPoliciesClient) ListResponder(resp *http.Response) (result BackupPoliciesList, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Update patch a backup policy for Netapp Account +// Parameters: +// resourceGroupName - the name of the resource group. +// accountName - the name of the NetApp account +// backupPolicyName - backup policy Name which uniquely identify backup policy. +// body - backup policy object supplied in the body of the operation. +func (client BackupPoliciesClient) Update(ctx context.Context, resourceGroupName string, accountName string, backupPolicyName string, body BackupPolicyPatch) (result BackupPoliciesUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BackupPoliciesClient.Update") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("netapp.BackupPoliciesClient", "Update", err.Error()) + } + + req, err := client.UpdatePreparer(ctx, resourceGroupName, accountName, backupPolicyName, body) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.BackupPoliciesClient", "Update", nil, "Failure preparing request") + return + } + + result, err = client.UpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.BackupPoliciesClient", "Update", nil, "Failure sending request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client BackupPoliciesClient) UpdatePreparer(ctx context.Context, resourceGroupName string, accountName string, backupPolicyName string, body BackupPolicyPatch) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "backupPolicyName": autorest.Encode("path", backupPolicyName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + body.ID = nil + body.Name = nil + body.Type = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/backupPolicies/{backupPolicyName}", pathParameters), + autorest.WithJSON(body), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client BackupPoliciesClient) UpdateSender(req *http.Request) (future BackupPoliciesUpdateFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client BackupPoliciesClient) UpdateResponder(resp *http.Response) (result BackupPolicy, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/netapp/mgmt/2021-06-01/netapp/backups.go b/services/netapp/mgmt/2021-06-01/netapp/backups.go new file mode 100644 index 000000000000..5ccf780878bc --- /dev/null +++ b/services/netapp/mgmt/2021-06-01/netapp/backups.go @@ -0,0 +1,738 @@ +package netapp + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// BackupsClient is the microsoft NetApp Files Azure Resource Provider specification +type BackupsClient struct { + BaseClient +} + +// NewBackupsClient creates an instance of the BackupsClient client. +func NewBackupsClient(subscriptionID string) BackupsClient { + return NewBackupsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewBackupsClientWithBaseURI creates an instance of the BackupsClient client using a custom endpoint. Use this when +// interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewBackupsClientWithBaseURI(baseURI string, subscriptionID string) BackupsClient { + return BackupsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Create create a backup for the volume +// Parameters: +// resourceGroupName - the name of the resource group. +// accountName - the name of the NetApp account +// poolName - the name of the capacity pool +// volumeName - the name of the volume +// backupName - the name of the backup +// body - backup object supplied in the body of the operation. +func (client BackupsClient) Create(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, backupName string, body Backup) (result BackupsCreateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BackupsClient.Create") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: poolName, + Constraints: []validation.Constraint{{Target: "poolName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "poolName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "poolName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}, + {TargetValue: volumeName, + Constraints: []validation.Constraint{{Target: "volumeName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "volumeName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "volumeName", Name: validation.Pattern, Rule: `^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}, + {TargetValue: body, + Constraints: []validation.Constraint{{Target: "body.Location", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "body.BackupProperties", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "body.BackupProperties.BackupID", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "body.BackupProperties.BackupID", Name: validation.MaxLength, Rule: 36, Chain: nil}, + {Target: "body.BackupProperties.BackupID", Name: validation.MinLength, Rule: 36, Chain: nil}, + {Target: "body.BackupProperties.BackupID", Name: validation.Pattern, Rule: `^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$`, Chain: nil}, + }}, + }}}}}); err != nil { + return result, validation.NewError("netapp.BackupsClient", "Create", err.Error()) + } + + req, err := client.CreatePreparer(ctx, resourceGroupName, accountName, poolName, volumeName, backupName, body) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.BackupsClient", "Create", nil, "Failure preparing request") + return + } + + result, err = client.CreateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.BackupsClient", "Create", nil, "Failure sending request") + return + } + + return +} + +// CreatePreparer prepares the Create request. +func (client BackupsClient) CreatePreparer(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, backupName string, body Backup) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "backupName": autorest.Encode("path", backupName), + "poolName": autorest.Encode("path", poolName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "volumeName": autorest.Encode("path", volumeName), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + body.ID = nil + body.Name = nil + body.Type = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/backups/{backupName}", pathParameters), + autorest.WithJSON(body), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateSender sends the Create request. The method will close the +// http.Response Body if it receives an error. +func (client BackupsClient) CreateSender(req *http.Request) (future BackupsCreateFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateResponder handles the response to the Create request. The method always +// closes the http.Response Body. +func (client BackupsClient) CreateResponder(resp *http.Response) (result Backup, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete delete a backup of the volume +// Parameters: +// resourceGroupName - the name of the resource group. +// accountName - the name of the NetApp account +// poolName - the name of the capacity pool +// volumeName - the name of the volume +// backupName - the name of the backup +func (client BackupsClient) Delete(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, backupName string) (result BackupsDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BackupsClient.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: poolName, + Constraints: []validation.Constraint{{Target: "poolName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "poolName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "poolName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}, + {TargetValue: volumeName, + Constraints: []validation.Constraint{{Target: "volumeName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "volumeName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "volumeName", Name: validation.Pattern, Rule: `^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("netapp.BackupsClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, accountName, poolName, volumeName, backupName) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.BackupsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.BackupsClient", "Delete", nil, "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client BackupsClient) DeletePreparer(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, backupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "backupName": autorest.Encode("path", backupName), + "poolName": autorest.Encode("path", poolName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "volumeName": autorest.Encode("path", volumeName), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/backups/{backupName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client BackupsClient) DeleteSender(req *http.Request) (future BackupsDeleteFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client BackupsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets the specified backup of the volume +// Parameters: +// resourceGroupName - the name of the resource group. +// accountName - the name of the NetApp account +// poolName - the name of the capacity pool +// volumeName - the name of the volume +// backupName - the name of the backup +func (client BackupsClient) Get(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, backupName string) (result Backup, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BackupsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: poolName, + Constraints: []validation.Constraint{{Target: "poolName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "poolName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "poolName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}, + {TargetValue: volumeName, + Constraints: []validation.Constraint{{Target: "volumeName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "volumeName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "volumeName", Name: validation.Pattern, Rule: `^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("netapp.BackupsClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, accountName, poolName, volumeName, backupName) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.BackupsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "netapp.BackupsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.BackupsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client BackupsClient) GetPreparer(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, backupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "backupName": autorest.Encode("path", backupName), + "poolName": autorest.Encode("path", poolName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "volumeName": autorest.Encode("path", volumeName), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/backups/{backupName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client BackupsClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client BackupsClient) GetResponder(resp *http.Response) (result Backup, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetStatus get the status of the backup for a volume +// Parameters: +// resourceGroupName - the name of the resource group. +// accountName - the name of the NetApp account +// poolName - the name of the capacity pool +// volumeName - the name of the volume +func (client BackupsClient) GetStatus(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string) (result BackupStatus, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BackupsClient.GetStatus") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: poolName, + Constraints: []validation.Constraint{{Target: "poolName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "poolName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "poolName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}, + {TargetValue: volumeName, + Constraints: []validation.Constraint{{Target: "volumeName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "volumeName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "volumeName", Name: validation.Pattern, Rule: `^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("netapp.BackupsClient", "GetStatus", err.Error()) + } + + req, err := client.GetStatusPreparer(ctx, resourceGroupName, accountName, poolName, volumeName) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.BackupsClient", "GetStatus", nil, "Failure preparing request") + return + } + + resp, err := client.GetStatusSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "netapp.BackupsClient", "GetStatus", resp, "Failure sending request") + return + } + + result, err = client.GetStatusResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.BackupsClient", "GetStatus", resp, "Failure responding to request") + return + } + + return +} + +// GetStatusPreparer prepares the GetStatus request. +func (client BackupsClient) GetStatusPreparer(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "poolName": autorest.Encode("path", poolName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "volumeName": autorest.Encode("path", volumeName), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/backupStatus", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetStatusSender sends the GetStatus request. The method will close the +// http.Response Body if it receives an error. +func (client BackupsClient) GetStatusSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetStatusResponder handles the response to the GetStatus request. The method always +// closes the http.Response Body. +func (client BackupsClient) GetStatusResponder(resp *http.Response) (result BackupStatus, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetVolumeRestoreStatus get the status of the restore for a volume +// Parameters: +// resourceGroupName - the name of the resource group. +// accountName - the name of the NetApp account +// poolName - the name of the capacity pool +// volumeName - the name of the volume +func (client BackupsClient) GetVolumeRestoreStatus(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string) (result RestoreStatus, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BackupsClient.GetVolumeRestoreStatus") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: poolName, + Constraints: []validation.Constraint{{Target: "poolName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "poolName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "poolName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}, + {TargetValue: volumeName, + Constraints: []validation.Constraint{{Target: "volumeName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "volumeName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "volumeName", Name: validation.Pattern, Rule: `^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("netapp.BackupsClient", "GetVolumeRestoreStatus", err.Error()) + } + + req, err := client.GetVolumeRestoreStatusPreparer(ctx, resourceGroupName, accountName, poolName, volumeName) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.BackupsClient", "GetVolumeRestoreStatus", nil, "Failure preparing request") + return + } + + resp, err := client.GetVolumeRestoreStatusSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "netapp.BackupsClient", "GetVolumeRestoreStatus", resp, "Failure sending request") + return + } + + result, err = client.GetVolumeRestoreStatusResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.BackupsClient", "GetVolumeRestoreStatus", resp, "Failure responding to request") + return + } + + return +} + +// GetVolumeRestoreStatusPreparer prepares the GetVolumeRestoreStatus request. +func (client BackupsClient) GetVolumeRestoreStatusPreparer(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "poolName": autorest.Encode("path", poolName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "volumeName": autorest.Encode("path", volumeName), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/restoreStatus", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetVolumeRestoreStatusSender sends the GetVolumeRestoreStatus request. The method will close the +// http.Response Body if it receives an error. +func (client BackupsClient) GetVolumeRestoreStatusSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetVolumeRestoreStatusResponder handles the response to the GetVolumeRestoreStatus request. The method always +// closes the http.Response Body. +func (client BackupsClient) GetVolumeRestoreStatusResponder(resp *http.Response) (result RestoreStatus, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List list all backups for a volume +// Parameters: +// resourceGroupName - the name of the resource group. +// accountName - the name of the NetApp account +// poolName - the name of the capacity pool +// volumeName - the name of the volume +func (client BackupsClient) List(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string) (result BackupsList, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BackupsClient.List") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: poolName, + Constraints: []validation.Constraint{{Target: "poolName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "poolName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "poolName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}, + {TargetValue: volumeName, + Constraints: []validation.Constraint{{Target: "volumeName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "volumeName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "volumeName", Name: validation.Pattern, Rule: `^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("netapp.BackupsClient", "List", err.Error()) + } + + req, err := client.ListPreparer(ctx, resourceGroupName, accountName, poolName, volumeName) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.BackupsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "netapp.BackupsClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.BackupsClient", "List", resp, "Failure responding to request") + return + } + + return +} + +// ListPreparer prepares the List request. +func (client BackupsClient) ListPreparer(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "poolName": autorest.Encode("path", poolName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "volumeName": autorest.Encode("path", volumeName), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/backups", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client BackupsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client BackupsClient) ListResponder(resp *http.Response) (result BackupsList, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Update patch a backup for the volume +// Parameters: +// resourceGroupName - the name of the resource group. +// accountName - the name of the NetApp account +// poolName - the name of the capacity pool +// volumeName - the name of the volume +// backupName - the name of the backup +// body - backup object supplied in the body of the operation. +func (client BackupsClient) Update(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, backupName string, body *BackupPatch) (result BackupsUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BackupsClient.Update") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: poolName, + Constraints: []validation.Constraint{{Target: "poolName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "poolName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "poolName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}, + {TargetValue: volumeName, + Constraints: []validation.Constraint{{Target: "volumeName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "volumeName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "volumeName", Name: validation.Pattern, Rule: `^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("netapp.BackupsClient", "Update", err.Error()) + } + + req, err := client.UpdatePreparer(ctx, resourceGroupName, accountName, poolName, volumeName, backupName, body) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.BackupsClient", "Update", nil, "Failure preparing request") + return + } + + result, err = client.UpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.BackupsClient", "Update", nil, "Failure sending request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client BackupsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, backupName string, body *BackupPatch) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "backupName": autorest.Encode("path", backupName), + "poolName": autorest.Encode("path", poolName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "volumeName": autorest.Encode("path", volumeName), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/backups/{backupName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + if body != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithJSON(body)) + } + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client BackupsClient) UpdateSender(req *http.Request) (future BackupsUpdateFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client BackupsClient) UpdateResponder(resp *http.Response) (result Backup, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/netapp/mgmt/2021-06-01/netapp/client.go b/services/netapp/mgmt/2021-06-01/netapp/client.go new file mode 100644 index 000000000000..0a9c729f12ff --- /dev/null +++ b/services/netapp/mgmt/2021-06-01/netapp/client.go @@ -0,0 +1,41 @@ +// Package netapp implements the Azure ARM Netapp service API version 2021-06-01. +// +// Microsoft NetApp Files Azure Resource Provider specification +package netapp + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" +) + +const ( + // DefaultBaseURI is the default URI used for the service Netapp + DefaultBaseURI = "https://management.azure.com" +) + +// BaseClient is the base client for Netapp. +type BaseClient struct { + autorest.Client + BaseURI string + SubscriptionID string +} + +// New creates an instance of the BaseClient client. +func New(subscriptionID string) BaseClient { + return NewWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewWithBaseURI creates an instance of the BaseClient client using a custom endpoint. Use this when interacting with +// an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewWithBaseURI(baseURI string, subscriptionID string) BaseClient { + return BaseClient{ + Client: autorest.NewClientWithUserAgent(UserAgent()), + BaseURI: baseURI, + SubscriptionID: subscriptionID, + } +} diff --git a/services/netapp/mgmt/2021-06-01/netapp/enums.go b/services/netapp/mgmt/2021-06-01/netapp/enums.go new file mode 100644 index 000000000000..9ba04e3ed650 --- /dev/null +++ b/services/netapp/mgmt/2021-06-01/netapp/enums.go @@ -0,0 +1,286 @@ +package netapp + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// ActiveDirectoryStatus enumerates the values for active directory status. +type ActiveDirectoryStatus string + +const ( + // Created Active Directory created but not in use + Created ActiveDirectoryStatus = "Created" + // Deleted Active Directory Deleted + Deleted ActiveDirectoryStatus = "Deleted" + // Error Error with the Active Directory + Error ActiveDirectoryStatus = "Error" + // InUse Active Directory in use by SMB Volume + InUse ActiveDirectoryStatus = "InUse" + // Updating Active Directory Updating + Updating ActiveDirectoryStatus = "Updating" +) + +// PossibleActiveDirectoryStatusValues returns an array of possible values for the ActiveDirectoryStatus const type. +func PossibleActiveDirectoryStatusValues() []ActiveDirectoryStatus { + return []ActiveDirectoryStatus{Created, Deleted, Error, InUse, Updating} +} + +// AvsDataStore enumerates the values for avs data store. +type AvsDataStore string + +const ( + // Disabled avsDataStore is disabled + Disabled AvsDataStore = "Disabled" + // Enabled avsDataStore is enabled + Enabled AvsDataStore = "Enabled" +) + +// PossibleAvsDataStoreValues returns an array of possible values for the AvsDataStore const type. +func PossibleAvsDataStoreValues() []AvsDataStore { + return []AvsDataStore{Disabled, Enabled} +} + +// BackupType enumerates the values for backup type. +type BackupType string + +const ( + // Manual Manual backup + Manual BackupType = "Manual" + // Scheduled Scheduled backup + Scheduled BackupType = "Scheduled" +) + +// PossibleBackupTypeValues returns an array of possible values for the BackupType const type. +func PossibleBackupTypeValues() []BackupType { + return []BackupType{Manual, Scheduled} +} + +// CheckNameResourceTypes enumerates the values for check name resource types. +type CheckNameResourceTypes string + +const ( + // MicrosoftNetAppnetAppAccounts ... + MicrosoftNetAppnetAppAccounts CheckNameResourceTypes = "Microsoft.NetApp/netAppAccounts" + // MicrosoftNetAppnetAppAccountscapacityPools ... + MicrosoftNetAppnetAppAccountscapacityPools CheckNameResourceTypes = "Microsoft.NetApp/netAppAccounts/capacityPools" + // MicrosoftNetAppnetAppAccountscapacityPoolsvolumes ... + MicrosoftNetAppnetAppAccountscapacityPoolsvolumes CheckNameResourceTypes = "Microsoft.NetApp/netAppAccounts/capacityPools/volumes" + // MicrosoftNetAppnetAppAccountscapacityPoolsvolumessnapshots ... + MicrosoftNetAppnetAppAccountscapacityPoolsvolumessnapshots CheckNameResourceTypes = "Microsoft.NetApp/netAppAccounts/capacityPools/volumes/snapshots" +) + +// PossibleCheckNameResourceTypesValues returns an array of possible values for the CheckNameResourceTypes const type. +func PossibleCheckNameResourceTypesValues() []CheckNameResourceTypes { + return []CheckNameResourceTypes{MicrosoftNetAppnetAppAccounts, MicrosoftNetAppnetAppAccountscapacityPools, MicrosoftNetAppnetAppAccountscapacityPoolsvolumes, MicrosoftNetAppnetAppAccountscapacityPoolsvolumessnapshots} +} + +// CheckQuotaNameResourceTypes enumerates the values for check quota name resource types. +type CheckQuotaNameResourceTypes string + +const ( + // CheckQuotaNameResourceTypesMicrosoftNetAppnetAppAccounts ... + CheckQuotaNameResourceTypesMicrosoftNetAppnetAppAccounts CheckQuotaNameResourceTypes = "Microsoft.NetApp/netAppAccounts" + // CheckQuotaNameResourceTypesMicrosoftNetAppnetAppAccountscapacityPools ... + CheckQuotaNameResourceTypesMicrosoftNetAppnetAppAccountscapacityPools CheckQuotaNameResourceTypes = "Microsoft.NetApp/netAppAccounts/capacityPools" + // CheckQuotaNameResourceTypesMicrosoftNetAppnetAppAccountscapacityPoolsvolumes ... + CheckQuotaNameResourceTypesMicrosoftNetAppnetAppAccountscapacityPoolsvolumes CheckQuotaNameResourceTypes = "Microsoft.NetApp/netAppAccounts/capacityPools/volumes" + // CheckQuotaNameResourceTypesMicrosoftNetAppnetAppAccountscapacityPoolsvolumessnapshots ... + CheckQuotaNameResourceTypesMicrosoftNetAppnetAppAccountscapacityPoolsvolumessnapshots CheckQuotaNameResourceTypes = "Microsoft.NetApp/netAppAccounts/capacityPools/volumes/snapshots" +) + +// PossibleCheckQuotaNameResourceTypesValues returns an array of possible values for the CheckQuotaNameResourceTypes const type. +func PossibleCheckQuotaNameResourceTypesValues() []CheckQuotaNameResourceTypes { + return []CheckQuotaNameResourceTypes{CheckQuotaNameResourceTypesMicrosoftNetAppnetAppAccounts, CheckQuotaNameResourceTypesMicrosoftNetAppnetAppAccountscapacityPools, CheckQuotaNameResourceTypesMicrosoftNetAppnetAppAccountscapacityPoolsvolumes, CheckQuotaNameResourceTypesMicrosoftNetAppnetAppAccountscapacityPoolsvolumessnapshots} +} + +// ChownMode enumerates the values for chown mode. +type ChownMode string + +const ( + // Restricted ... + Restricted ChownMode = "Restricted" + // Unrestricted ... + Unrestricted ChownMode = "Unrestricted" +) + +// PossibleChownModeValues returns an array of possible values for the ChownMode const type. +func PossibleChownModeValues() []ChownMode { + return []ChownMode{Restricted, Unrestricted} +} + +// CreatedByType enumerates the values for created by type. +type CreatedByType string + +const ( + // Application ... + Application CreatedByType = "Application" + // Key ... + Key CreatedByType = "Key" + // ManagedIdentity ... + ManagedIdentity CreatedByType = "ManagedIdentity" + // User ... + User CreatedByType = "User" +) + +// PossibleCreatedByTypeValues returns an array of possible values for the CreatedByType const type. +func PossibleCreatedByTypeValues() []CreatedByType { + return []CreatedByType{Application, Key, ManagedIdentity, User} +} + +// EncryptionType enumerates the values for encryption type. +type EncryptionType string + +const ( + // Double EncryptionType Double, volumes will use double encryption at rest + Double EncryptionType = "Double" + // Single EncryptionType Single, volumes will use single encryption at rest + Single EncryptionType = "Single" +) + +// PossibleEncryptionTypeValues returns an array of possible values for the EncryptionType const type. +func PossibleEncryptionTypeValues() []EncryptionType { + return []EncryptionType{Double, Single} +} + +// EndpointType enumerates the values for endpoint type. +type EndpointType string + +const ( + // Dst ... + Dst EndpointType = "dst" + // Src ... + Src EndpointType = "src" +) + +// PossibleEndpointTypeValues returns an array of possible values for the EndpointType const type. +func PossibleEndpointTypeValues() []EndpointType { + return []EndpointType{Dst, Src} +} + +// InAvailabilityReasonType enumerates the values for in availability reason type. +type InAvailabilityReasonType string + +const ( + // AlreadyExists ... + AlreadyExists InAvailabilityReasonType = "AlreadyExists" + // Invalid ... + Invalid InAvailabilityReasonType = "Invalid" +) + +// PossibleInAvailabilityReasonTypeValues returns an array of possible values for the InAvailabilityReasonType const type. +func PossibleInAvailabilityReasonTypeValues() []InAvailabilityReasonType { + return []InAvailabilityReasonType{AlreadyExists, Invalid} +} + +// MetricAggregationType enumerates the values for metric aggregation type. +type MetricAggregationType string + +const ( + // Average ... + Average MetricAggregationType = "Average" +) + +// PossibleMetricAggregationTypeValues returns an array of possible values for the MetricAggregationType const type. +func PossibleMetricAggregationTypeValues() []MetricAggregationType { + return []MetricAggregationType{Average} +} + +// MirrorState enumerates the values for mirror state. +type MirrorState string + +const ( + // Broken ... + Broken MirrorState = "Broken" + // Mirrored ... + Mirrored MirrorState = "Mirrored" + // Uninitialized ... + Uninitialized MirrorState = "Uninitialized" +) + +// PossibleMirrorStateValues returns an array of possible values for the MirrorState const type. +func PossibleMirrorStateValues() []MirrorState { + return []MirrorState{Broken, Mirrored, Uninitialized} +} + +// QosType enumerates the values for qos type. +type QosType string + +const ( + // QosTypeAuto qos type Auto + QosTypeAuto QosType = "Auto" + // QosTypeManual qos type Manual + QosTypeManual QosType = "Manual" +) + +// PossibleQosTypeValues returns an array of possible values for the QosType const type. +func PossibleQosTypeValues() []QosType { + return []QosType{QosTypeAuto, QosTypeManual} +} + +// RelationshipStatus enumerates the values for relationship status. +type RelationshipStatus string + +const ( + // Idle ... + Idle RelationshipStatus = "Idle" + // Transferring ... + Transferring RelationshipStatus = "Transferring" +) + +// PossibleRelationshipStatusValues returns an array of possible values for the RelationshipStatus const type. +func PossibleRelationshipStatusValues() []RelationshipStatus { + return []RelationshipStatus{Idle, Transferring} +} + +// ReplicationSchedule enumerates the values for replication schedule. +type ReplicationSchedule string + +const ( + // OneZerominutely ... + OneZerominutely ReplicationSchedule = "_10minutely" + // Daily ... + Daily ReplicationSchedule = "daily" + // Hourly ... + Hourly ReplicationSchedule = "hourly" +) + +// PossibleReplicationScheduleValues returns an array of possible values for the ReplicationSchedule const type. +func PossibleReplicationScheduleValues() []ReplicationSchedule { + return []ReplicationSchedule{OneZerominutely, Daily, Hourly} +} + +// SecurityStyle enumerates the values for security style. +type SecurityStyle string + +const ( + // Ntfs ... + Ntfs SecurityStyle = "ntfs" + // Unix ... + Unix SecurityStyle = "unix" +) + +// PossibleSecurityStyleValues returns an array of possible values for the SecurityStyle const type. +func PossibleSecurityStyleValues() []SecurityStyle { + return []SecurityStyle{Ntfs, Unix} +} + +// ServiceLevel enumerates the values for service level. +type ServiceLevel string + +const ( + // Premium Premium service level + Premium ServiceLevel = "Premium" + // Standard Standard service level + Standard ServiceLevel = "Standard" + // StandardZRS Zone redundant storage service level + StandardZRS ServiceLevel = "StandardZRS" + // Ultra Ultra service level + Ultra ServiceLevel = "Ultra" +) + +// PossibleServiceLevelValues returns an array of possible values for the ServiceLevel const type. +func PossibleServiceLevelValues() []ServiceLevel { + return []ServiceLevel{Premium, Standard, StandardZRS, Ultra} +} diff --git a/services/netapp/mgmt/2021-06-01/netapp/models.go b/services/netapp/mgmt/2021-06-01/netapp/models.go new file mode 100644 index 000000000000..db7f8395be2f --- /dev/null +++ b/services/netapp/mgmt/2021-06-01/netapp/models.go @@ -0,0 +1,4333 @@ +package netapp + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "encoding/json" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/date" + "github.com/Azure/go-autorest/autorest/to" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// The package's fully qualified name. +const fqdn = "github.com/Azure/azure-sdk-for-go/services/netapp/mgmt/2021-06-01/netapp" + +// Account netApp account resource +type Account struct { + autorest.Response `json:"-"` + // Location - Resource location + Location *string `json:"location,omitempty"` + // ID - READ-ONLY; Resource Id + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name + Name *string `json:"name,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // Type - READ-ONLY; Resource type + Type *string `json:"type,omitempty"` + // Tags - Resource tags + Tags map[string]*string `json:"tags"` + // AccountProperties - NetApp Account properties + *AccountProperties `json:"properties,omitempty"` + // SystemData - READ-ONLY; The system meta data relating to this resource. + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for Account. +func (a Account) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if a.Location != nil { + objectMap["location"] = a.Location + } + if a.Tags != nil { + objectMap["tags"] = a.Tags + } + if a.AccountProperties != nil { + objectMap["properties"] = a.AccountProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for Account struct. +func (a *Account) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + a.Location = &location + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + a.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + a.Name = &name + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + a.Etag = &etag + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + a.Type = &typeVar + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + a.Tags = tags + } + case "properties": + if v != nil { + var accountProperties AccountProperties + err = json.Unmarshal(*v, &accountProperties) + if err != nil { + return err + } + a.AccountProperties = &accountProperties + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + a.SystemData = &systemData + } + } + } + + return nil +} + +// AccountBackupsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type AccountBackupsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(AccountBackupsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *AccountBackupsDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for AccountBackupsDeleteFuture.Result. +func (future *AccountBackupsDeleteFuture) result(client AccountBackupsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.AccountBackupsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("netapp.AccountBackupsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// AccountEncryption encryption settings +type AccountEncryption struct { + // KeySource - Encryption Key Source. Possible values are: 'Microsoft.NetApp'. + KeySource *string `json:"keySource,omitempty"` +} + +// AccountList list of NetApp account resources +type AccountList struct { + autorest.Response `json:"-"` + // Value - Multiple NetApp accounts + Value *[]Account `json:"value,omitempty"` + // NextLink - URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// AccountListIterator provides access to a complete listing of Account values. +type AccountListIterator struct { + i int + page AccountListPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *AccountListIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AccountListIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *AccountListIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter AccountListIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter AccountListIterator) Response() AccountList { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter AccountListIterator) Value() Account { + if !iter.page.NotDone() { + return Account{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the AccountListIterator type. +func NewAccountListIterator(page AccountListPage) AccountListIterator { + return AccountListIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (al AccountList) IsEmpty() bool { + return al.Value == nil || len(*al.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (al AccountList) hasNextLink() bool { + return al.NextLink != nil && len(*al.NextLink) != 0 +} + +// accountListPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (al AccountList) accountListPreparer(ctx context.Context) (*http.Request, error) { + if !al.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(al.NextLink))) +} + +// AccountListPage contains a page of Account values. +type AccountListPage struct { + fn func(context.Context, AccountList) (AccountList, error) + al AccountList +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *AccountListPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AccountListPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.al) + if err != nil { + return err + } + page.al = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *AccountListPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page AccountListPage) NotDone() bool { + return !page.al.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page AccountListPage) Response() AccountList { + return page.al +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page AccountListPage) Values() []Account { + if page.al.IsEmpty() { + return nil + } + return *page.al.Value +} + +// Creates a new instance of the AccountListPage type. +func NewAccountListPage(cur AccountList, getNextPage func(context.Context, AccountList) (AccountList, error)) AccountListPage { + return AccountListPage{ + fn: getNextPage, + al: cur, + } +} + +// AccountPatch netApp account patch resource +type AccountPatch struct { + // Location - Resource location + Location *string `json:"location,omitempty"` + // ID - READ-ONLY; Resource Id + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type + Type *string `json:"type,omitempty"` + // Tags - Resource tags + Tags map[string]*string `json:"tags"` + // AccountProperties - NetApp Account properties + *AccountProperties `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for AccountPatch. +func (ap AccountPatch) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ap.Location != nil { + objectMap["location"] = ap.Location + } + if ap.Tags != nil { + objectMap["tags"] = ap.Tags + } + if ap.AccountProperties != nil { + objectMap["properties"] = ap.AccountProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for AccountPatch struct. +func (ap *AccountPatch) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + ap.Location = &location + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + ap.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + ap.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + ap.Type = &typeVar + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + ap.Tags = tags + } + case "properties": + if v != nil { + var accountProperties AccountProperties + err = json.Unmarshal(*v, &accountProperties) + if err != nil { + return err + } + ap.AccountProperties = &accountProperties + } + } + } + + return nil +} + +// AccountProperties netApp account properties +type AccountProperties struct { + // ProvisioningState - READ-ONLY; Azure lifecycle management + ProvisioningState *string `json:"provisioningState,omitempty"` + // ActiveDirectories - Active Directories + ActiveDirectories *[]ActiveDirectory `json:"activeDirectories,omitempty"` + // Encryption - Encryption settings + Encryption *AccountEncryption `json:"encryption,omitempty"` +} + +// MarshalJSON is the custom marshaler for AccountProperties. +func (ap AccountProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ap.ActiveDirectories != nil { + objectMap["activeDirectories"] = ap.ActiveDirectories + } + if ap.Encryption != nil { + objectMap["encryption"] = ap.Encryption + } + return json.Marshal(objectMap) +} + +// AccountsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type AccountsCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(AccountsClient) (Account, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *AccountsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for AccountsCreateOrUpdateFuture.Result. +func (future *AccountsCreateOrUpdateFuture) result(client AccountsClient) (a Account, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.AccountsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + a.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("netapp.AccountsCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if a.Response.Response, err = future.GetResult(sender); err == nil && a.Response.Response.StatusCode != http.StatusNoContent { + a, err = client.CreateOrUpdateResponder(a.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.AccountsCreateOrUpdateFuture", "Result", a.Response.Response, "Failure responding to request") + } + } + return +} + +// AccountsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type AccountsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(AccountsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *AccountsDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for AccountsDeleteFuture.Result. +func (future *AccountsDeleteFuture) result(client AccountsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.AccountsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("netapp.AccountsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// AccountsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type AccountsUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(AccountsClient) (Account, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *AccountsUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for AccountsUpdateFuture.Result. +func (future *AccountsUpdateFuture) result(client AccountsClient) (a Account, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.AccountsUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + a.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("netapp.AccountsUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if a.Response.Response, err = future.GetResult(sender); err == nil && a.Response.Response.StatusCode != http.StatusNoContent { + a, err = client.UpdateResponder(a.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.AccountsUpdateFuture", "Result", a.Response.Response, "Failure responding to request") + } + } + return +} + +// ActiveDirectory active Directory +type ActiveDirectory struct { + // ActiveDirectoryID - Id of the Active Directory + ActiveDirectoryID *string `json:"activeDirectoryId,omitempty"` + // Username - Username of Active Directory domain administrator + Username *string `json:"username,omitempty"` + // Password - Plain text password of Active Directory domain administrator, value is masked in the response + Password *string `json:"password,omitempty"` + // Domain - Name of the Active Directory domain + Domain *string `json:"domain,omitempty"` + // DNS - Comma separated list of DNS server IP addresses (IPv4 only) for the Active Directory domain + DNS *string `json:"dns,omitempty"` + // Status - READ-ONLY; Status of the Active Directory. Possible values include: 'Created', 'InUse', 'Deleted', 'Error', 'Updating' + Status ActiveDirectoryStatus `json:"status,omitempty"` + // StatusDetails - READ-ONLY; Any details in regards to the Status of the Active Directory + StatusDetails *string `json:"statusDetails,omitempty"` + // SmbServerName - 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"` + // OrganizationalUnit - The Organizational Unit (OU) within the Windows Active Directory + OrganizationalUnit *string `json:"organizationalUnit,omitempty"` + // Site - The Active Directory site the service will limit Domain Controller discovery to + Site *string `json:"site,omitempty"` + // BackupOperators - 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"` + // Administrators - 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"` + // KdcIP - kdc server IP addresses for the active directory machine. This optional parameter is used only while creating kerberos volume. + KdcIP *string `json:"kdcIP,omitempty"` + // AdName - Name of the active directory machine. This optional parameter is used only while creating kerberos volume + AdName *string `json:"adName,omitempty"` + // ServerRootCACertificate - 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"` + // AesEncryption - If enabled, AES encryption will be enabled for SMB communication. + AesEncryption *bool `json:"aesEncryption,omitempty"` + // LdapSigning - Specifies whether or not the LDAP traffic needs to be signed. + LdapSigning *bool `json:"ldapSigning,omitempty"` + // SecurityOperators - 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"` + // LdapOverTLS - Specifies whether or not the LDAP traffic needs to be secured via TLS. + LdapOverTLS *bool `json:"ldapOverTLS,omitempty"` + // AllowLocalNfsUsersWithLdap - If enabled, NFS client local users can also (in addition to LDAP users) access the NFS volumes. + AllowLocalNfsUsersWithLdap *bool `json:"allowLocalNfsUsersWithLdap,omitempty"` +} + +// MarshalJSON is the custom marshaler for ActiveDirectory. +func (ad ActiveDirectory) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ad.ActiveDirectoryID != nil { + objectMap["activeDirectoryId"] = ad.ActiveDirectoryID + } + if ad.Username != nil { + objectMap["username"] = ad.Username + } + if ad.Password != nil { + objectMap["password"] = ad.Password + } + if ad.Domain != nil { + objectMap["domain"] = ad.Domain + } + if ad.DNS != nil { + objectMap["dns"] = ad.DNS + } + if ad.SmbServerName != nil { + objectMap["smbServerName"] = ad.SmbServerName + } + if ad.OrganizationalUnit != nil { + objectMap["organizationalUnit"] = ad.OrganizationalUnit + } + if ad.Site != nil { + objectMap["site"] = ad.Site + } + if ad.BackupOperators != nil { + objectMap["backupOperators"] = ad.BackupOperators + } + if ad.Administrators != nil { + objectMap["administrators"] = ad.Administrators + } + if ad.KdcIP != nil { + objectMap["kdcIP"] = ad.KdcIP + } + if ad.AdName != nil { + objectMap["adName"] = ad.AdName + } + if ad.ServerRootCACertificate != nil { + objectMap["serverRootCACertificate"] = ad.ServerRootCACertificate + } + if ad.AesEncryption != nil { + objectMap["aesEncryption"] = ad.AesEncryption + } + if ad.LdapSigning != nil { + objectMap["ldapSigning"] = ad.LdapSigning + } + if ad.SecurityOperators != nil { + objectMap["securityOperators"] = ad.SecurityOperators + } + if ad.LdapOverTLS != nil { + objectMap["ldapOverTLS"] = ad.LdapOverTLS + } + if ad.AllowLocalNfsUsersWithLdap != nil { + objectMap["allowLocalNfsUsersWithLdap"] = ad.AllowLocalNfsUsersWithLdap + } + return json.Marshal(objectMap) +} + +// AuthorizeRequest authorize request +type AuthorizeRequest struct { + // RemoteVolumeResourceID - Resource id of the remote volume + RemoteVolumeResourceID *string `json:"remoteVolumeResourceId,omitempty"` +} + +// Backup backup of a Volume +type Backup struct { + autorest.Response `json:"-"` + // Location - Resource location + Location *string `json:"location,omitempty"` + // ID - READ-ONLY; Resource Id + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type + Type *string `json:"type,omitempty"` + // BackupProperties - Backup Properties + *BackupProperties `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for Backup. +func (b Backup) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if b.Location != nil { + objectMap["location"] = b.Location + } + if b.BackupProperties != nil { + objectMap["properties"] = b.BackupProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for Backup struct. +func (b *Backup) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + b.Location = &location + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + b.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + b.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + b.Type = &typeVar + } + case "properties": + if v != nil { + var backupProperties BackupProperties + err = json.Unmarshal(*v, &backupProperties) + if err != nil { + return err + } + b.BackupProperties = &backupProperties + } + } + } + + return nil +} + +// BackupPatch backup patch +type BackupPatch struct { + // Tags - Resource tags + Tags map[string]*string `json:"tags"` + // BackupProperties - Backup Properties + *BackupProperties `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for BackupPatch. +func (bp BackupPatch) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if bp.Tags != nil { + objectMap["tags"] = bp.Tags + } + if bp.BackupProperties != nil { + objectMap["properties"] = bp.BackupProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for BackupPatch struct. +func (bp *BackupPatch) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + bp.Tags = tags + } + case "properties": + if v != nil { + var backupProperties BackupProperties + err = json.Unmarshal(*v, &backupProperties) + if err != nil { + return err + } + bp.BackupProperties = &backupProperties + } + } + } + + return nil +} + +// BackupPoliciesCreateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type BackupPoliciesCreateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(BackupPoliciesClient) (BackupPolicy, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *BackupPoliciesCreateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for BackupPoliciesCreateFuture.Result. +func (future *BackupPoliciesCreateFuture) result(client BackupPoliciesClient) (bp BackupPolicy, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.BackupPoliciesCreateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + bp.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("netapp.BackupPoliciesCreateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if bp.Response.Response, err = future.GetResult(sender); err == nil && bp.Response.Response.StatusCode != http.StatusNoContent { + bp, err = client.CreateResponder(bp.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.BackupPoliciesCreateFuture", "Result", bp.Response.Response, "Failure responding to request") + } + } + return +} + +// BackupPoliciesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type BackupPoliciesDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(BackupPoliciesClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *BackupPoliciesDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for BackupPoliciesDeleteFuture.Result. +func (future *BackupPoliciesDeleteFuture) result(client BackupPoliciesClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.BackupPoliciesDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("netapp.BackupPoliciesDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// BackupPoliciesList list of Backup Policies +type BackupPoliciesList struct { + autorest.Response `json:"-"` + // Value - A list of backup policies + Value *[]BackupPolicy `json:"value,omitempty"` +} + +// BackupPoliciesUpdateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type BackupPoliciesUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(BackupPoliciesClient) (BackupPolicy, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *BackupPoliciesUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for BackupPoliciesUpdateFuture.Result. +func (future *BackupPoliciesUpdateFuture) result(client BackupPoliciesClient) (bp BackupPolicy, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.BackupPoliciesUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + bp.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("netapp.BackupPoliciesUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if bp.Response.Response, err = future.GetResult(sender); err == nil && bp.Response.Response.StatusCode != http.StatusNoContent { + bp, err = client.UpdateResponder(bp.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.BackupPoliciesUpdateFuture", "Result", bp.Response.Response, "Failure responding to request") + } + } + return +} + +// BackupPolicy backup policy information +type BackupPolicy struct { + autorest.Response `json:"-"` + // Location - Resource location + Location *string `json:"location,omitempty"` + // ID - READ-ONLY; Resource Id + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name + Name *string `json:"name,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // Type - READ-ONLY; Resource type + Type *string `json:"type,omitempty"` + // Tags - Resource tags + Tags map[string]*string `json:"tags"` + // BackupPolicyProperties - Backup policy Properties + *BackupPolicyProperties `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for BackupPolicy. +func (bp BackupPolicy) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if bp.Location != nil { + objectMap["location"] = bp.Location + } + if bp.Tags != nil { + objectMap["tags"] = bp.Tags + } + if bp.BackupPolicyProperties != nil { + objectMap["properties"] = bp.BackupPolicyProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for BackupPolicy struct. +func (bp *BackupPolicy) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + bp.Location = &location + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + bp.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + bp.Name = &name + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + bp.Etag = &etag + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + bp.Type = &typeVar + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + bp.Tags = tags + } + case "properties": + if v != nil { + var backupPolicyProperties BackupPolicyProperties + err = json.Unmarshal(*v, &backupPolicyProperties) + if err != nil { + return err + } + bp.BackupPolicyProperties = &backupPolicyProperties + } + } + } + + return nil +} + +// BackupPolicyDetails backup policy properties +type BackupPolicyDetails struct { + // Location - Resource location + Location *string `json:"location,omitempty"` + // ID - READ-ONLY; Resource Id + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type + Type *string `json:"type,omitempty"` + // Tags - Resource tags + Tags map[string]*string `json:"tags"` + // BackupPolicyProperties - Backup policy Properties + *BackupPolicyProperties `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for BackupPolicyDetails. +func (bpd BackupPolicyDetails) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if bpd.Location != nil { + objectMap["location"] = bpd.Location + } + if bpd.Tags != nil { + objectMap["tags"] = bpd.Tags + } + if bpd.BackupPolicyProperties != nil { + objectMap["properties"] = bpd.BackupPolicyProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for BackupPolicyDetails struct. +func (bpd *BackupPolicyDetails) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + bpd.Location = &location + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + bpd.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + bpd.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + bpd.Type = &typeVar + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + bpd.Tags = tags + } + case "properties": + if v != nil { + var backupPolicyProperties BackupPolicyProperties + err = json.Unmarshal(*v, &backupPolicyProperties) + if err != nil { + return err + } + bpd.BackupPolicyProperties = &backupPolicyProperties + } + } + } + + return nil +} + +// BackupPolicyPatch backup policy Details for create and update +type BackupPolicyPatch struct { + // Location - Resource location + Location *string `json:"location,omitempty"` + // ID - READ-ONLY; Resource Id + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type + Type *string `json:"type,omitempty"` + // Tags - Resource tags + Tags map[string]*string `json:"tags"` + // BackupPolicyProperties - Backup policy Properties + *BackupPolicyProperties `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for BackupPolicyPatch. +func (bpp BackupPolicyPatch) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if bpp.Location != nil { + objectMap["location"] = bpp.Location + } + if bpp.Tags != nil { + objectMap["tags"] = bpp.Tags + } + if bpp.BackupPolicyProperties != nil { + objectMap["properties"] = bpp.BackupPolicyProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for BackupPolicyPatch struct. +func (bpp *BackupPolicyPatch) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + bpp.Location = &location + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + bpp.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + bpp.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + bpp.Type = &typeVar + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + bpp.Tags = tags + } + case "properties": + if v != nil { + var backupPolicyProperties BackupPolicyProperties + err = json.Unmarshal(*v, &backupPolicyProperties) + if err != nil { + return err + } + bpp.BackupPolicyProperties = &backupPolicyProperties + } + } + } + + return nil +} + +// BackupPolicyProperties backup policy properties +type BackupPolicyProperties struct { + // Name - READ-ONLY; Name of backup policy + Name *string `json:"name,omitempty"` + // BackupPolicyID - READ-ONLY; Backup Policy Resource ID + BackupPolicyID *string `json:"backupPolicyId,omitempty"` + // ProvisioningState - READ-ONLY; Azure lifecycle management + ProvisioningState *string `json:"provisioningState,omitempty"` + // DailyBackupsToKeep - Daily backups count to keep + DailyBackupsToKeep *int32 `json:"dailyBackupsToKeep,omitempty"` + // WeeklyBackupsToKeep - Weekly backups count to keep + WeeklyBackupsToKeep *int32 `json:"weeklyBackupsToKeep,omitempty"` + // MonthlyBackupsToKeep - Monthly backups count to keep + MonthlyBackupsToKeep *int32 `json:"monthlyBackupsToKeep,omitempty"` + // VolumesAssigned - READ-ONLY; Volumes using current backup policy + VolumesAssigned *int32 `json:"volumesAssigned,omitempty"` + // Enabled - The property to decide policy is enabled or not + Enabled *bool `json:"enabled,omitempty"` + // VolumeBackups - READ-ONLY; A list of volumes assigned to this policy + VolumeBackups *[]VolumeBackups `json:"volumeBackups,omitempty"` +} + +// MarshalJSON is the custom marshaler for BackupPolicyProperties. +func (bpp BackupPolicyProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if bpp.DailyBackupsToKeep != nil { + objectMap["dailyBackupsToKeep"] = bpp.DailyBackupsToKeep + } + if bpp.WeeklyBackupsToKeep != nil { + objectMap["weeklyBackupsToKeep"] = bpp.WeeklyBackupsToKeep + } + if bpp.MonthlyBackupsToKeep != nil { + objectMap["monthlyBackupsToKeep"] = bpp.MonthlyBackupsToKeep + } + if bpp.Enabled != nil { + objectMap["enabled"] = bpp.Enabled + } + return json.Marshal(objectMap) +} + +// BackupProperties backup properties +type BackupProperties struct { + // BackupID - READ-ONLY; UUID v4 used to identify the Backup + BackupID *string `json:"backupId,omitempty"` + // CreationDate - READ-ONLY; The creation date of the backup + CreationDate *date.Time `json:"creationDate,omitempty"` + // ProvisioningState - READ-ONLY; Azure lifecycle management + ProvisioningState *string `json:"provisioningState,omitempty"` + // Size - READ-ONLY; Size of backup + Size *int64 `json:"size,omitempty"` + // Label - Label for backup + Label *string `json:"label,omitempty"` + // BackupType - READ-ONLY; Type of backup Manual or Scheduled. Possible values include: 'Manual', 'Scheduled' + BackupType BackupType `json:"backupType,omitempty"` + // FailureReason - READ-ONLY; Failure reason + FailureReason *string `json:"failureReason,omitempty"` + // VolumeName - READ-ONLY; Volume name + VolumeName *string `json:"volumeName,omitempty"` + // UseExistingSnapshot - 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"` +} + +// MarshalJSON is the custom marshaler for BackupProperties. +func (bp BackupProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if bp.Label != nil { + objectMap["label"] = bp.Label + } + if bp.UseExistingSnapshot != nil { + objectMap["useExistingSnapshot"] = bp.UseExistingSnapshot + } + return json.Marshal(objectMap) +} + +// BackupsCreateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type BackupsCreateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(BackupsClient) (Backup, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *BackupsCreateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for BackupsCreateFuture.Result. +func (future *BackupsCreateFuture) result(client BackupsClient) (b Backup, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.BackupsCreateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + b.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("netapp.BackupsCreateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if b.Response.Response, err = future.GetResult(sender); err == nil && b.Response.Response.StatusCode != http.StatusNoContent { + b, err = client.CreateResponder(b.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.BackupsCreateFuture", "Result", b.Response.Response, "Failure responding to request") + } + } + return +} + +// BackupsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type BackupsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(BackupsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *BackupsDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for BackupsDeleteFuture.Result. +func (future *BackupsDeleteFuture) result(client BackupsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.BackupsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("netapp.BackupsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// BackupsList list of Backups +type BackupsList struct { + autorest.Response `json:"-"` + // Value - A list of Backups + Value *[]Backup `json:"value,omitempty"` +} + +// BackupStatus backup status +type BackupStatus struct { + autorest.Response `json:"-"` + // Healthy - READ-ONLY; Backup health status + Healthy *bool `json:"healthy,omitempty"` + // RelationshipStatus - READ-ONLY; Status of the backup mirror relationship. Possible values include: 'Idle', 'Transferring' + RelationshipStatus RelationshipStatus `json:"relationshipStatus,omitempty"` + // MirrorState - READ-ONLY; The status of the backup. Possible values include: 'Uninitialized', 'Mirrored', 'Broken' + MirrorState MirrorState `json:"mirrorState,omitempty"` + // UnhealthyReason - READ-ONLY; Reason for the unhealthy backup relationship + UnhealthyReason *string `json:"unhealthyReason,omitempty"` + // ErrorMessage - READ-ONLY; Displays error message if the backup is in an error state + ErrorMessage *string `json:"errorMessage,omitempty"` + // LastTransferSize - READ-ONLY; Displays the last transfer size + LastTransferSize *int64 `json:"lastTransferSize,omitempty"` + // LastTransferType - READ-ONLY; Displays the last transfer type + LastTransferType *string `json:"lastTransferType,omitempty"` + // TotalTransferBytes - READ-ONLY; Displays the total bytes transferred + TotalTransferBytes *int64 `json:"totalTransferBytes,omitempty"` +} + +// MarshalJSON is the custom marshaler for BackupStatus. +func (bs BackupStatus) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// BackupsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type BackupsUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(BackupsClient) (Backup, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *BackupsUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for BackupsUpdateFuture.Result. +func (future *BackupsUpdateFuture) result(client BackupsClient) (b Backup, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.BackupsUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + b.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("netapp.BackupsUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if b.Response.Response, err = future.GetResult(sender); err == nil && b.Response.Response.StatusCode != http.StatusNoContent { + b, err = client.UpdateResponder(b.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.BackupsUpdateFuture", "Result", b.Response.Response, "Failure responding to request") + } + } + return +} + +// BreakReplicationRequest break replication request +type BreakReplicationRequest struct { + // ForceBreakReplication - 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 { + autorest.Response `json:"-"` + // Location - Resource location + Location *string `json:"location,omitempty"` + // ID - READ-ONLY; Resource Id + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name + Name *string `json:"name,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // Type - READ-ONLY; Resource type + Type *string `json:"type,omitempty"` + // Tags - Resource tags + Tags map[string]*string `json:"tags"` + // PoolProperties - Capacity pool properties + *PoolProperties `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for CapacityPool. +func (cp CapacityPool) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if cp.Location != nil { + objectMap["location"] = cp.Location + } + if cp.Tags != nil { + objectMap["tags"] = cp.Tags + } + if cp.PoolProperties != nil { + objectMap["properties"] = cp.PoolProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for CapacityPool struct. +func (cp *CapacityPool) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + cp.Location = &location + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + cp.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + cp.Name = &name + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + cp.Etag = &etag + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + cp.Type = &typeVar + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + cp.Tags = tags + } + case "properties": + if v != nil { + var poolProperties PoolProperties + err = json.Unmarshal(*v, &poolProperties) + if err != nil { + return err + } + cp.PoolProperties = &poolProperties + } + } + } + + return nil +} + +// CapacityPoolList list of capacity pool resources +type CapacityPoolList struct { + autorest.Response `json:"-"` + // Value - List of Capacity pools + Value *[]CapacityPool `json:"value,omitempty"` + // NextLink - URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// CapacityPoolListIterator provides access to a complete listing of CapacityPool values. +type CapacityPoolListIterator struct { + i int + page CapacityPoolListPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *CapacityPoolListIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/CapacityPoolListIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *CapacityPoolListIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter CapacityPoolListIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter CapacityPoolListIterator) Response() CapacityPoolList { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter CapacityPoolListIterator) Value() CapacityPool { + if !iter.page.NotDone() { + return CapacityPool{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the CapacityPoolListIterator type. +func NewCapacityPoolListIterator(page CapacityPoolListPage) CapacityPoolListIterator { + return CapacityPoolListIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (cpl CapacityPoolList) IsEmpty() bool { + return cpl.Value == nil || len(*cpl.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (cpl CapacityPoolList) hasNextLink() bool { + return cpl.NextLink != nil && len(*cpl.NextLink) != 0 +} + +// capacityPoolListPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (cpl CapacityPoolList) capacityPoolListPreparer(ctx context.Context) (*http.Request, error) { + if !cpl.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(cpl.NextLink))) +} + +// CapacityPoolListPage contains a page of CapacityPool values. +type CapacityPoolListPage struct { + fn func(context.Context, CapacityPoolList) (CapacityPoolList, error) + cpl CapacityPoolList +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *CapacityPoolListPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/CapacityPoolListPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.cpl) + if err != nil { + return err + } + page.cpl = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *CapacityPoolListPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page CapacityPoolListPage) NotDone() bool { + return !page.cpl.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page CapacityPoolListPage) Response() CapacityPoolList { + return page.cpl +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page CapacityPoolListPage) Values() []CapacityPool { + if page.cpl.IsEmpty() { + return nil + } + return *page.cpl.Value +} + +// Creates a new instance of the CapacityPoolListPage type. +func NewCapacityPoolListPage(cur CapacityPoolList, getNextPage func(context.Context, CapacityPoolList) (CapacityPoolList, error)) CapacityPoolListPage { + return CapacityPoolListPage{ + fn: getNextPage, + cpl: cur, + } +} + +// CapacityPoolPatch capacity pool patch resource +type CapacityPoolPatch struct { + // Location - Resource location + Location *string `json:"location,omitempty"` + // ID - READ-ONLY; Resource Id + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type + Type *string `json:"type,omitempty"` + // Tags - Resource tags + Tags map[string]*string `json:"tags"` + // PoolPatchProperties - Capacity pool properties + *PoolPatchProperties `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for CapacityPoolPatch. +func (cpp CapacityPoolPatch) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if cpp.Location != nil { + objectMap["location"] = cpp.Location + } + if cpp.Tags != nil { + objectMap["tags"] = cpp.Tags + } + if cpp.PoolPatchProperties != nil { + objectMap["properties"] = cpp.PoolPatchProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for CapacityPoolPatch struct. +func (cpp *CapacityPoolPatch) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + cpp.Location = &location + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + cpp.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + cpp.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + cpp.Type = &typeVar + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + cpp.Tags = tags + } + case "properties": + if v != nil { + var poolPatchProperties PoolPatchProperties + err = json.Unmarshal(*v, &poolPatchProperties) + if err != nil { + return err + } + cpp.PoolPatchProperties = &poolPatchProperties + } + } + } + + return nil +} + +// CheckAvailabilityResponse information regarding availability of a resource. +type CheckAvailabilityResponse struct { + autorest.Response `json:"-"` + // IsAvailable - true indicates name is valid and available. false indicates the name is invalid, unavailable, or both. + IsAvailable *bool `json:"isAvailable,omitempty"` + // Reason - 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. Possible values include: 'Invalid', 'AlreadyExists' + Reason InAvailabilityReasonType `json:"reason,omitempty"` + // Message - 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"` +} + +// CloudError an error response from the service. +type CloudError struct { + // Error - Cloud error body. + Error *CloudErrorBody `json:"error,omitempty"` +} + +// CloudErrorBody an error response from the service. +type CloudErrorBody struct { + // Code - An identifier for the error. Codes are invariant and are intended to be consumed programmatically. + Code *string `json:"code,omitempty"` + // Message - A message describing the error, intended to be suitable for display in a user interface. + Message *string `json:"message,omitempty"` +} + +// DailySchedule daily Schedule properties +type DailySchedule struct { + // SnapshotsToKeep - Daily snapshot count to keep + SnapshotsToKeep *int32 `json:"snapshotsToKeep,omitempty"` + // Hour - Indicates which hour in UTC timezone a snapshot should be taken + Hour *int32 `json:"hour,omitempty"` + // Minute - Indicates which minute snapshot should be taken + Minute *int32 `json:"minute,omitempty"` + // UsedBytes - Resource size in bytes, current storage usage for the volume in bytes + UsedBytes *int64 `json:"usedBytes,omitempty"` +} + +// Dimension dimension of blobs, possibly be blob type or access tier. +type Dimension struct { + // Name - Display name of dimension. + Name *string `json:"name,omitempty"` + // DisplayName - Display name of dimension. + DisplayName *string `json:"displayName,omitempty"` +} + +// ExportPolicyRule volume Export Policy Rule +type ExportPolicyRule struct { + // RuleIndex - Order index + RuleIndex *int32 `json:"ruleIndex,omitempty"` + // UnixReadOnly - Read only access + UnixReadOnly *bool `json:"unixReadOnly,omitempty"` + // UnixReadWrite - Read and write access + UnixReadWrite *bool `json:"unixReadWrite,omitempty"` + // Kerberos5ReadOnly - Kerberos5 Read only access. To be use with swagger version 2020-05-01 or later + Kerberos5ReadOnly *bool `json:"kerberos5ReadOnly,omitempty"` + // Kerberos5ReadWrite - Kerberos5 Read and write access. To be use with swagger version 2020-05-01 or later + Kerberos5ReadWrite *bool `json:"kerberos5ReadWrite,omitempty"` + // Kerberos5iReadOnly - Kerberos5i Read only access. To be use with swagger version 2020-05-01 or later + Kerberos5iReadOnly *bool `json:"kerberos5iReadOnly,omitempty"` + // Kerberos5iReadWrite - Kerberos5i Read and write access. To be use with swagger version 2020-05-01 or later + Kerberos5iReadWrite *bool `json:"kerberos5iReadWrite,omitempty"` + // Kerberos5pReadOnly - Kerberos5p Read only access. To be use with swagger version 2020-05-01 or later + Kerberos5pReadOnly *bool `json:"kerberos5pReadOnly,omitempty"` + // Kerberos5pReadWrite - Kerberos5p Read and write access. To be use with swagger version 2020-05-01 or later + Kerberos5pReadWrite *bool `json:"kerberos5pReadWrite,omitempty"` + // Cifs - Allows CIFS protocol + Cifs *bool `json:"cifs,omitempty"` + // Nfsv3 - Allows NFSv3 protocol. Enable only for NFSv3 type volumes + Nfsv3 *bool `json:"nfsv3,omitempty"` + // Nfsv41 - Allows NFSv4.1 protocol. Enable only for NFSv4.1 type volumes + Nfsv41 *bool `json:"nfsv41,omitempty"` + // AllowedClients - Client ingress specification as comma separated string with IPv4 CIDRs, IPv4 host addresses and host names + AllowedClients *string `json:"allowedClients,omitempty"` + // HasRootAccess - Has root access to volume + HasRootAccess *bool `json:"hasRootAccess,omitempty"` + // 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. Possible values include: 'Restricted', 'Unrestricted' + ChownMode ChownMode `json:"chownMode,omitempty"` +} + +// FilePathAvailabilityRequest file path availability request content - availability is based on the name +// and the subnetId. +type FilePathAvailabilityRequest struct { + // Name - File path to verify. + Name *string `json:"name,omitempty"` + // SubnetID - 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 { + // SnapshotsToKeep - Hourly snapshot count to keep + SnapshotsToKeep *int32 `json:"snapshotsToKeep,omitempty"` + // Minute - Indicates which minute snapshot should be taken + Minute *int32 `json:"minute,omitempty"` + // UsedBytes - Resource size in bytes, current storage usage for the volume in bytes + UsedBytes *int64 `json:"usedBytes,omitempty"` +} + +// MetricSpecification metric specification of operation. +type MetricSpecification struct { + // Name - Name of metric specification. + Name *string `json:"name,omitempty"` + // DisplayName - Display name of metric specification. + DisplayName *string `json:"displayName,omitempty"` + // DisplayDescription - Display description of metric specification. + DisplayDescription *string `json:"displayDescription,omitempty"` + // Unit - Unit could be Bytes or Count. + Unit *string `json:"unit,omitempty"` + // SupportedAggregationTypes - Support metric aggregation type. + SupportedAggregationTypes *[]MetricAggregationType `json:"supportedAggregationTypes,omitempty"` + // SupportedTimeGrainTypes - The supported time grain types for the metrics. + SupportedTimeGrainTypes *[]string `json:"supportedTimeGrainTypes,omitempty"` + // InternalMetricName - The internal metric name. + InternalMetricName *string `json:"internalMetricName,omitempty"` + // SourceMdmAccount - The source MDM account. + SourceMdmAccount *string `json:"sourceMdmAccount,omitempty"` + // SourceMdmNamespace - The source MDM namespace. + SourceMdmNamespace *string `json:"sourceMdmNamespace,omitempty"` + // Dimensions - Dimensions of blobs, including blob type and access tier. + Dimensions *[]Dimension `json:"dimensions,omitempty"` + // AggregationType - Aggregation type could be Average. + AggregationType *string `json:"aggregationType,omitempty"` + // FillGapWithZero - The property to decide fill gap with zero or not. + FillGapWithZero *bool `json:"fillGapWithZero,omitempty"` + // Category - The category this metric specification belong to, could be Capacity. + Category *string `json:"category,omitempty"` + // ResourceIDDimensionNameOverride - Account Resource Id. + ResourceIDDimensionNameOverride *string `json:"resourceIdDimensionNameOverride,omitempty"` +} + +// MonthlySchedule monthly Schedule properties +type MonthlySchedule struct { + // SnapshotsToKeep - Monthly snapshot count to keep + SnapshotsToKeep *int32 `json:"snapshotsToKeep,omitempty"` + // DaysOfMonth - Indicates which days of the month snapshot should be taken. A comma delimited string. + DaysOfMonth *string `json:"daysOfMonth,omitempty"` + // Hour - Indicates which hour in UTC timezone a snapshot should be taken + Hour *int32 `json:"hour,omitempty"` + // Minute - Indicates which minute snapshot should be taken + Minute *int32 `json:"minute,omitempty"` + // UsedBytes - Resource size in bytes, current storage usage for the volume in bytes + UsedBytes *int64 `json:"usedBytes,omitempty"` +} + +// MountTarget mount Target +type MountTarget struct { + // Location - Resource location + Location *string `json:"location,omitempty"` + // ID - READ-ONLY; Resource Id + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type + Type *string `json:"type,omitempty"` + // Tags - Resource tags + Tags map[string]*string `json:"tags"` + // MountTargetProperties - Mount Target Properties + *MountTargetProperties `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for MountTarget. +func (mt MountTarget) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if mt.Location != nil { + objectMap["location"] = mt.Location + } + if mt.Tags != nil { + objectMap["tags"] = mt.Tags + } + if mt.MountTargetProperties != nil { + objectMap["properties"] = mt.MountTargetProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for MountTarget struct. +func (mt *MountTarget) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + mt.Location = &location + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + mt.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + mt.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + mt.Type = &typeVar + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + mt.Tags = tags + } + case "properties": + if v != nil { + var mountTargetProperties MountTargetProperties + err = json.Unmarshal(*v, &mountTargetProperties) + if err != nil { + return err + } + mt.MountTargetProperties = &mountTargetProperties + } + } + } + + return nil +} + +// MountTargetProperties mount target properties +type MountTargetProperties struct { + // MountTargetID - READ-ONLY; UUID v4 used to identify the MountTarget + MountTargetID *string `json:"mountTargetId,omitempty"` + // FileSystemID - UUID v4 used to identify the MountTarget + FileSystemID *string `json:"fileSystemId,omitempty"` + // IPAddress - READ-ONLY; The mount target's IPv4 address + IPAddress *string `json:"ipAddress,omitempty"` + // SmbServerFqdn - The SMB server's Fully Qualified Domain Name, FQDN + SmbServerFqdn *string `json:"smbServerFqdn,omitempty"` +} + +// MarshalJSON is the custom marshaler for MountTargetProperties. +func (mtp MountTargetProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if mtp.FileSystemID != nil { + objectMap["fileSystemId"] = mtp.FileSystemID + } + if mtp.SmbServerFqdn != nil { + objectMap["smbServerFqdn"] = mtp.SmbServerFqdn + } + return json.Marshal(objectMap) +} + +// Operation microsoft.NetApp REST API operation definition. +type Operation struct { + // Name - Operation name: {provider}/{resource}/{operation} + Name *string `json:"name,omitempty"` + // Display - Display metadata associated with the operation. + Display *OperationDisplay `json:"display,omitempty"` + // Origin - The origin of operations. + Origin *string `json:"origin,omitempty"` + // OperationProperties - Properties of operation, include metric specifications. + *OperationProperties `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for Operation. +func (o Operation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if o.Name != nil { + objectMap["name"] = o.Name + } + if o.Display != nil { + objectMap["display"] = o.Display + } + if o.Origin != nil { + objectMap["origin"] = o.Origin + } + if o.OperationProperties != nil { + objectMap["properties"] = o.OperationProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for Operation struct. +func (o *Operation) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + o.Name = &name + } + case "display": + if v != nil { + var display OperationDisplay + err = json.Unmarshal(*v, &display) + if err != nil { + return err + } + o.Display = &display + } + case "origin": + if v != nil { + var origin string + err = json.Unmarshal(*v, &origin) + if err != nil { + return err + } + o.Origin = &origin + } + case "properties": + if v != nil { + var operationProperties OperationProperties + err = json.Unmarshal(*v, &operationProperties) + if err != nil { + return err + } + o.OperationProperties = &operationProperties + } + } + } + + return nil +} + +// OperationDisplay display metadata associated with the operation. +type OperationDisplay struct { + // Provider - Service provider: Microsoft NetApp. + Provider *string `json:"provider,omitempty"` + // Resource - Resource on which the operation is performed etc. + Resource *string `json:"resource,omitempty"` + // Operation - Type of operation: get, read, delete, etc. + Operation *string `json:"operation,omitempty"` + // Description - Operation description. + Description *string `json:"description,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 { + autorest.Response `json:"-"` + // Value - List of Storage operations supported by the Storage resource provider. + Value *[]Operation `json:"value,omitempty"` +} + +// OperationProperties properties of operation, include metric specifications. +type OperationProperties struct { + // ServiceSpecification - One property of operation, include metric specifications. + ServiceSpecification *ServiceSpecification `json:"serviceSpecification,omitempty"` +} + +// PoolChangeRequest pool change request +type PoolChangeRequest struct { + // NewPoolResourceID - Resource id of the pool to move volume to + NewPoolResourceID *string `json:"newPoolResourceId,omitempty"` +} + +// PoolPatchProperties patchable pool properties +type PoolPatchProperties struct { + // Size - Provisioned size of the pool (in bytes). Allowed values are in 4TiB chunks (value must be multiply of 4398046511104). + Size *int64 `json:"size,omitempty"` + // QosType - The qos type of the pool. Possible values include: 'QosTypeAuto', 'QosTypeManual' + QosType QosType `json:"qosType,omitempty"` +} + +// PoolProperties pool properties +type PoolProperties struct { + // PoolID - READ-ONLY; UUID v4 used to identify the Pool + PoolID *string `json:"poolId,omitempty"` + // Size - Provisioned size of the pool (in bytes). Allowed values are in 4TiB chunks (value must be multiply of 4398046511104). + Size *int64 `json:"size,omitempty"` + // ServiceLevel - Possible values include: 'Standard', 'Premium', 'Ultra', 'StandardZRS' + ServiceLevel ServiceLevel `json:"serviceLevel,omitempty"` + // ProvisioningState - READ-ONLY; Azure lifecycle management + ProvisioningState *string `json:"provisioningState,omitempty"` + // TotalThroughputMibps - READ-ONLY; Total throughput of pool in Mibps + TotalThroughputMibps *float64 `json:"totalThroughputMibps,omitempty"` + // UtilizedThroughputMibps - READ-ONLY; Utilized throughput of pool in Mibps + UtilizedThroughputMibps *float64 `json:"utilizedThroughputMibps,omitempty"` + // QosType - The qos type of the pool. Possible values include: 'QosTypeAuto', 'QosTypeManual' + QosType QosType `json:"qosType,omitempty"` + // CoolAccess - If enabled (true) the pool can contain cool Access enabled volumes. + CoolAccess *bool `json:"coolAccess,omitempty"` + // 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. Possible values include: 'Single', 'Double' + EncryptionType EncryptionType `json:"encryptionType,omitempty"` +} + +// MarshalJSON is the custom marshaler for PoolProperties. +func (pp PoolProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if pp.Size != nil { + objectMap["size"] = pp.Size + } + if pp.ServiceLevel != "" { + objectMap["serviceLevel"] = pp.ServiceLevel + } + if pp.QosType != "" { + objectMap["qosType"] = pp.QosType + } + if pp.CoolAccess != nil { + objectMap["coolAccess"] = pp.CoolAccess + } + if pp.EncryptionType != "" { + objectMap["encryptionType"] = pp.EncryptionType + } + return json.Marshal(objectMap) +} + +// PoolsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type PoolsCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(PoolsClient) (CapacityPool, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *PoolsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for PoolsCreateOrUpdateFuture.Result. +func (future *PoolsCreateOrUpdateFuture) result(client PoolsClient) (cp CapacityPool, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.PoolsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + cp.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("netapp.PoolsCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if cp.Response.Response, err = future.GetResult(sender); err == nil && cp.Response.Response.StatusCode != http.StatusNoContent { + cp, err = client.CreateOrUpdateResponder(cp.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.PoolsCreateOrUpdateFuture", "Result", cp.Response.Response, "Failure responding to request") + } + } + return +} + +// PoolsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running operation. +type PoolsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(PoolsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *PoolsDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for PoolsDeleteFuture.Result. +func (future *PoolsDeleteFuture) result(client PoolsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.PoolsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("netapp.PoolsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// PoolsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running operation. +type PoolsUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(PoolsClient) (CapacityPool, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *PoolsUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for PoolsUpdateFuture.Result. +func (future *PoolsUpdateFuture) result(client PoolsClient) (cp CapacityPool, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.PoolsUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + cp.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("netapp.PoolsUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if cp.Response.Response, err = future.GetResult(sender); err == nil && cp.Response.Response.StatusCode != http.StatusNoContent { + cp, err = client.UpdateResponder(cp.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.PoolsUpdateFuture", "Result", cp.Response.Response, "Failure responding to request") + } + } + return +} + +// QuotaAvailabilityRequest quota availability request content. +type QuotaAvailabilityRequest struct { + // Name - Name of the resource to verify. + Name *string `json:"name,omitempty"` + // Type - Resource type used for verification. Possible values include: 'CheckQuotaNameResourceTypesMicrosoftNetAppnetAppAccounts', 'CheckQuotaNameResourceTypesMicrosoftNetAppnetAppAccountscapacityPools', 'CheckQuotaNameResourceTypesMicrosoftNetAppnetAppAccountscapacityPoolsvolumes', 'CheckQuotaNameResourceTypesMicrosoftNetAppnetAppAccountscapacityPoolsvolumessnapshots' + Type CheckQuotaNameResourceTypes `json:"type,omitempty"` + // ResourceGroup - Resource group name. + ResourceGroup *string `json:"resourceGroup,omitempty"` +} + +// ReplicationObject replication properties +type ReplicationObject struct { + // ReplicationID - Id + ReplicationID *string `json:"replicationId,omitempty"` + // EndpointType - Indicates whether the local volume is the source or destination for the Volume Replication. Possible values include: 'Src', 'Dst' + EndpointType EndpointType `json:"endpointType,omitempty"` + // ReplicationSchedule - Schedule. Possible values include: '10minutely', 'Hourly', 'Daily' + ReplicationSchedule ReplicationSchedule `json:"replicationSchedule,omitempty"` + // RemoteVolumeResourceID - The resource ID of the remote volume. + RemoteVolumeResourceID *string `json:"remoteVolumeResourceId,omitempty"` + // RemoteVolumeRegion - The remote region for the other end of the Volume Replication. + RemoteVolumeRegion *string `json:"remoteVolumeRegion,omitempty"` +} + +// ReplicationStatus replication status +type ReplicationStatus struct { + autorest.Response `json:"-"` + // Healthy - Replication health check + Healthy *bool `json:"healthy,omitempty"` + // RelationshipStatus - Status of the mirror relationship. Possible values include: 'Idle', 'Transferring' + RelationshipStatus RelationshipStatus `json:"relationshipStatus,omitempty"` + // MirrorState - The status of the replication. Possible values include: 'Uninitialized', 'Mirrored', 'Broken' + MirrorState MirrorState `json:"mirrorState,omitempty"` + // TotalProgress - The progress of the replication + TotalProgress *string `json:"totalProgress,omitempty"` + // ErrorMessage - Displays error message if the replication is in an error state + ErrorMessage *string `json:"errorMessage,omitempty"` +} + +// ResourceIdentity identity for the resource. +type ResourceIdentity struct { + // PrincipalID - READ-ONLY; Object id of the identity resource + PrincipalID *string `json:"principalId,omitempty"` + // TenantID - READ-ONLY; The tenant id of the resource + TenantID *string `json:"tenantId,omitempty"` + // Type - Type of Identity. Supported values are: 'None', 'SystemAssigned' + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for ResourceIdentity. +func (ri ResourceIdentity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ri.Type != nil { + objectMap["type"] = ri.Type + } + return json.Marshal(objectMap) +} + +// ResourceNameAvailabilityRequest resource name availability request content. +type ResourceNameAvailabilityRequest struct { + // Name - Resource name to verify. + Name *string `json:"name,omitempty"` + // Type - Resource type used for verification. Possible values include: 'MicrosoftNetAppnetAppAccounts', 'MicrosoftNetAppnetAppAccountscapacityPools', 'MicrosoftNetAppnetAppAccountscapacityPoolsvolumes', 'MicrosoftNetAppnetAppAccountscapacityPoolsvolumessnapshots' + Type CheckNameResourceTypes `json:"type,omitempty"` + // ResourceGroup - Resource group name. + ResourceGroup *string `json:"resourceGroup,omitempty"` +} + +// RestoreStatus restore status +type RestoreStatus struct { + autorest.Response `json:"-"` + // Healthy - READ-ONLY; Restore health status + Healthy *bool `json:"healthy,omitempty"` + // RelationshipStatus - READ-ONLY; Status of the restore SnapMirror relationship. Possible values include: 'Idle', 'Transferring' + RelationshipStatus RelationshipStatus `json:"relationshipStatus,omitempty"` + // MirrorState - READ-ONLY; The status of the restore. Possible values include: 'Uninitialized', 'Mirrored', 'Broken' + MirrorState MirrorState `json:"mirrorState,omitempty"` + // UnhealthyReason - READ-ONLY; Reason for the unhealthy restore relationship + UnhealthyReason *string `json:"unhealthyReason,omitempty"` + // ErrorMessage - READ-ONLY; Displays error message if the restore is in an error state + ErrorMessage *string `json:"errorMessage,omitempty"` + // TotalTransferBytes - READ-ONLY; Displays the total bytes transferred + TotalTransferBytes *int64 `json:"totalTransferBytes,omitempty"` +} + +// MarshalJSON is the custom marshaler for RestoreStatus. +func (rs RestoreStatus) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ServiceSpecification one property of operation, include metric specifications. +type ServiceSpecification struct { + // MetricSpecifications - Metric specifications of operation. + MetricSpecifications *[]MetricSpecification `json:"metricSpecifications,omitempty"` +} + +// Snapshot snapshot of a Volume +type Snapshot struct { + autorest.Response `json:"-"` + // Location - Resource location + Location *string `json:"location,omitempty"` + // ID - READ-ONLY; Resource Id + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type + Type *string `json:"type,omitempty"` + // SnapshotProperties - Snapshot Properties + *SnapshotProperties `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for Snapshot. +func (s Snapshot) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if s.Location != nil { + objectMap["location"] = s.Location + } + if s.SnapshotProperties != nil { + objectMap["properties"] = s.SnapshotProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for Snapshot struct. +func (s *Snapshot) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + s.Location = &location + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + s.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + s.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + s.Type = &typeVar + } + case "properties": + if v != nil { + var snapshotProperties SnapshotProperties + err = json.Unmarshal(*v, &snapshotProperties) + if err != nil { + return err + } + s.SnapshotProperties = &snapshotProperties + } + } + } + + return nil +} + +// SnapshotPoliciesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type SnapshotPoliciesDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(SnapshotPoliciesClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *SnapshotPoliciesDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for SnapshotPoliciesDeleteFuture.Result. +func (future *SnapshotPoliciesDeleteFuture) result(client SnapshotPoliciesClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.SnapshotPoliciesDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("netapp.SnapshotPoliciesDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// SnapshotPoliciesList list of Snapshot Policies +type SnapshotPoliciesList struct { + autorest.Response `json:"-"` + // Value - A list of snapshot policies + Value *[]SnapshotPolicy `json:"value,omitempty"` +} + +// SnapshotPoliciesUpdateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type SnapshotPoliciesUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(SnapshotPoliciesClient) (SnapshotPolicy, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *SnapshotPoliciesUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for SnapshotPoliciesUpdateFuture.Result. +func (future *SnapshotPoliciesUpdateFuture) result(client SnapshotPoliciesClient) (sp SnapshotPolicy, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.SnapshotPoliciesUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + sp.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("netapp.SnapshotPoliciesUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if sp.Response.Response, err = future.GetResult(sender); err == nil && sp.Response.Response.StatusCode != http.StatusNoContent { + sp, err = client.UpdateResponder(sp.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.SnapshotPoliciesUpdateFuture", "Result", sp.Response.Response, "Failure responding to request") + } + } + return +} + +// SnapshotPolicy snapshot policy information +type SnapshotPolicy struct { + autorest.Response `json:"-"` + // Location - Resource location + Location *string `json:"location,omitempty"` + // ID - READ-ONLY; Resource Id + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name + Name *string `json:"name,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // Type - READ-ONLY; Resource type + Type *string `json:"type,omitempty"` + // Tags - Resource tags + Tags map[string]*string `json:"tags"` + // SnapshotPolicyProperties - Snapshot policy Properties + *SnapshotPolicyProperties `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for SnapshotPolicy. +func (sp SnapshotPolicy) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if sp.Location != nil { + objectMap["location"] = sp.Location + } + if sp.Tags != nil { + objectMap["tags"] = sp.Tags + } + if sp.SnapshotPolicyProperties != nil { + objectMap["properties"] = sp.SnapshotPolicyProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for SnapshotPolicy struct. +func (sp *SnapshotPolicy) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + sp.Location = &location + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + sp.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + sp.Name = &name + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + sp.Etag = &etag + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + sp.Type = &typeVar + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + sp.Tags = tags + } + case "properties": + if v != nil { + var snapshotPolicyProperties SnapshotPolicyProperties + err = json.Unmarshal(*v, &snapshotPolicyProperties) + if err != nil { + return err + } + sp.SnapshotPolicyProperties = &snapshotPolicyProperties + } + } + } + + return nil +} + +// SnapshotPolicyDetails snapshot policy properties +type SnapshotPolicyDetails struct { + // Location - Resource location + Location *string `json:"location,omitempty"` + // ID - READ-ONLY; Resource Id + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type + Type *string `json:"type,omitempty"` + // Tags - Resource tags + Tags map[string]*string `json:"tags"` + // SnapshotPolicyProperties - Snapshot policy Properties + *SnapshotPolicyProperties `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for SnapshotPolicyDetails. +func (spd SnapshotPolicyDetails) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if spd.Location != nil { + objectMap["location"] = spd.Location + } + if spd.Tags != nil { + objectMap["tags"] = spd.Tags + } + if spd.SnapshotPolicyProperties != nil { + objectMap["properties"] = spd.SnapshotPolicyProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for SnapshotPolicyDetails struct. +func (spd *SnapshotPolicyDetails) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + spd.Location = &location + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + spd.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + spd.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + spd.Type = &typeVar + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + spd.Tags = tags + } + case "properties": + if v != nil { + var snapshotPolicyProperties SnapshotPolicyProperties + err = json.Unmarshal(*v, &snapshotPolicyProperties) + if err != nil { + return err + } + spd.SnapshotPolicyProperties = &snapshotPolicyProperties + } + } + } + + return nil +} + +// SnapshotPolicyPatch snapshot policy Details for create and update +type SnapshotPolicyPatch struct { + // Location - Resource location + Location *string `json:"location,omitempty"` + // ID - READ-ONLY; Resource Id + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type + Type *string `json:"type,omitempty"` + // Tags - Resource tags + Tags map[string]*string `json:"tags"` + // SnapshotPolicyProperties - Snapshot Policy properties + *SnapshotPolicyProperties `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for SnapshotPolicyPatch. +func (spp SnapshotPolicyPatch) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if spp.Location != nil { + objectMap["location"] = spp.Location + } + if spp.Tags != nil { + objectMap["tags"] = spp.Tags + } + if spp.SnapshotPolicyProperties != nil { + objectMap["properties"] = spp.SnapshotPolicyProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for SnapshotPolicyPatch struct. +func (spp *SnapshotPolicyPatch) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + spp.Location = &location + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + spp.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + spp.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + spp.Type = &typeVar + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + spp.Tags = tags + } + case "properties": + if v != nil { + var snapshotPolicyProperties SnapshotPolicyProperties + err = json.Unmarshal(*v, &snapshotPolicyProperties) + if err != nil { + return err + } + spp.SnapshotPolicyProperties = &snapshotPolicyProperties + } + } + } + + return nil +} + +// SnapshotPolicyProperties snapshot policy properties +type SnapshotPolicyProperties struct { + // HourlySchedule - Schedule for hourly snapshots + HourlySchedule *HourlySchedule `json:"hourlySchedule,omitempty"` + // DailySchedule - Schedule for daily snapshots + DailySchedule *DailySchedule `json:"dailySchedule,omitempty"` + // WeeklySchedule - Schedule for weekly snapshots + WeeklySchedule *WeeklySchedule `json:"weeklySchedule,omitempty"` + // MonthlySchedule - Schedule for monthly snapshots + MonthlySchedule *MonthlySchedule `json:"monthlySchedule,omitempty"` + // Enabled - The property to decide policy is enabled or not + Enabled *bool `json:"enabled,omitempty"` + // ProvisioningState - READ-ONLY; Azure lifecycle management + ProvisioningState *string `json:"provisioningState,omitempty"` +} + +// MarshalJSON is the custom marshaler for SnapshotPolicyProperties. +func (spp SnapshotPolicyProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if spp.HourlySchedule != nil { + objectMap["hourlySchedule"] = spp.HourlySchedule + } + if spp.DailySchedule != nil { + objectMap["dailySchedule"] = spp.DailySchedule + } + if spp.WeeklySchedule != nil { + objectMap["weeklySchedule"] = spp.WeeklySchedule + } + if spp.MonthlySchedule != nil { + objectMap["monthlySchedule"] = spp.MonthlySchedule + } + if spp.Enabled != nil { + objectMap["enabled"] = spp.Enabled + } + return json.Marshal(objectMap) +} + +// SnapshotPolicyVolumeList volumes associated with snapshot policy +type SnapshotPolicyVolumeList struct { + autorest.Response `json:"-"` + // Value - List of volumes + Value *[]interface{} `json:"value,omitempty"` +} + +// SnapshotProperties snapshot properties +type SnapshotProperties struct { + // SnapshotID - READ-ONLY; UUID v4 used to identify the Snapshot + SnapshotID *string `json:"snapshotId,omitempty"` + // Created - READ-ONLY; The creation date of the snapshot + Created *date.Time `json:"created,omitempty"` + // ProvisioningState - READ-ONLY; Azure lifecycle management + ProvisioningState *string `json:"provisioningState,omitempty"` +} + +// MarshalJSON is the custom marshaler for SnapshotProperties. +func (sp SnapshotProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// SnapshotsCreateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type SnapshotsCreateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(SnapshotsClient) (Snapshot, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *SnapshotsCreateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for SnapshotsCreateFuture.Result. +func (future *SnapshotsCreateFuture) result(client SnapshotsClient) (s Snapshot, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.SnapshotsCreateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + s.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("netapp.SnapshotsCreateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if s.Response.Response, err = future.GetResult(sender); err == nil && s.Response.Response.StatusCode != http.StatusNoContent { + s, err = client.CreateResponder(s.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.SnapshotsCreateFuture", "Result", s.Response.Response, "Failure responding to request") + } + } + return +} + +// SnapshotsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type SnapshotsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(SnapshotsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *SnapshotsDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for SnapshotsDeleteFuture.Result. +func (future *SnapshotsDeleteFuture) result(client SnapshotsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.SnapshotsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("netapp.SnapshotsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// SnapshotsList list of Snapshots +type SnapshotsList struct { + autorest.Response `json:"-"` + // Value - A list of Snapshots + Value *[]Snapshot `json:"value,omitempty"` +} + +// SnapshotsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type SnapshotsUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(SnapshotsClient) (Snapshot, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *SnapshotsUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for SnapshotsUpdateFuture.Result. +func (future *SnapshotsUpdateFuture) result(client SnapshotsClient) (s Snapshot, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.SnapshotsUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + s.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("netapp.SnapshotsUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if s.Response.Response, err = future.GetResult(sender); err == nil && s.Response.Response.StatusCode != http.StatusNoContent { + s, err = client.UpdateResponder(s.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.SnapshotsUpdateFuture", "Result", s.Response.Response, "Failure responding to request") + } + } + return +} + +// SystemData metadata pertaining to creation and last modification of the resource. +type SystemData struct { + // CreatedBy - The identity that created the resource. + CreatedBy *string `json:"createdBy,omitempty"` + // CreatedByType - The type of identity that created the resource. Possible values include: 'User', 'Application', 'ManagedIdentity', 'Key' + CreatedByType CreatedByType `json:"createdByType,omitempty"` + // CreatedAt - The timestamp of resource creation (UTC). + CreatedAt *date.Time `json:"createdAt,omitempty"` + // LastModifiedBy - The identity that last modified the resource. + LastModifiedBy *string `json:"lastModifiedBy,omitempty"` + // LastModifiedByType - The type of identity that last modified the resource. Possible values include: 'User', 'Application', 'ManagedIdentity', 'Key' + LastModifiedByType CreatedByType `json:"lastModifiedByType,omitempty"` + // LastModifiedAt - The timestamp of resource last modification (UTC) + LastModifiedAt *date.Time `json:"lastModifiedAt,omitempty"` +} + +// Vault vault information +type Vault struct { + // Location - Resource location + Location *string `json:"location,omitempty"` + // ID - READ-ONLY; Resource Id + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type + Type *string `json:"type,omitempty"` + // VaultProperties - Vault Properties + *VaultProperties `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for Vault. +func (vVar Vault) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if vVar.Location != nil { + objectMap["location"] = vVar.Location + } + if vVar.VaultProperties != nil { + objectMap["properties"] = vVar.VaultProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for Vault struct. +func (vVar *Vault) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + vVar.Location = &location + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + vVar.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + vVar.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + vVar.Type = &typeVar + } + case "properties": + if v != nil { + var vaultProperties VaultProperties + err = json.Unmarshal(*v, &vaultProperties) + if err != nil { + return err + } + vVar.VaultProperties = &vaultProperties + } + } + } + + return nil +} + +// VaultList list of Vaults +type VaultList struct { + autorest.Response `json:"-"` + // Value - A list of vaults + Value *[]Vault `json:"value,omitempty"` +} + +// VaultProperties vault properties +type VaultProperties struct { + // VaultName - Vault Name + VaultName *string `json:"vaultName,omitempty"` +} + +// Volume volume resource +type Volume struct { + autorest.Response `json:"-"` + // Location - Resource location + Location *string `json:"location,omitempty"` + // ID - READ-ONLY; Resource Id + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name + Name *string `json:"name,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // Type - READ-ONLY; Resource type + Type *string `json:"type,omitempty"` + // Tags - Resource tags + Tags map[string]*string `json:"tags"` + // VolumeProperties - Volume properties + *VolumeProperties `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for Volume. +func (vVar Volume) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if vVar.Location != nil { + objectMap["location"] = vVar.Location + } + if vVar.Tags != nil { + objectMap["tags"] = vVar.Tags + } + if vVar.VolumeProperties != nil { + objectMap["properties"] = vVar.VolumeProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for Volume struct. +func (vVar *Volume) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + vVar.Location = &location + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + vVar.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + vVar.Name = &name + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + vVar.Etag = &etag + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + vVar.Type = &typeVar + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + vVar.Tags = tags + } + case "properties": + if v != nil { + var volumeProperties VolumeProperties + err = json.Unmarshal(*v, &volumeProperties) + if err != nil { + return err + } + vVar.VolumeProperties = &volumeProperties + } + } + } + + return nil +} + +// VolumeBackupProperties volume Backup Properties +type VolumeBackupProperties struct { + // BackupPolicyID - Backup Policy Resource ID + BackupPolicyID *string `json:"backupPolicyId,omitempty"` + // PolicyEnforced - Policy Enforced + PolicyEnforced *bool `json:"policyEnforced,omitempty"` + // VaultID - Vault Resource ID + VaultID *string `json:"vaultId,omitempty"` + // BackupEnabled - Backup Enabled + BackupEnabled *bool `json:"backupEnabled,omitempty"` +} + +// VolumeBackups volume details using the backup policy +type VolumeBackups struct { + // VolumeName - Volume name + VolumeName *string `json:"volumeName,omitempty"` + // BackupsCount - Total count of backups for volume + BackupsCount *int32 `json:"backupsCount,omitempty"` + // PolicyEnabled - Policy enabled + PolicyEnabled *bool `json:"policyEnabled,omitempty"` +} + +// VolumeList list of volume resources +type VolumeList struct { + autorest.Response `json:"-"` + // Value - List of volumes + Value *[]Volume `json:"value,omitempty"` + // NextLink - URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// VolumeListIterator provides access to a complete listing of Volume values. +type VolumeListIterator struct { + i int + page VolumeListPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *VolumeListIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VolumeListIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *VolumeListIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter VolumeListIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter VolumeListIterator) Response() VolumeList { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter VolumeListIterator) Value() Volume { + if !iter.page.NotDone() { + return Volume{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the VolumeListIterator type. +func NewVolumeListIterator(page VolumeListPage) VolumeListIterator { + return VolumeListIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (vl VolumeList) IsEmpty() bool { + return vl.Value == nil || len(*vl.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (vl VolumeList) hasNextLink() bool { + return vl.NextLink != nil && len(*vl.NextLink) != 0 +} + +// volumeListPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (vl VolumeList) volumeListPreparer(ctx context.Context) (*http.Request, error) { + if !vl.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(vl.NextLink))) +} + +// VolumeListPage contains a page of Volume values. +type VolumeListPage struct { + fn func(context.Context, VolumeList) (VolumeList, error) + vl VolumeList +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *VolumeListPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VolumeListPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.vl) + if err != nil { + return err + } + page.vl = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *VolumeListPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page VolumeListPage) NotDone() bool { + return !page.vl.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page VolumeListPage) Response() VolumeList { + return page.vl +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page VolumeListPage) Values() []Volume { + if page.vl.IsEmpty() { + return nil + } + return *page.vl.Value +} + +// Creates a new instance of the VolumeListPage type. +func NewVolumeListPage(cur VolumeList, getNextPage func(context.Context, VolumeList) (VolumeList, error)) VolumeListPage { + return VolumeListPage{ + fn: getNextPage, + vl: cur, + } +} + +// VolumePatch volume patch resource +type VolumePatch struct { + // Location - Resource location + Location *string `json:"location,omitempty"` + // ID - READ-ONLY; Resource Id + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type + Type *string `json:"type,omitempty"` + // Tags - Resource tags + Tags map[string]*string `json:"tags"` + // VolumePatchProperties - Patchable volume properties + *VolumePatchProperties `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for VolumePatch. +func (vp VolumePatch) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if vp.Location != nil { + objectMap["location"] = vp.Location + } + if vp.Tags != nil { + objectMap["tags"] = vp.Tags + } + if vp.VolumePatchProperties != nil { + objectMap["properties"] = vp.VolumePatchProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for VolumePatch struct. +func (vp *VolumePatch) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + vp.Location = &location + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + vp.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + vp.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + vp.Type = &typeVar + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + vp.Tags = tags + } + case "properties": + if v != nil { + var volumePatchProperties VolumePatchProperties + err = json.Unmarshal(*v, &volumePatchProperties) + if err != nil { + return err + } + vp.VolumePatchProperties = &volumePatchProperties + } + } + } + + return nil +} + +// VolumePatchProperties patchable volume properties +type VolumePatchProperties struct { + // ServiceLevel - Possible values include: 'Standard', 'Premium', 'Ultra', 'StandardZRS' + ServiceLevel ServiceLevel `json:"serviceLevel,omitempty"` + // UsageThreshold - 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"` + // ExportPolicy - Set of export policy rules + ExportPolicy *VolumePatchPropertiesExportPolicy `json:"exportPolicy,omitempty"` + ThroughputMibps *float64 `json:"throughputMibps,omitempty"` + // DataProtection - DataProtection type volumes include an object containing details of the replication + DataProtection *VolumePatchPropertiesDataProtection `json:"dataProtection,omitempty"` + // IsDefaultQuotaEnabled - Specifies if default quota is enabled for the volume. + IsDefaultQuotaEnabled *bool `json:"isDefaultQuotaEnabled,omitempty"` + // DefaultUserQuotaInKiBs - Default user quota for volume in KiBs. Minimum 4 KiBs. + DefaultUserQuotaInKiBs *int64 `json:"defaultUserQuotaInKiBs,omitempty"` + // DefaultGroupQuotaInKiBs - Default group quota for volume in KiBs. Minimum 4 KiBs. + DefaultGroupQuotaInKiBs *int64 `json:"defaultGroupQuotaInKiBs,omitempty"` +} + +// VolumePatchPropertiesDataProtection dataProtection type volumes include an object containing details of +// the replication +type VolumePatchPropertiesDataProtection struct { + // Backup - Backup Properties + Backup *VolumeBackupProperties `json:"backup,omitempty"` + // Snapshot - Snapshot properties. + Snapshot *VolumeSnapshotProperties `json:"snapshot,omitempty"` +} + +// VolumePatchPropertiesExportPolicy set of export policy rules +type VolumePatchPropertiesExportPolicy struct { + // Rules - Export policy rule + Rules *[]ExportPolicyRule `json:"rules,omitempty"` +} + +// VolumeProperties volume properties +type VolumeProperties struct { + // FileSystemID - READ-ONLY; Unique FileSystem Identifier. + FileSystemID *string `json:"fileSystemId,omitempty"` + // CreationToken - A unique file path for the volume. Used when creating mount targets + CreationToken *string `json:"creationToken,omitempty"` + // ServiceLevel - Possible values include: 'Standard', 'Premium', 'Ultra', 'StandardZRS' + ServiceLevel ServiceLevel `json:"serviceLevel,omitempty"` + // UsageThreshold - 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"` + // ExportPolicy - Set of export policy rules + ExportPolicy *VolumePropertiesExportPolicy `json:"exportPolicy,omitempty"` + // ProtocolTypes - Set of protocol types, default NFSv3, CIFS for SMB protocol + ProtocolTypes *[]string `json:"protocolTypes,omitempty"` + // ProvisioningState - READ-ONLY; Azure lifecycle management + ProvisioningState *string `json:"provisioningState,omitempty"` + // SnapshotID - UUID v4 or resource identifier used to identify the Snapshot. + SnapshotID *string `json:"snapshotId,omitempty"` + // BackupID - UUID v4 or resource identifier used to identify the Backup. + BackupID *string `json:"backupId,omitempty"` + // BaremetalTenantID - READ-ONLY; Unique Baremetal Tenant Identifier. + BaremetalTenantID *string `json:"baremetalTenantId,omitempty"` + // SubnetID - The Azure Resource URI for a delegated subnet. Must have the delegation Microsoft.NetApp/volumes + SubnetID *string `json:"subnetId,omitempty"` + // MountTargets - READ-ONLY; List of mount targets + MountTargets *[]MountTargetProperties `json:"mountTargets,omitempty"` + // VolumeType - What type of volume is this + VolumeType *string `json:"volumeType,omitempty"` + // DataProtection - DataProtection type volumes include an object containing details of the replication + DataProtection *VolumePropertiesDataProtection `json:"dataProtection,omitempty"` + // IsRestoring - Restoring + IsRestoring *bool `json:"isRestoring,omitempty"` + // SnapshotDirectoryVisible - 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"` + // KerberosEnabled - Describe if a volume is KerberosEnabled. To be use with swagger version 2020-05-01 or later + KerberosEnabled *bool `json:"kerberosEnabled,omitempty"` + // SecurityStyle - The security style of volume, default unix, defaults to ntfs for dual protocol or CIFS protocol. Possible values include: 'Ntfs', 'Unix' + SecurityStyle SecurityStyle `json:"securityStyle,omitempty"` + // SmbEncryption - 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"` + // SmbContinuouslyAvailable - Enables continuously available share property for smb volume. Only applicable for SMB volume + SmbContinuouslyAvailable *bool `json:"smbContinuouslyAvailable,omitempty"` + ThroughputMibps *float64 `json:"throughputMibps,omitempty"` + // EncryptionKeySource - Encryption Key Source. Possible values are: 'Microsoft.NetApp' + EncryptionKeySource *string `json:"encryptionKeySource,omitempty"` + // LdapEnabled - Specifies whether LDAP is enabled or not for a given NFS volume. + LdapEnabled *bool `json:"ldapEnabled,omitempty"` + // CoolAccess - Specifies whether Cool Access(tiering) is enabled for the volume. + CoolAccess *bool `json:"coolAccess,omitempty"` + // CoolnessPeriod - Specifies the number of days after which data that is not accessed by clients will be tiered. + CoolnessPeriod *int32 `json:"coolnessPeriod,omitempty"` + // UnixPermissions - 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"` + // CloneProgress - 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"` + // AvsDataStore - Specifies whether the volume is enabled for Azure VMware Solution (AVS) datastore purpose. Possible values include: 'Enabled', 'Disabled' + AvsDataStore AvsDataStore `json:"avsDataStore,omitempty"` + // IsDefaultQuotaEnabled - Specifies if default quota is enabled for the volume. + IsDefaultQuotaEnabled *bool `json:"isDefaultQuotaEnabled,omitempty"` + // DefaultUserQuotaInKiBs - Default user quota for volume in KiBs. Minimum 4 KiBs. + DefaultUserQuotaInKiBs *int64 `json:"defaultUserQuotaInKiBs,omitempty"` + // DefaultGroupQuotaInKiBs - Default group quota for volume in KiBs. Minimum 4 KiBs. + DefaultGroupQuotaInKiBs *int64 `json:"defaultGroupQuotaInKiBs,omitempty"` +} + +// MarshalJSON is the custom marshaler for VolumeProperties. +func (vp VolumeProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if vp.CreationToken != nil { + objectMap["creationToken"] = vp.CreationToken + } + if vp.ServiceLevel != "" { + objectMap["serviceLevel"] = vp.ServiceLevel + } + if vp.UsageThreshold != nil { + objectMap["usageThreshold"] = vp.UsageThreshold + } + if vp.ExportPolicy != nil { + objectMap["exportPolicy"] = vp.ExportPolicy + } + if vp.ProtocolTypes != nil { + objectMap["protocolTypes"] = vp.ProtocolTypes + } + if vp.SnapshotID != nil { + objectMap["snapshotId"] = vp.SnapshotID + } + if vp.BackupID != nil { + objectMap["backupId"] = vp.BackupID + } + if vp.SubnetID != nil { + objectMap["subnetId"] = vp.SubnetID + } + if vp.VolumeType != nil { + objectMap["volumeType"] = vp.VolumeType + } + if vp.DataProtection != nil { + objectMap["dataProtection"] = vp.DataProtection + } + if vp.IsRestoring != nil { + objectMap["isRestoring"] = vp.IsRestoring + } + if vp.SnapshotDirectoryVisible != nil { + objectMap["snapshotDirectoryVisible"] = vp.SnapshotDirectoryVisible + } + if vp.KerberosEnabled != nil { + objectMap["kerberosEnabled"] = vp.KerberosEnabled + } + if vp.SecurityStyle != "" { + objectMap["securityStyle"] = vp.SecurityStyle + } + if vp.SmbEncryption != nil { + objectMap["smbEncryption"] = vp.SmbEncryption + } + if vp.SmbContinuouslyAvailable != nil { + objectMap["smbContinuouslyAvailable"] = vp.SmbContinuouslyAvailable + } + if vp.ThroughputMibps != nil { + objectMap["throughputMibps"] = vp.ThroughputMibps + } + if vp.EncryptionKeySource != nil { + objectMap["encryptionKeySource"] = vp.EncryptionKeySource + } + if vp.LdapEnabled != nil { + objectMap["ldapEnabled"] = vp.LdapEnabled + } + if vp.CoolAccess != nil { + objectMap["coolAccess"] = vp.CoolAccess + } + if vp.CoolnessPeriod != nil { + objectMap["coolnessPeriod"] = vp.CoolnessPeriod + } + if vp.UnixPermissions != nil { + objectMap["unixPermissions"] = vp.UnixPermissions + } + if vp.AvsDataStore != "" { + objectMap["avsDataStore"] = vp.AvsDataStore + } + if vp.IsDefaultQuotaEnabled != nil { + objectMap["isDefaultQuotaEnabled"] = vp.IsDefaultQuotaEnabled + } + if vp.DefaultUserQuotaInKiBs != nil { + objectMap["defaultUserQuotaInKiBs"] = vp.DefaultUserQuotaInKiBs + } + if vp.DefaultGroupQuotaInKiBs != nil { + objectMap["defaultGroupQuotaInKiBs"] = vp.DefaultGroupQuotaInKiBs + } + return json.Marshal(objectMap) +} + +// VolumePropertiesDataProtection dataProtection type volumes include an object containing details of the +// replication +type VolumePropertiesDataProtection struct { + // Backup - Backup Properties + Backup *VolumeBackupProperties `json:"backup,omitempty"` + // Replication - Replication properties + Replication *ReplicationObject `json:"replication,omitempty"` + // Snapshot - Snapshot properties. + Snapshot *VolumeSnapshotProperties `json:"snapshot,omitempty"` +} + +// VolumePropertiesExportPolicy set of export policy rules +type VolumePropertiesExportPolicy struct { + // Rules - Export policy rule + Rules *[]ExportPolicyRule `json:"rules,omitempty"` +} + +// VolumeRevert revert a volume to the snapshot +type VolumeRevert struct { + // SnapshotID - Resource id of the snapshot + SnapshotID *string `json:"snapshotId,omitempty"` +} + +// VolumesAuthorizeReplicationFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type VolumesAuthorizeReplicationFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(VolumesClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *VolumesAuthorizeReplicationFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for VolumesAuthorizeReplicationFuture.Result. +func (future *VolumesAuthorizeReplicationFuture) result(client VolumesClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.VolumesAuthorizeReplicationFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("netapp.VolumesAuthorizeReplicationFuture") + return + } + ar.Response = future.Response() + return +} + +// VolumesBreakReplicationFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type VolumesBreakReplicationFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(VolumesClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *VolumesBreakReplicationFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for VolumesBreakReplicationFuture.Result. +func (future *VolumesBreakReplicationFuture) result(client VolumesClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.VolumesBreakReplicationFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("netapp.VolumesBreakReplicationFuture") + return + } + ar.Response = future.Response() + return +} + +// VolumesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type VolumesCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(VolumesClient) (Volume, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *VolumesCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for VolumesCreateOrUpdateFuture.Result. +func (future *VolumesCreateOrUpdateFuture) result(client VolumesClient) (vVar Volume, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.VolumesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + vVar.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("netapp.VolumesCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if vVar.Response.Response, err = future.GetResult(sender); err == nil && vVar.Response.Response.StatusCode != http.StatusNoContent { + vVar, err = client.CreateOrUpdateResponder(vVar.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.VolumesCreateOrUpdateFuture", "Result", vVar.Response.Response, "Failure responding to request") + } + } + return +} + +// VolumesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type VolumesDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(VolumesClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *VolumesDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for VolumesDeleteFuture.Result. +func (future *VolumesDeleteFuture) result(client VolumesClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.VolumesDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("netapp.VolumesDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// VolumesDeleteReplicationFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type VolumesDeleteReplicationFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(VolumesClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *VolumesDeleteReplicationFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for VolumesDeleteReplicationFuture.Result. +func (future *VolumesDeleteReplicationFuture) result(client VolumesClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.VolumesDeleteReplicationFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("netapp.VolumesDeleteReplicationFuture") + return + } + ar.Response = future.Response() + return +} + +// VolumeSnapshotProperties volume Snapshot Properties +type VolumeSnapshotProperties struct { + // SnapshotPolicyID - Snapshot Policy ResourceId + SnapshotPolicyID *string `json:"snapshotPolicyId,omitempty"` +} + +// VolumesPoolChangeFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type VolumesPoolChangeFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(VolumesClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *VolumesPoolChangeFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for VolumesPoolChangeFuture.Result. +func (future *VolumesPoolChangeFuture) result(client VolumesClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.VolumesPoolChangeFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("netapp.VolumesPoolChangeFuture") + return + } + ar.Response = future.Response() + return +} + +// VolumesReInitializeReplicationFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type VolumesReInitializeReplicationFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(VolumesClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *VolumesReInitializeReplicationFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for VolumesReInitializeReplicationFuture.Result. +func (future *VolumesReInitializeReplicationFuture) result(client VolumesClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.VolumesReInitializeReplicationFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("netapp.VolumesReInitializeReplicationFuture") + return + } + ar.Response = future.Response() + return +} + +// VolumesResyncReplicationFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type VolumesResyncReplicationFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(VolumesClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *VolumesResyncReplicationFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for VolumesResyncReplicationFuture.Result. +func (future *VolumesResyncReplicationFuture) result(client VolumesClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.VolumesResyncReplicationFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("netapp.VolumesResyncReplicationFuture") + return + } + ar.Response = future.Response() + return +} + +// VolumesRevertFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type VolumesRevertFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(VolumesClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *VolumesRevertFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for VolumesRevertFuture.Result. +func (future *VolumesRevertFuture) result(client VolumesClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.VolumesRevertFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("netapp.VolumesRevertFuture") + return + } + ar.Response = future.Response() + return +} + +// VolumesUpdateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type VolumesUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(VolumesClient) (Volume, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *VolumesUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for VolumesUpdateFuture.Result. +func (future *VolumesUpdateFuture) result(client VolumesClient) (vVar Volume, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.VolumesUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + vVar.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("netapp.VolumesUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if vVar.Response.Response, err = future.GetResult(sender); err == nil && vVar.Response.Response.StatusCode != http.StatusNoContent { + vVar, err = client.UpdateResponder(vVar.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.VolumesUpdateFuture", "Result", vVar.Response.Response, "Failure responding to request") + } + } + return +} + +// WeeklySchedule weekly Schedule properties, make a snapshot every week at a specific day or days +type WeeklySchedule struct { + // SnapshotsToKeep - Weekly snapshot count to keep + SnapshotsToKeep *int32 `json:"snapshotsToKeep,omitempty"` + // Day - Indicates which weekdays snapshot should be taken, accepts a comma separated list of week day names in english + Day *string `json:"day,omitempty"` + // Hour - Indicates which hour in UTC timezone a snapshot should be taken + Hour *int32 `json:"hour,omitempty"` + // Minute - Indicates which minute snapshot should be taken + Minute *int32 `json:"minute,omitempty"` + // UsedBytes - Resource size in bytes, current storage usage for the volume in bytes + UsedBytes *int64 `json:"usedBytes,omitempty"` +} diff --git a/services/netapp/mgmt/2021-06-01/netapp/netappapi/interfaces.go b/services/netapp/mgmt/2021-06-01/netapp/netappapi/interfaces.go new file mode 100644 index 000000000000..806f62949813 --- /dev/null +++ b/services/netapp/mgmt/2021-06-01/netapp/netappapi/interfaces.go @@ -0,0 +1,137 @@ +package netappapi + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/azure-sdk-for-go/services/netapp/mgmt/2021-06-01/netapp" +) + +// OperationsClientAPI contains the set of methods on the OperationsClient type. +type OperationsClientAPI interface { + List(ctx context.Context) (result netapp.OperationListResult, err error) +} + +var _ OperationsClientAPI = (*netapp.OperationsClient)(nil) + +// ResourceClientAPI contains the set of methods on the ResourceClient type. +type ResourceClientAPI interface { + CheckFilePathAvailability(ctx context.Context, body netapp.FilePathAvailabilityRequest, location string) (result netapp.CheckAvailabilityResponse, err error) + CheckNameAvailability(ctx context.Context, body netapp.ResourceNameAvailabilityRequest, location string) (result netapp.CheckAvailabilityResponse, err error) + CheckQuotaAvailability(ctx context.Context, body netapp.QuotaAvailabilityRequest, location string) (result netapp.CheckAvailabilityResponse, err error) +} + +var _ ResourceClientAPI = (*netapp.ResourceClient)(nil) + +// AccountsClientAPI contains the set of methods on the AccountsClient type. +type AccountsClientAPI interface { + CreateOrUpdate(ctx context.Context, body netapp.Account, resourceGroupName string, accountName string) (result netapp.AccountsCreateOrUpdateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, accountName string) (result netapp.AccountsDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, accountName string) (result netapp.Account, err error) + List(ctx context.Context, resourceGroupName string) (result netapp.AccountListPage, err error) + ListComplete(ctx context.Context, resourceGroupName string) (result netapp.AccountListIterator, err error) + ListBySubscription(ctx context.Context) (result netapp.AccountListPage, err error) + ListBySubscriptionComplete(ctx context.Context) (result netapp.AccountListIterator, err error) + Update(ctx context.Context, body netapp.AccountPatch, resourceGroupName string, accountName string) (result netapp.AccountsUpdateFuture, err error) +} + +var _ AccountsClientAPI = (*netapp.AccountsClient)(nil) + +// PoolsClientAPI contains the set of methods on the PoolsClient type. +type PoolsClientAPI interface { + CreateOrUpdate(ctx context.Context, body netapp.CapacityPool, resourceGroupName string, accountName string, poolName string) (result netapp.PoolsCreateOrUpdateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, accountName string, poolName string) (result netapp.PoolsDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, accountName string, poolName string) (result netapp.CapacityPool, err error) + List(ctx context.Context, resourceGroupName string, accountName string) (result netapp.CapacityPoolListPage, err error) + ListComplete(ctx context.Context, resourceGroupName string, accountName string) (result netapp.CapacityPoolListIterator, err error) + Update(ctx context.Context, body netapp.CapacityPoolPatch, resourceGroupName string, accountName string, poolName string) (result netapp.PoolsUpdateFuture, err error) +} + +var _ PoolsClientAPI = (*netapp.PoolsClient)(nil) + +// VolumesClientAPI contains the set of methods on the VolumesClient type. +type VolumesClientAPI interface { + AuthorizeReplication(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, body netapp.AuthorizeRequest) (result netapp.VolumesAuthorizeReplicationFuture, err error) + BreakReplication(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, body *netapp.BreakReplicationRequest) (result netapp.VolumesBreakReplicationFuture, err error) + CreateOrUpdate(ctx context.Context, body netapp.Volume, resourceGroupName string, accountName string, poolName string, volumeName string) (result netapp.VolumesCreateOrUpdateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string) (result netapp.VolumesDeleteFuture, err error) + DeleteReplication(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string) (result netapp.VolumesDeleteReplicationFuture, err error) + Get(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string) (result netapp.Volume, err error) + List(ctx context.Context, resourceGroupName string, accountName string, poolName string) (result netapp.VolumeListPage, err error) + ListComplete(ctx context.Context, resourceGroupName string, accountName string, poolName string) (result netapp.VolumeListIterator, err error) + PoolChange(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, body netapp.PoolChangeRequest) (result netapp.VolumesPoolChangeFuture, err error) + ReInitializeReplication(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string) (result netapp.VolumesReInitializeReplicationFuture, err error) + ReplicationStatusMethod(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string) (result netapp.ReplicationStatus, err error) + ResyncReplication(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string) (result netapp.VolumesResyncReplicationFuture, err error) + Revert(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, body netapp.VolumeRevert) (result netapp.VolumesRevertFuture, err error) + Update(ctx context.Context, body netapp.VolumePatch, resourceGroupName string, accountName string, poolName string, volumeName string) (result netapp.VolumesUpdateFuture, err error) +} + +var _ VolumesClientAPI = (*netapp.VolumesClient)(nil) + +// SnapshotsClientAPI contains the set of methods on the SnapshotsClient type. +type SnapshotsClientAPI interface { + Create(ctx context.Context, body netapp.Snapshot, resourceGroupName string, accountName string, poolName string, volumeName string, snapshotName string) (result netapp.SnapshotsCreateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, snapshotName string) (result netapp.SnapshotsDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, snapshotName string) (result netapp.Snapshot, err error) + List(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string) (result netapp.SnapshotsList, err error) + Update(ctx context.Context, body interface{}, resourceGroupName string, accountName string, poolName string, volumeName string, snapshotName string) (result netapp.SnapshotsUpdateFuture, err error) +} + +var _ SnapshotsClientAPI = (*netapp.SnapshotsClient)(nil) + +// SnapshotPoliciesClientAPI contains the set of methods on the SnapshotPoliciesClient type. +type SnapshotPoliciesClientAPI interface { + Create(ctx context.Context, body netapp.SnapshotPolicy, resourceGroupName string, accountName string, snapshotPolicyName string) (result netapp.SnapshotPolicy, err error) + Delete(ctx context.Context, resourceGroupName string, accountName string, snapshotPolicyName string) (result netapp.SnapshotPoliciesDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, accountName string, snapshotPolicyName string) (result netapp.SnapshotPolicy, err error) + List(ctx context.Context, resourceGroupName string, accountName string) (result netapp.SnapshotPoliciesList, err error) + ListVolumes(ctx context.Context, resourceGroupName string, accountName string, snapshotPolicyName string) (result netapp.SnapshotPolicyVolumeList, err error) + Update(ctx context.Context, body netapp.SnapshotPolicyPatch, resourceGroupName string, accountName string, snapshotPolicyName string) (result netapp.SnapshotPoliciesUpdateFuture, err error) +} + +var _ SnapshotPoliciesClientAPI = (*netapp.SnapshotPoliciesClient)(nil) + +// BackupsClientAPI contains the set of methods on the BackupsClient type. +type BackupsClientAPI interface { + Create(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, backupName string, body netapp.Backup) (result netapp.BackupsCreateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, backupName string) (result netapp.BackupsDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, backupName string) (result netapp.Backup, err error) + GetStatus(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string) (result netapp.BackupStatus, err error) + GetVolumeRestoreStatus(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string) (result netapp.RestoreStatus, err error) + List(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string) (result netapp.BackupsList, err error) + Update(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, backupName string, body *netapp.BackupPatch) (result netapp.BackupsUpdateFuture, err error) +} + +var _ BackupsClientAPI = (*netapp.BackupsClient)(nil) + +// AccountBackupsClientAPI contains the set of methods on the AccountBackupsClient type. +type AccountBackupsClientAPI interface { + Delete(ctx context.Context, resourceGroupName string, accountName string, backupName string) (result netapp.AccountBackupsDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, accountName string, backupName string) (result netapp.Backup, err error) + List(ctx context.Context, resourceGroupName string, accountName string) (result netapp.BackupsList, err error) +} + +var _ AccountBackupsClientAPI = (*netapp.AccountBackupsClient)(nil) + +// BackupPoliciesClientAPI contains the set of methods on the BackupPoliciesClient type. +type BackupPoliciesClientAPI interface { + Create(ctx context.Context, resourceGroupName string, accountName string, backupPolicyName string, body netapp.BackupPolicy) (result netapp.BackupPoliciesCreateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, accountName string, backupPolicyName string) (result netapp.BackupPoliciesDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, accountName string, backupPolicyName string) (result netapp.BackupPolicy, err error) + List(ctx context.Context, resourceGroupName string, accountName string) (result netapp.BackupPoliciesList, err error) + Update(ctx context.Context, resourceGroupName string, accountName string, backupPolicyName string, body netapp.BackupPolicyPatch) (result netapp.BackupPoliciesUpdateFuture, err error) +} + +var _ BackupPoliciesClientAPI = (*netapp.BackupPoliciesClient)(nil) + +// VaultsClientAPI contains the set of methods on the VaultsClient type. +type VaultsClientAPI interface { + List(ctx context.Context, resourceGroupName string, accountName string) (result netapp.VaultList, err error) +} + +var _ VaultsClientAPI = (*netapp.VaultsClient)(nil) diff --git a/services/netapp/mgmt/2021-06-01/netapp/operations.go b/services/netapp/mgmt/2021-06-01/netapp/operations.go new file mode 100644 index 000000000000..ec80a3510106 --- /dev/null +++ b/services/netapp/mgmt/2021-06-01/netapp/operations.go @@ -0,0 +1,98 @@ +package netapp + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// OperationsClient is the microsoft NetApp Files Azure Resource Provider specification +type OperationsClient struct { + BaseClient +} + +// NewOperationsClient creates an instance of the OperationsClient client. +func NewOperationsClient(subscriptionID string) OperationsClient { + return NewOperationsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewOperationsClientWithBaseURI creates an instance of the OperationsClient client using a custom endpoint. Use this +// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewOperationsClientWithBaseURI(baseURI string, subscriptionID string) OperationsClient { + return OperationsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List lists all of the available Microsoft.NetApp Rest API operations +func (client OperationsClient) List(ctx context.Context) (result OperationListResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.List") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ListPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.OperationsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "netapp.OperationsClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.OperationsClient", "List", resp, "Failure responding to request") + return + } + + return +} + +// ListPreparer prepares the List request. +func (client OperationsClient) ListPreparer(ctx context.Context) (*http.Request, error) { + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPath("/providers/Microsoft.NetApp/operations"), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client OperationsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client OperationsClient) ListResponder(resp *http.Response) (result OperationListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/netapp/mgmt/2021-06-01/netapp/pools.go b/services/netapp/mgmt/2021-06-01/netapp/pools.go new file mode 100644 index 000000000000..4405aecee6ce --- /dev/null +++ b/services/netapp/mgmt/2021-06-01/netapp/pools.go @@ -0,0 +1,549 @@ +package netapp + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// PoolsClient is the microsoft NetApp Files Azure Resource Provider specification +type PoolsClient struct { + BaseClient +} + +// NewPoolsClient creates an instance of the PoolsClient client. +func NewPoolsClient(subscriptionID string) PoolsClient { + return NewPoolsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewPoolsClientWithBaseURI creates an instance of the PoolsClient client using a custom endpoint. Use this when +// interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewPoolsClientWithBaseURI(baseURI string, subscriptionID string) PoolsClient { + return PoolsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate create or Update a capacity pool +// Parameters: +// body - capacity pool object supplied in the body of the operation. +// resourceGroupName - the name of the resource group. +// accountName - the name of the NetApp account +// poolName - the name of the capacity pool +func (client PoolsClient) CreateOrUpdate(ctx context.Context, body CapacityPool, resourceGroupName string, accountName string, poolName string) (result PoolsCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PoolsClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: body, + Constraints: []validation.Constraint{{Target: "body.Location", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "body.PoolProperties", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "body.PoolProperties.PoolID", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "body.PoolProperties.PoolID", Name: validation.MaxLength, Rule: 36, Chain: nil}, + {Target: "body.PoolProperties.PoolID", Name: validation.MinLength, Rule: 36, Chain: nil}, + {Target: "body.PoolProperties.PoolID", Name: validation.Pattern, Rule: `^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$`, Chain: nil}, + }}, + {Target: "body.PoolProperties.Size", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "body.PoolProperties.Size", Name: validation.InclusiveMaximum, Rule: int64(549755813888000), Chain: nil}, + {Target: "body.PoolProperties.Size", Name: validation.InclusiveMinimum, Rule: int64(4398046511104), Chain: nil}, + }}, + }}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: poolName, + Constraints: []validation.Constraint{{Target: "poolName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "poolName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "poolName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("netapp.PoolsClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, body, resourceGroupName, accountName, poolName) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.PoolsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.PoolsClient", "CreateOrUpdate", nil, "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client PoolsClient) CreateOrUpdatePreparer(ctx context.Context, body CapacityPool, resourceGroupName string, accountName string, poolName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "poolName": autorest.Encode("path", poolName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + body.ID = nil + body.Name = nil + body.Etag = nil + body.Type = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}", pathParameters), + autorest.WithJSON(body), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client PoolsClient) CreateOrUpdateSender(req *http.Request) (future PoolsCreateOrUpdateFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client PoolsClient) CreateOrUpdateResponder(resp *http.Response) (result CapacityPool, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete delete the specified capacity pool +// Parameters: +// resourceGroupName - the name of the resource group. +// accountName - the name of the NetApp account +// poolName - the name of the capacity pool +func (client PoolsClient) Delete(ctx context.Context, resourceGroupName string, accountName string, poolName string) (result PoolsDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PoolsClient.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: poolName, + Constraints: []validation.Constraint{{Target: "poolName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "poolName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "poolName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("netapp.PoolsClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, accountName, poolName) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.PoolsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.PoolsClient", "Delete", nil, "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client PoolsClient) DeletePreparer(ctx context.Context, resourceGroupName string, accountName string, poolName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "poolName": autorest.Encode("path", poolName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client PoolsClient) DeleteSender(req *http.Request) (future PoolsDeleteFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client PoolsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get get details of the specified capacity pool +// Parameters: +// resourceGroupName - the name of the resource group. +// accountName - the name of the NetApp account +// poolName - the name of the capacity pool +func (client PoolsClient) Get(ctx context.Context, resourceGroupName string, accountName string, poolName string) (result CapacityPool, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PoolsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: poolName, + Constraints: []validation.Constraint{{Target: "poolName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "poolName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "poolName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("netapp.PoolsClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, accountName, poolName) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.PoolsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "netapp.PoolsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.PoolsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client PoolsClient) GetPreparer(ctx context.Context, resourceGroupName string, accountName string, poolName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "poolName": autorest.Encode("path", poolName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client PoolsClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client PoolsClient) GetResponder(resp *http.Response) (result CapacityPool, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List list all capacity pools in the NetApp Account +// Parameters: +// resourceGroupName - the name of the resource group. +// accountName - the name of the NetApp account +func (client PoolsClient) List(ctx context.Context, resourceGroupName string, accountName string) (result CapacityPoolListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PoolsClient.List") + defer func() { + sc := -1 + if result.cpl.Response.Response != nil { + sc = result.cpl.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("netapp.PoolsClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, accountName) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.PoolsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.cpl.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "netapp.PoolsClient", "List", resp, "Failure sending request") + return + } + + result.cpl, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.PoolsClient", "List", resp, "Failure responding to request") + return + } + if result.cpl.hasNextLink() && result.cpl.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client PoolsClient) ListPreparer(ctx context.Context, resourceGroupName string, accountName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client PoolsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client PoolsClient) ListResponder(resp *http.Response) (result CapacityPoolList, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client PoolsClient) listNextResults(ctx context.Context, lastResults CapacityPoolList) (result CapacityPoolList, err error) { + req, err := lastResults.capacityPoolListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "netapp.PoolsClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "netapp.PoolsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.PoolsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client PoolsClient) ListComplete(ctx context.Context, resourceGroupName string, accountName string) (result CapacityPoolListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PoolsClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, resourceGroupName, accountName) + return +} + +// Update patch the specified capacity pool +// Parameters: +// body - capacity pool object supplied in the body of the operation. +// resourceGroupName - the name of the resource group. +// accountName - the name of the NetApp account +// poolName - the name of the capacity pool +func (client PoolsClient) Update(ctx context.Context, body CapacityPoolPatch, resourceGroupName string, accountName string, poolName string) (result PoolsUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PoolsClient.Update") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: poolName, + Constraints: []validation.Constraint{{Target: "poolName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "poolName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "poolName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("netapp.PoolsClient", "Update", err.Error()) + } + + req, err := client.UpdatePreparer(ctx, body, resourceGroupName, accountName, poolName) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.PoolsClient", "Update", nil, "Failure preparing request") + return + } + + result, err = client.UpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.PoolsClient", "Update", nil, "Failure sending request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client PoolsClient) UpdatePreparer(ctx context.Context, body CapacityPoolPatch, resourceGroupName string, accountName string, poolName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "poolName": autorest.Encode("path", poolName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + body.ID = nil + body.Name = nil + body.Type = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}", pathParameters), + autorest.WithJSON(body), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client PoolsClient) UpdateSender(req *http.Request) (future PoolsUpdateFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client PoolsClient) UpdateResponder(resp *http.Response) (result CapacityPool, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/netapp/mgmt/2021-06-01/netapp/resource.go b/services/netapp/mgmt/2021-06-01/netapp/resource.go new file mode 100644 index 000000000000..84f69bd20fad --- /dev/null +++ b/services/netapp/mgmt/2021-06-01/netapp/resource.go @@ -0,0 +1,284 @@ +package netapp + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// ResourceClient is the microsoft NetApp Files Azure Resource Provider specification +type ResourceClient struct { + BaseClient +} + +// NewResourceClient creates an instance of the ResourceClient client. +func NewResourceClient(subscriptionID string) ResourceClient { + return NewResourceClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewResourceClientWithBaseURI creates an instance of the ResourceClient client using a custom endpoint. Use this +// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewResourceClientWithBaseURI(baseURI string, subscriptionID string) ResourceClient { + return ResourceClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CheckFilePathAvailability check if a file path is available. +// Parameters: +// body - file path availability request. +// location - the location +func (client ResourceClient) CheckFilePathAvailability(ctx context.Context, body FilePathAvailabilityRequest, location string) (result CheckAvailabilityResponse, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ResourceClient.CheckFilePathAvailability") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: body, + Constraints: []validation.Constraint{{Target: "body.Name", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "body.SubnetID", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("netapp.ResourceClient", "CheckFilePathAvailability", err.Error()) + } + + req, err := client.CheckFilePathAvailabilityPreparer(ctx, body, location) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.ResourceClient", "CheckFilePathAvailability", nil, "Failure preparing request") + return + } + + resp, err := client.CheckFilePathAvailabilitySender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "netapp.ResourceClient", "CheckFilePathAvailability", resp, "Failure sending request") + return + } + + result, err = client.CheckFilePathAvailabilityResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.ResourceClient", "CheckFilePathAvailability", resp, "Failure responding to request") + return + } + + return +} + +// CheckFilePathAvailabilityPreparer prepares the CheckFilePathAvailability request. +func (client ResourceClient) CheckFilePathAvailabilityPreparer(ctx context.Context, body FilePathAvailabilityRequest, location string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "location": autorest.Encode("path", location), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.NetApp/locations/{location}/checkFilePathAvailability", pathParameters), + autorest.WithJSON(body), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CheckFilePathAvailabilitySender sends the CheckFilePathAvailability request. The method will close the +// http.Response Body if it receives an error. +func (client ResourceClient) CheckFilePathAvailabilitySender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CheckFilePathAvailabilityResponder handles the response to the CheckFilePathAvailability request. The method always +// closes the http.Response Body. +func (client ResourceClient) CheckFilePathAvailabilityResponder(resp *http.Response) (result CheckAvailabilityResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// CheckNameAvailability check if a resource name is available. +// Parameters: +// body - name availability request. +// location - the location +func (client ResourceClient) CheckNameAvailability(ctx context.Context, body ResourceNameAvailabilityRequest, location string) (result CheckAvailabilityResponse, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ResourceClient.CheckNameAvailability") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: body, + Constraints: []validation.Constraint{{Target: "body.Name", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "body.ResourceGroup", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("netapp.ResourceClient", "CheckNameAvailability", err.Error()) + } + + req, err := client.CheckNameAvailabilityPreparer(ctx, body, location) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.ResourceClient", "CheckNameAvailability", nil, "Failure preparing request") + return + } + + resp, err := client.CheckNameAvailabilitySender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "netapp.ResourceClient", "CheckNameAvailability", resp, "Failure sending request") + return + } + + result, err = client.CheckNameAvailabilityResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.ResourceClient", "CheckNameAvailability", resp, "Failure responding to request") + return + } + + return +} + +// CheckNameAvailabilityPreparer prepares the CheckNameAvailability request. +func (client ResourceClient) CheckNameAvailabilityPreparer(ctx context.Context, body ResourceNameAvailabilityRequest, location string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "location": autorest.Encode("path", location), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.NetApp/locations/{location}/checkNameAvailability", pathParameters), + autorest.WithJSON(body), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CheckNameAvailabilitySender sends the CheckNameAvailability request. The method will close the +// http.Response Body if it receives an error. +func (client ResourceClient) CheckNameAvailabilitySender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CheckNameAvailabilityResponder handles the response to the CheckNameAvailability request. The method always +// closes the http.Response Body. +func (client ResourceClient) CheckNameAvailabilityResponder(resp *http.Response) (result CheckAvailabilityResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// CheckQuotaAvailability check if a quota is available. +// Parameters: +// body - quota availability request. +// location - the location +func (client ResourceClient) CheckQuotaAvailability(ctx context.Context, body QuotaAvailabilityRequest, location string) (result CheckAvailabilityResponse, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ResourceClient.CheckQuotaAvailability") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: body, + Constraints: []validation.Constraint{{Target: "body.Name", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "body.ResourceGroup", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("netapp.ResourceClient", "CheckQuotaAvailability", err.Error()) + } + + req, err := client.CheckQuotaAvailabilityPreparer(ctx, body, location) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.ResourceClient", "CheckQuotaAvailability", nil, "Failure preparing request") + return + } + + resp, err := client.CheckQuotaAvailabilitySender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "netapp.ResourceClient", "CheckQuotaAvailability", resp, "Failure sending request") + return + } + + result, err = client.CheckQuotaAvailabilityResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.ResourceClient", "CheckQuotaAvailability", resp, "Failure responding to request") + return + } + + return +} + +// CheckQuotaAvailabilityPreparer prepares the CheckQuotaAvailability request. +func (client ResourceClient) CheckQuotaAvailabilityPreparer(ctx context.Context, body QuotaAvailabilityRequest, location string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "location": autorest.Encode("path", location), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.NetApp/locations/{location}/checkQuotaAvailability", pathParameters), + autorest.WithJSON(body), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CheckQuotaAvailabilitySender sends the CheckQuotaAvailability request. The method will close the +// http.Response Body if it receives an error. +func (client ResourceClient) CheckQuotaAvailabilitySender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CheckQuotaAvailabilityResponder handles the response to the CheckQuotaAvailability request. The method always +// closes the http.Response Body. +func (client ResourceClient) CheckQuotaAvailabilityResponder(resp *http.Response) (result CheckAvailabilityResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/netapp/mgmt/2021-06-01/netapp/snapshotpolicies.go b/services/netapp/mgmt/2021-06-01/netapp/snapshotpolicies.go new file mode 100644 index 000000000000..461e5f8d006b --- /dev/null +++ b/services/netapp/mgmt/2021-06-01/netapp/snapshotpolicies.go @@ -0,0 +1,566 @@ +package netapp + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// SnapshotPoliciesClient is the microsoft NetApp Files Azure Resource Provider specification +type SnapshotPoliciesClient struct { + BaseClient +} + +// NewSnapshotPoliciesClient creates an instance of the SnapshotPoliciesClient client. +func NewSnapshotPoliciesClient(subscriptionID string) SnapshotPoliciesClient { + return NewSnapshotPoliciesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewSnapshotPoliciesClientWithBaseURI creates an instance of the SnapshotPoliciesClient client using a custom +// endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure +// stack). +func NewSnapshotPoliciesClientWithBaseURI(baseURI string, subscriptionID string) SnapshotPoliciesClient { + return SnapshotPoliciesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Create create a snapshot policy +// Parameters: +// body - snapshot policy object supplied in the body of the operation. +// resourceGroupName - the name of the resource group. +// accountName - the name of the NetApp account +// snapshotPolicyName - the name of the snapshot policy +func (client SnapshotPoliciesClient) Create(ctx context.Context, body SnapshotPolicy, resourceGroupName string, accountName string, snapshotPolicyName string) (result SnapshotPolicy, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SnapshotPoliciesClient.Create") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: body, + Constraints: []validation.Constraint{{Target: "body.Location", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "body.SnapshotPolicyProperties", Name: validation.Null, Rule: true, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("netapp.SnapshotPoliciesClient", "Create", err.Error()) + } + + req, err := client.CreatePreparer(ctx, body, resourceGroupName, accountName, snapshotPolicyName) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.SnapshotPoliciesClient", "Create", nil, "Failure preparing request") + return + } + + resp, err := client.CreateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "netapp.SnapshotPoliciesClient", "Create", resp, "Failure sending request") + return + } + + result, err = client.CreateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.SnapshotPoliciesClient", "Create", resp, "Failure responding to request") + return + } + + return +} + +// CreatePreparer prepares the Create request. +func (client SnapshotPoliciesClient) CreatePreparer(ctx context.Context, body SnapshotPolicy, resourceGroupName string, accountName string, snapshotPolicyName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "snapshotPolicyName": autorest.Encode("path", snapshotPolicyName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + body.ID = nil + body.Name = nil + body.Etag = nil + body.Type = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/snapshotPolicies/{snapshotPolicyName}", pathParameters), + autorest.WithJSON(body), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateSender sends the Create request. The method will close the +// http.Response Body if it receives an error. +func (client SnapshotPoliciesClient) CreateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CreateResponder handles the response to the Create request. The method always +// closes the http.Response Body. +func (client SnapshotPoliciesClient) CreateResponder(resp *http.Response) (result SnapshotPolicy, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete delete snapshot policy +// Parameters: +// resourceGroupName - the name of the resource group. +// accountName - the name of the NetApp account +// snapshotPolicyName - the name of the snapshot policy +func (client SnapshotPoliciesClient) Delete(ctx context.Context, resourceGroupName string, accountName string, snapshotPolicyName string) (result SnapshotPoliciesDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SnapshotPoliciesClient.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("netapp.SnapshotPoliciesClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, accountName, snapshotPolicyName) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.SnapshotPoliciesClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.SnapshotPoliciesClient", "Delete", nil, "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client SnapshotPoliciesClient) DeletePreparer(ctx context.Context, resourceGroupName string, accountName string, snapshotPolicyName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "snapshotPolicyName": autorest.Encode("path", snapshotPolicyName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/snapshotPolicies/{snapshotPolicyName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client SnapshotPoliciesClient) DeleteSender(req *http.Request) (future SnapshotPoliciesDeleteFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client SnapshotPoliciesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get get a snapshot Policy +// Parameters: +// resourceGroupName - the name of the resource group. +// accountName - the name of the NetApp account +// snapshotPolicyName - the name of the snapshot policy +func (client SnapshotPoliciesClient) Get(ctx context.Context, resourceGroupName string, accountName string, snapshotPolicyName string) (result SnapshotPolicy, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SnapshotPoliciesClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("netapp.SnapshotPoliciesClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, accountName, snapshotPolicyName) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.SnapshotPoliciesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "netapp.SnapshotPoliciesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.SnapshotPoliciesClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client SnapshotPoliciesClient) GetPreparer(ctx context.Context, resourceGroupName string, accountName string, snapshotPolicyName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "snapshotPolicyName": autorest.Encode("path", snapshotPolicyName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/snapshotPolicies/{snapshotPolicyName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client SnapshotPoliciesClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client SnapshotPoliciesClient) GetResponder(resp *http.Response) (result SnapshotPolicy, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List list snapshot policy +// Parameters: +// resourceGroupName - the name of the resource group. +// accountName - the name of the NetApp account +func (client SnapshotPoliciesClient) List(ctx context.Context, resourceGroupName string, accountName string) (result SnapshotPoliciesList, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SnapshotPoliciesClient.List") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("netapp.SnapshotPoliciesClient", "List", err.Error()) + } + + req, err := client.ListPreparer(ctx, resourceGroupName, accountName) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.SnapshotPoliciesClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "netapp.SnapshotPoliciesClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.SnapshotPoliciesClient", "List", resp, "Failure responding to request") + return + } + + return +} + +// ListPreparer prepares the List request. +func (client SnapshotPoliciesClient) ListPreparer(ctx context.Context, resourceGroupName string, accountName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/snapshotPolicies", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client SnapshotPoliciesClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client SnapshotPoliciesClient) ListResponder(resp *http.Response) (result SnapshotPoliciesList, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListVolumes get volumes associated with snapshot policy +// Parameters: +// resourceGroupName - the name of the resource group. +// accountName - the name of the NetApp account +// snapshotPolicyName - the name of the snapshot policy +func (client SnapshotPoliciesClient) ListVolumes(ctx context.Context, resourceGroupName string, accountName string, snapshotPolicyName string) (result SnapshotPolicyVolumeList, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SnapshotPoliciesClient.ListVolumes") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("netapp.SnapshotPoliciesClient", "ListVolumes", err.Error()) + } + + req, err := client.ListVolumesPreparer(ctx, resourceGroupName, accountName, snapshotPolicyName) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.SnapshotPoliciesClient", "ListVolumes", nil, "Failure preparing request") + return + } + + resp, err := client.ListVolumesSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "netapp.SnapshotPoliciesClient", "ListVolumes", resp, "Failure sending request") + return + } + + result, err = client.ListVolumesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.SnapshotPoliciesClient", "ListVolumes", resp, "Failure responding to request") + return + } + + return +} + +// ListVolumesPreparer prepares the ListVolumes request. +func (client SnapshotPoliciesClient) ListVolumesPreparer(ctx context.Context, resourceGroupName string, accountName string, snapshotPolicyName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "snapshotPolicyName": autorest.Encode("path", snapshotPolicyName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/snapshotPolicies/{snapshotPolicyName}/volumes", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListVolumesSender sends the ListVolumes request. The method will close the +// http.Response Body if it receives an error. +func (client SnapshotPoliciesClient) ListVolumesSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListVolumesResponder handles the response to the ListVolumes request. The method always +// closes the http.Response Body. +func (client SnapshotPoliciesClient) ListVolumesResponder(resp *http.Response) (result SnapshotPolicyVolumeList, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Update patch a snapshot policy +// Parameters: +// body - snapshot policy object supplied in the body of the operation. +// resourceGroupName - the name of the resource group. +// accountName - the name of the NetApp account +// snapshotPolicyName - the name of the snapshot policy +func (client SnapshotPoliciesClient) Update(ctx context.Context, body SnapshotPolicyPatch, resourceGroupName string, accountName string, snapshotPolicyName string) (result SnapshotPoliciesUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SnapshotPoliciesClient.Update") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("netapp.SnapshotPoliciesClient", "Update", err.Error()) + } + + req, err := client.UpdatePreparer(ctx, body, resourceGroupName, accountName, snapshotPolicyName) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.SnapshotPoliciesClient", "Update", nil, "Failure preparing request") + return + } + + result, err = client.UpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.SnapshotPoliciesClient", "Update", nil, "Failure sending request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client SnapshotPoliciesClient) UpdatePreparer(ctx context.Context, body SnapshotPolicyPatch, resourceGroupName string, accountName string, snapshotPolicyName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "snapshotPolicyName": autorest.Encode("path", snapshotPolicyName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + body.ID = nil + body.Name = nil + body.Type = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/snapshotPolicies/{snapshotPolicyName}", pathParameters), + autorest.WithJSON(body), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client SnapshotPoliciesClient) UpdateSender(req *http.Request) (future SnapshotPoliciesUpdateFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client SnapshotPoliciesClient) UpdateResponder(resp *http.Response) (result SnapshotPolicy, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/netapp/mgmt/2021-06-01/netapp/snapshots.go b/services/netapp/mgmt/2021-06-01/netapp/snapshots.go new file mode 100644 index 000000000000..80de57a27883 --- /dev/null +++ b/services/netapp/mgmt/2021-06-01/netapp/snapshots.go @@ -0,0 +1,543 @@ +package netapp + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// SnapshotsClient is the microsoft NetApp Files Azure Resource Provider specification +type SnapshotsClient struct { + BaseClient +} + +// NewSnapshotsClient creates an instance of the SnapshotsClient client. +func NewSnapshotsClient(subscriptionID string) SnapshotsClient { + return NewSnapshotsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewSnapshotsClientWithBaseURI creates an instance of the SnapshotsClient client using a custom endpoint. Use this +// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewSnapshotsClientWithBaseURI(baseURI string, subscriptionID string) SnapshotsClient { + return SnapshotsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Create create the specified snapshot within the given volume +// Parameters: +// body - snapshot object supplied in the body of the operation. +// resourceGroupName - the name of the resource group. +// accountName - the name of the NetApp account +// poolName - the name of the capacity pool +// volumeName - the name of the volume +// snapshotName - the name of the snapshot +func (client SnapshotsClient) Create(ctx context.Context, body Snapshot, resourceGroupName string, accountName string, poolName string, volumeName string, snapshotName string) (result SnapshotsCreateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SnapshotsClient.Create") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: body, + Constraints: []validation.Constraint{{Target: "body.Location", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "body.SnapshotProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "body.SnapshotProperties.SnapshotID", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "body.SnapshotProperties.SnapshotID", Name: validation.MaxLength, Rule: 36, Chain: nil}, + {Target: "body.SnapshotProperties.SnapshotID", Name: validation.MinLength, Rule: 36, Chain: nil}, + {Target: "body.SnapshotProperties.SnapshotID", Name: validation.Pattern, Rule: `^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$`, Chain: nil}, + }}, + }}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: poolName, + Constraints: []validation.Constraint{{Target: "poolName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "poolName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "poolName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}, + {TargetValue: volumeName, + Constraints: []validation.Constraint{{Target: "volumeName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "volumeName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "volumeName", Name: validation.Pattern, Rule: `^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("netapp.SnapshotsClient", "Create", err.Error()) + } + + req, err := client.CreatePreparer(ctx, body, resourceGroupName, accountName, poolName, volumeName, snapshotName) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.SnapshotsClient", "Create", nil, "Failure preparing request") + return + } + + result, err = client.CreateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.SnapshotsClient", "Create", nil, "Failure sending request") + return + } + + return +} + +// CreatePreparer prepares the Create request. +func (client SnapshotsClient) CreatePreparer(ctx context.Context, body Snapshot, resourceGroupName string, accountName string, poolName string, volumeName string, snapshotName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "poolName": autorest.Encode("path", poolName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "snapshotName": autorest.Encode("path", snapshotName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "volumeName": autorest.Encode("path", volumeName), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + body.ID = nil + body.Name = nil + body.Type = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/snapshots/{snapshotName}", pathParameters), + autorest.WithJSON(body), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateSender sends the Create request. The method will close the +// http.Response Body if it receives an error. +func (client SnapshotsClient) CreateSender(req *http.Request) (future SnapshotsCreateFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateResponder handles the response to the Create request. The method always +// closes the http.Response Body. +func (client SnapshotsClient) CreateResponder(resp *http.Response) (result Snapshot, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete delete snapshot +// Parameters: +// resourceGroupName - the name of the resource group. +// accountName - the name of the NetApp account +// poolName - the name of the capacity pool +// volumeName - the name of the volume +// snapshotName - the name of the snapshot +func (client SnapshotsClient) Delete(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, snapshotName string) (result SnapshotsDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SnapshotsClient.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: poolName, + Constraints: []validation.Constraint{{Target: "poolName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "poolName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "poolName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}, + {TargetValue: volumeName, + Constraints: []validation.Constraint{{Target: "volumeName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "volumeName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "volumeName", Name: validation.Pattern, Rule: `^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("netapp.SnapshotsClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, accountName, poolName, volumeName, snapshotName) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.SnapshotsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.SnapshotsClient", "Delete", nil, "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client SnapshotsClient) DeletePreparer(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, snapshotName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "poolName": autorest.Encode("path", poolName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "snapshotName": autorest.Encode("path", snapshotName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "volumeName": autorest.Encode("path", volumeName), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/snapshots/{snapshotName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client SnapshotsClient) DeleteSender(req *http.Request) (future SnapshotsDeleteFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client SnapshotsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get get details of the specified snapshot +// Parameters: +// resourceGroupName - the name of the resource group. +// accountName - the name of the NetApp account +// poolName - the name of the capacity pool +// volumeName - the name of the volume +// snapshotName - the name of the snapshot +func (client SnapshotsClient) Get(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, snapshotName string) (result Snapshot, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SnapshotsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: poolName, + Constraints: []validation.Constraint{{Target: "poolName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "poolName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "poolName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}, + {TargetValue: volumeName, + Constraints: []validation.Constraint{{Target: "volumeName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "volumeName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "volumeName", Name: validation.Pattern, Rule: `^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("netapp.SnapshotsClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, accountName, poolName, volumeName, snapshotName) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.SnapshotsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "netapp.SnapshotsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.SnapshotsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client SnapshotsClient) GetPreparer(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, snapshotName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "poolName": autorest.Encode("path", poolName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "snapshotName": autorest.Encode("path", snapshotName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "volumeName": autorest.Encode("path", volumeName), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/snapshots/{snapshotName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client SnapshotsClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client SnapshotsClient) GetResponder(resp *http.Response) (result Snapshot, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List list all snapshots associated with the volume +// Parameters: +// resourceGroupName - the name of the resource group. +// accountName - the name of the NetApp account +// poolName - the name of the capacity pool +// volumeName - the name of the volume +func (client SnapshotsClient) List(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string) (result SnapshotsList, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SnapshotsClient.List") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: poolName, + Constraints: []validation.Constraint{{Target: "poolName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "poolName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "poolName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}, + {TargetValue: volumeName, + Constraints: []validation.Constraint{{Target: "volumeName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "volumeName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "volumeName", Name: validation.Pattern, Rule: `^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("netapp.SnapshotsClient", "List", err.Error()) + } + + req, err := client.ListPreparer(ctx, resourceGroupName, accountName, poolName, volumeName) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.SnapshotsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "netapp.SnapshotsClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.SnapshotsClient", "List", resp, "Failure responding to request") + return + } + + return +} + +// ListPreparer prepares the List request. +func (client SnapshotsClient) ListPreparer(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "poolName": autorest.Encode("path", poolName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "volumeName": autorest.Encode("path", volumeName), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/snapshots", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client SnapshotsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client SnapshotsClient) ListResponder(resp *http.Response) (result SnapshotsList, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Update patch a snapshot +// Parameters: +// body - snapshot object supplied in the body of the operation. +// resourceGroupName - the name of the resource group. +// accountName - the name of the NetApp account +// poolName - the name of the capacity pool +// volumeName - the name of the volume +// snapshotName - the name of the snapshot +func (client SnapshotsClient) Update(ctx context.Context, body interface{}, resourceGroupName string, accountName string, poolName string, volumeName string, snapshotName string) (result SnapshotsUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SnapshotsClient.Update") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: poolName, + Constraints: []validation.Constraint{{Target: "poolName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "poolName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "poolName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}, + {TargetValue: volumeName, + Constraints: []validation.Constraint{{Target: "volumeName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "volumeName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "volumeName", Name: validation.Pattern, Rule: `^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("netapp.SnapshotsClient", "Update", err.Error()) + } + + req, err := client.UpdatePreparer(ctx, body, resourceGroupName, accountName, poolName, volumeName, snapshotName) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.SnapshotsClient", "Update", nil, "Failure preparing request") + return + } + + result, err = client.UpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.SnapshotsClient", "Update", nil, "Failure sending request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client SnapshotsClient) UpdatePreparer(ctx context.Context, body interface{}, resourceGroupName string, accountName string, poolName string, volumeName string, snapshotName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "poolName": autorest.Encode("path", poolName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "snapshotName": autorest.Encode("path", snapshotName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "volumeName": autorest.Encode("path", volumeName), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/snapshots/{snapshotName}", pathParameters), + autorest.WithJSON(body), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client SnapshotsClient) UpdateSender(req *http.Request) (future SnapshotsUpdateFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client SnapshotsClient) UpdateResponder(resp *http.Response) (result Snapshot, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/netapp/mgmt/2021-06-01/netapp/vaults.go b/services/netapp/mgmt/2021-06-01/netapp/vaults.go new file mode 100644 index 000000000000..3dece6a95fcd --- /dev/null +++ b/services/netapp/mgmt/2021-06-01/netapp/vaults.go @@ -0,0 +1,116 @@ +package netapp + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// VaultsClient is the microsoft NetApp Files Azure Resource Provider specification +type VaultsClient struct { + BaseClient +} + +// NewVaultsClient creates an instance of the VaultsClient client. +func NewVaultsClient(subscriptionID string) VaultsClient { + return NewVaultsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewVaultsClientWithBaseURI creates an instance of the VaultsClient client using a custom endpoint. Use this when +// interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewVaultsClientWithBaseURI(baseURI string, subscriptionID string) VaultsClient { + return VaultsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List list vaults for a Netapp Account +// Parameters: +// resourceGroupName - the name of the resource group. +// accountName - the name of the NetApp account +func (client VaultsClient) List(ctx context.Context, resourceGroupName string, accountName string) (result VaultList, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VaultsClient.List") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("netapp.VaultsClient", "List", err.Error()) + } + + req, err := client.ListPreparer(ctx, resourceGroupName, accountName) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.VaultsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "netapp.VaultsClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.VaultsClient", "List", resp, "Failure responding to request") + return + } + + return +} + +// ListPreparer prepares the List request. +func (client VaultsClient) ListPreparer(ctx context.Context, resourceGroupName string, accountName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/vaults", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client VaultsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client VaultsClient) ListResponder(resp *http.Response) (result VaultList, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/netapp/mgmt/2021-06-01/netapp/version.go b/services/netapp/mgmt/2021-06-01/netapp/version.go new file mode 100644 index 000000000000..0ede4076aaa4 --- /dev/null +++ b/services/netapp/mgmt/2021-06-01/netapp/version.go @@ -0,0 +1,19 @@ +package netapp + +import "github.com/Azure/azure-sdk-for-go/version" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// UserAgent returns the UserAgent string to use when sending http.Requests. +func UserAgent() string { + return "Azure-SDK-For-Go/" + Version() + " netapp/2021-06-01" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return version.Number +} diff --git a/services/netapp/mgmt/2021-06-01/netapp/volumes.go b/services/netapp/mgmt/2021-06-01/netapp/volumes.go new file mode 100644 index 000000000000..5a3b1c2ee936 --- /dev/null +++ b/services/netapp/mgmt/2021-06-01/netapp/volumes.go @@ -0,0 +1,1405 @@ +package netapp + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// VolumesClient is the microsoft NetApp Files Azure Resource Provider specification +type VolumesClient struct { + BaseClient +} + +// NewVolumesClient creates an instance of the VolumesClient client. +func NewVolumesClient(subscriptionID string) VolumesClient { + return NewVolumesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewVolumesClientWithBaseURI creates an instance of the VolumesClient client using a custom endpoint. Use this when +// interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewVolumesClientWithBaseURI(baseURI string, subscriptionID string) VolumesClient { + return VolumesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// AuthorizeReplication authorize the replication connection on the source volume +// Parameters: +// resourceGroupName - the name of the resource group. +// accountName - the name of the NetApp account +// poolName - the name of the capacity pool +// volumeName - the name of the volume +// body - authorize request object supplied in the body of the operation. +func (client VolumesClient) AuthorizeReplication(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, body AuthorizeRequest) (result VolumesAuthorizeReplicationFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VolumesClient.AuthorizeReplication") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: poolName, + Constraints: []validation.Constraint{{Target: "poolName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "poolName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "poolName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}, + {TargetValue: volumeName, + Constraints: []validation.Constraint{{Target: "volumeName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "volumeName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "volumeName", Name: validation.Pattern, Rule: `^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("netapp.VolumesClient", "AuthorizeReplication", err.Error()) + } + + req, err := client.AuthorizeReplicationPreparer(ctx, resourceGroupName, accountName, poolName, volumeName, body) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.VolumesClient", "AuthorizeReplication", nil, "Failure preparing request") + return + } + + result, err = client.AuthorizeReplicationSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.VolumesClient", "AuthorizeReplication", nil, "Failure sending request") + return + } + + return +} + +// AuthorizeReplicationPreparer prepares the AuthorizeReplication request. +func (client VolumesClient) AuthorizeReplicationPreparer(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, body AuthorizeRequest) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "poolName": autorest.Encode("path", poolName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "volumeName": autorest.Encode("path", volumeName), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/authorizeReplication", pathParameters), + autorest.WithJSON(body), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// AuthorizeReplicationSender sends the AuthorizeReplication request. The method will close the +// http.Response Body if it receives an error. +func (client VolumesClient) AuthorizeReplicationSender(req *http.Request) (future VolumesAuthorizeReplicationFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// AuthorizeReplicationResponder handles the response to the AuthorizeReplication request. The method always +// closes the http.Response Body. +func (client VolumesClient) AuthorizeReplicationResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// BreakReplication break the replication connection on the destination volume +// Parameters: +// resourceGroupName - the name of the resource group. +// accountName - the name of the NetApp account +// poolName - the name of the capacity pool +// volumeName - the name of the volume +// body - optional body to force break the replication. +func (client VolumesClient) BreakReplication(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, body *BreakReplicationRequest) (result VolumesBreakReplicationFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VolumesClient.BreakReplication") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: poolName, + Constraints: []validation.Constraint{{Target: "poolName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "poolName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "poolName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}, + {TargetValue: volumeName, + Constraints: []validation.Constraint{{Target: "volumeName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "volumeName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "volumeName", Name: validation.Pattern, Rule: `^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("netapp.VolumesClient", "BreakReplication", err.Error()) + } + + req, err := client.BreakReplicationPreparer(ctx, resourceGroupName, accountName, poolName, volumeName, body) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.VolumesClient", "BreakReplication", nil, "Failure preparing request") + return + } + + result, err = client.BreakReplicationSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.VolumesClient", "BreakReplication", nil, "Failure sending request") + return + } + + return +} + +// BreakReplicationPreparer prepares the BreakReplication request. +func (client VolumesClient) BreakReplicationPreparer(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, body *BreakReplicationRequest) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "poolName": autorest.Encode("path", poolName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "volumeName": autorest.Encode("path", volumeName), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/breakReplication", pathParameters), + autorest.WithQueryParameters(queryParameters)) + if body != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithJSON(body)) + } + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// BreakReplicationSender sends the BreakReplication request. The method will close the +// http.Response Body if it receives an error. +func (client VolumesClient) BreakReplicationSender(req *http.Request) (future VolumesBreakReplicationFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// BreakReplicationResponder handles the response to the BreakReplication request. The method always +// closes the http.Response Body. +func (client VolumesClient) BreakReplicationResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// CreateOrUpdate create or update the specified volume within the capacity pool +// Parameters: +// body - volume object supplied in the body of the operation. +// resourceGroupName - the name of the resource group. +// accountName - the name of the NetApp account +// poolName - the name of the capacity pool +// volumeName - the name of the volume +func (client VolumesClient) CreateOrUpdate(ctx context.Context, body Volume, resourceGroupName string, accountName string, poolName string, volumeName string) (result VolumesCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VolumesClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: body, + Constraints: []validation.Constraint{{Target: "body.Location", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "body.VolumeProperties", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "body.VolumeProperties.FileSystemID", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "body.VolumeProperties.FileSystemID", Name: validation.MaxLength, Rule: 36, Chain: nil}, + {Target: "body.VolumeProperties.FileSystemID", Name: validation.MinLength, Rule: 36, Chain: nil}, + {Target: "body.VolumeProperties.FileSystemID", Name: validation.Pattern, Rule: `^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$`, Chain: nil}, + }}, + {Target: "body.VolumeProperties.CreationToken", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "body.VolumeProperties.CreationToken", Name: validation.MaxLength, Rule: 80, Chain: nil}, + {Target: "body.VolumeProperties.CreationToken", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "body.VolumeProperties.CreationToken", Name: validation.Pattern, Rule: `^[a-zA-Z][a-zA-Z0-9\-]{0,79}$`, Chain: nil}, + }}, + {Target: "body.VolumeProperties.UsageThreshold", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "body.VolumeProperties.UsageThreshold", Name: validation.InclusiveMaximum, Rule: int64(109951162777600), Chain: nil}, + {Target: "body.VolumeProperties.UsageThreshold", Name: validation.InclusiveMinimum, Rule: int64(107374182400), Chain: nil}, + }}, + {Target: "body.VolumeProperties.SnapshotID", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "body.VolumeProperties.SnapshotID", Name: validation.MaxLength, Rule: 36, Chain: nil}, + {Target: "body.VolumeProperties.SnapshotID", Name: validation.MinLength, Rule: 36, Chain: nil}, + {Target: "body.VolumeProperties.SnapshotID", Name: validation.Pattern, Rule: `^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}|(\\?([^\/]*[\/])*)([^\/]+)$`, Chain: nil}, + }}, + {Target: "body.VolumeProperties.BackupID", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "body.VolumeProperties.BackupID", Name: validation.MaxLength, Rule: 36, Chain: nil}, + {Target: "body.VolumeProperties.BackupID", Name: validation.MinLength, Rule: 36, Chain: nil}, + {Target: "body.VolumeProperties.BackupID", Name: validation.Pattern, Rule: `^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}|(\\?([^\/]*[\/])*)([^\/]+)$`, Chain: nil}, + }}, + {Target: "body.VolumeProperties.SubnetID", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "body.VolumeProperties.DataProtection", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "body.VolumeProperties.DataProtection.Replication", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "body.VolumeProperties.DataProtection.Replication.RemoteVolumeResourceID", Name: validation.Null, Rule: true, Chain: nil}}}, + }}, + {Target: "body.VolumeProperties.ThroughputMibps", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "body.VolumeProperties.ThroughputMibps", Name: validation.InclusiveMaximum, Rule: float64(4500), Chain: nil}, + {Target: "body.VolumeProperties.ThroughputMibps", Name: validation.InclusiveMinimum, Rule: float64(0), Chain: nil}, + }}, + {Target: "body.VolumeProperties.CoolnessPeriod", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "body.VolumeProperties.CoolnessPeriod", Name: validation.InclusiveMaximum, Rule: int64(63), Chain: nil}, + {Target: "body.VolumeProperties.CoolnessPeriod", Name: validation.InclusiveMinimum, Rule: int64(7), Chain: nil}, + }}, + {Target: "body.VolumeProperties.UnixPermissions", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "body.VolumeProperties.UnixPermissions", Name: validation.MaxLength, Rule: 4, Chain: nil}, + {Target: "body.VolumeProperties.UnixPermissions", Name: validation.MinLength, Rule: 4, Chain: nil}, + }}, + }}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: poolName, + Constraints: []validation.Constraint{{Target: "poolName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "poolName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "poolName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}, + {TargetValue: volumeName, + Constraints: []validation.Constraint{{Target: "volumeName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "volumeName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "volumeName", Name: validation.Pattern, Rule: `^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("netapp.VolumesClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, body, resourceGroupName, accountName, poolName, volumeName) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.VolumesClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.VolumesClient", "CreateOrUpdate", nil, "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client VolumesClient) CreateOrUpdatePreparer(ctx context.Context, body Volume, resourceGroupName string, accountName string, poolName string, volumeName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "poolName": autorest.Encode("path", poolName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "volumeName": autorest.Encode("path", volumeName), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + body.ID = nil + body.Name = nil + body.Etag = nil + body.Type = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}", pathParameters), + autorest.WithJSON(body), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client VolumesClient) CreateOrUpdateSender(req *http.Request) (future VolumesCreateOrUpdateFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client VolumesClient) CreateOrUpdateResponder(resp *http.Response) (result Volume, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete delete the specified volume +// Parameters: +// resourceGroupName - the name of the resource group. +// accountName - the name of the NetApp account +// poolName - the name of the capacity pool +// volumeName - the name of the volume +func (client VolumesClient) Delete(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string) (result VolumesDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VolumesClient.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: poolName, + Constraints: []validation.Constraint{{Target: "poolName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "poolName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "poolName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}, + {TargetValue: volumeName, + Constraints: []validation.Constraint{{Target: "volumeName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "volumeName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "volumeName", Name: validation.Pattern, Rule: `^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("netapp.VolumesClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, accountName, poolName, volumeName) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.VolumesClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.VolumesClient", "Delete", nil, "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client VolumesClient) DeletePreparer(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "poolName": autorest.Encode("path", poolName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "volumeName": autorest.Encode("path", volumeName), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client VolumesClient) DeleteSender(req *http.Request) (future VolumesDeleteFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client VolumesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// DeleteReplication delete the replication connection on the destination volume, and send release to the source +// replication +// Parameters: +// resourceGroupName - the name of the resource group. +// accountName - the name of the NetApp account +// poolName - the name of the capacity pool +// volumeName - the name of the volume +func (client VolumesClient) DeleteReplication(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string) (result VolumesDeleteReplicationFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VolumesClient.DeleteReplication") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: poolName, + Constraints: []validation.Constraint{{Target: "poolName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "poolName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "poolName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}, + {TargetValue: volumeName, + Constraints: []validation.Constraint{{Target: "volumeName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "volumeName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "volumeName", Name: validation.Pattern, Rule: `^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("netapp.VolumesClient", "DeleteReplication", err.Error()) + } + + req, err := client.DeleteReplicationPreparer(ctx, resourceGroupName, accountName, poolName, volumeName) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.VolumesClient", "DeleteReplication", nil, "Failure preparing request") + return + } + + result, err = client.DeleteReplicationSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.VolumesClient", "DeleteReplication", nil, "Failure sending request") + return + } + + return +} + +// DeleteReplicationPreparer prepares the DeleteReplication request. +func (client VolumesClient) DeleteReplicationPreparer(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "poolName": autorest.Encode("path", poolName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "volumeName": autorest.Encode("path", volumeName), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/deleteReplication", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteReplicationSender sends the DeleteReplication request. The method will close the +// http.Response Body if it receives an error. +func (client VolumesClient) DeleteReplicationSender(req *http.Request) (future VolumesDeleteReplicationFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteReplicationResponder handles the response to the DeleteReplication request. The method always +// closes the http.Response Body. +func (client VolumesClient) DeleteReplicationResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get get the details of the specified volume +// Parameters: +// resourceGroupName - the name of the resource group. +// accountName - the name of the NetApp account +// poolName - the name of the capacity pool +// volumeName - the name of the volume +func (client VolumesClient) Get(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string) (result Volume, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VolumesClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: poolName, + Constraints: []validation.Constraint{{Target: "poolName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "poolName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "poolName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}, + {TargetValue: volumeName, + Constraints: []validation.Constraint{{Target: "volumeName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "volumeName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "volumeName", Name: validation.Pattern, Rule: `^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("netapp.VolumesClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, accountName, poolName, volumeName) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.VolumesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "netapp.VolumesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.VolumesClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client VolumesClient) GetPreparer(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "poolName": autorest.Encode("path", poolName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "volumeName": autorest.Encode("path", volumeName), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client VolumesClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client VolumesClient) GetResponder(resp *http.Response) (result Volume, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List list all volumes within the capacity pool +// Parameters: +// resourceGroupName - the name of the resource group. +// accountName - the name of the NetApp account +// poolName - the name of the capacity pool +func (client VolumesClient) List(ctx context.Context, resourceGroupName string, accountName string, poolName string) (result VolumeListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VolumesClient.List") + defer func() { + sc := -1 + if result.vl.Response.Response != nil { + sc = result.vl.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: poolName, + Constraints: []validation.Constraint{{Target: "poolName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "poolName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "poolName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("netapp.VolumesClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, accountName, poolName) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.VolumesClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.vl.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "netapp.VolumesClient", "List", resp, "Failure sending request") + return + } + + result.vl, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.VolumesClient", "List", resp, "Failure responding to request") + return + } + if result.vl.hasNextLink() && result.vl.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client VolumesClient) ListPreparer(ctx context.Context, resourceGroupName string, accountName string, poolName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "poolName": autorest.Encode("path", poolName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client VolumesClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client VolumesClient) ListResponder(resp *http.Response) (result VolumeList, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client VolumesClient) listNextResults(ctx context.Context, lastResults VolumeList) (result VolumeList, err error) { + req, err := lastResults.volumeListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "netapp.VolumesClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "netapp.VolumesClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.VolumesClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client VolumesClient) ListComplete(ctx context.Context, resourceGroupName string, accountName string, poolName string) (result VolumeListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VolumesClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, resourceGroupName, accountName, poolName) + return +} + +// PoolChange moves volume to another pool +// Parameters: +// resourceGroupName - the name of the resource group. +// accountName - the name of the NetApp account +// poolName - the name of the capacity pool +// volumeName - the name of the volume +// body - move volume to the pool supplied in the body of the operation. +func (client VolumesClient) PoolChange(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, body PoolChangeRequest) (result VolumesPoolChangeFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VolumesClient.PoolChange") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: poolName, + Constraints: []validation.Constraint{{Target: "poolName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "poolName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "poolName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}, + {TargetValue: volumeName, + Constraints: []validation.Constraint{{Target: "volumeName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "volumeName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "volumeName", Name: validation.Pattern, Rule: `^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}, + {TargetValue: body, + Constraints: []validation.Constraint{{Target: "body.NewPoolResourceID", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("netapp.VolumesClient", "PoolChange", err.Error()) + } + + req, err := client.PoolChangePreparer(ctx, resourceGroupName, accountName, poolName, volumeName, body) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.VolumesClient", "PoolChange", nil, "Failure preparing request") + return + } + + result, err = client.PoolChangeSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.VolumesClient", "PoolChange", nil, "Failure sending request") + return + } + + return +} + +// PoolChangePreparer prepares the PoolChange request. +func (client VolumesClient) PoolChangePreparer(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, body PoolChangeRequest) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "poolName": autorest.Encode("path", poolName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "volumeName": autorest.Encode("path", volumeName), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/poolChange", pathParameters), + autorest.WithJSON(body), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// PoolChangeSender sends the PoolChange request. The method will close the +// http.Response Body if it receives an error. +func (client VolumesClient) PoolChangeSender(req *http.Request) (future VolumesPoolChangeFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// PoolChangeResponder handles the response to the PoolChange request. The method always +// closes the http.Response Body. +func (client VolumesClient) PoolChangeResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// ReInitializeReplication re-Initializes the replication connection on the destination volume +// Parameters: +// resourceGroupName - the name of the resource group. +// accountName - the name of the NetApp account +// poolName - the name of the capacity pool +// volumeName - the name of the volume +func (client VolumesClient) ReInitializeReplication(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string) (result VolumesReInitializeReplicationFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VolumesClient.ReInitializeReplication") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: poolName, + Constraints: []validation.Constraint{{Target: "poolName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "poolName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "poolName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}, + {TargetValue: volumeName, + Constraints: []validation.Constraint{{Target: "volumeName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "volumeName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "volumeName", Name: validation.Pattern, Rule: `^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("netapp.VolumesClient", "ReInitializeReplication", err.Error()) + } + + req, err := client.ReInitializeReplicationPreparer(ctx, resourceGroupName, accountName, poolName, volumeName) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.VolumesClient", "ReInitializeReplication", nil, "Failure preparing request") + return + } + + result, err = client.ReInitializeReplicationSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.VolumesClient", "ReInitializeReplication", nil, "Failure sending request") + return + } + + return +} + +// ReInitializeReplicationPreparer prepares the ReInitializeReplication request. +func (client VolumesClient) ReInitializeReplicationPreparer(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "poolName": autorest.Encode("path", poolName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "volumeName": autorest.Encode("path", volumeName), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/reinitializeReplication", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ReInitializeReplicationSender sends the ReInitializeReplication request. The method will close the +// http.Response Body if it receives an error. +func (client VolumesClient) ReInitializeReplicationSender(req *http.Request) (future VolumesReInitializeReplicationFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// ReInitializeReplicationResponder handles the response to the ReInitializeReplication request. The method always +// closes the http.Response Body. +func (client VolumesClient) ReInitializeReplicationResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// ReplicationStatusMethod get the status of the replication +// Parameters: +// resourceGroupName - the name of the resource group. +// accountName - the name of the NetApp account +// poolName - the name of the capacity pool +// volumeName - the name of the volume +func (client VolumesClient) ReplicationStatusMethod(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string) (result ReplicationStatus, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VolumesClient.ReplicationStatusMethod") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: poolName, + Constraints: []validation.Constraint{{Target: "poolName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "poolName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "poolName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}, + {TargetValue: volumeName, + Constraints: []validation.Constraint{{Target: "volumeName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "volumeName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "volumeName", Name: validation.Pattern, Rule: `^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("netapp.VolumesClient", "ReplicationStatusMethod", err.Error()) + } + + req, err := client.ReplicationStatusMethodPreparer(ctx, resourceGroupName, accountName, poolName, volumeName) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.VolumesClient", "ReplicationStatusMethod", nil, "Failure preparing request") + return + } + + resp, err := client.ReplicationStatusMethodSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "netapp.VolumesClient", "ReplicationStatusMethod", resp, "Failure sending request") + return + } + + result, err = client.ReplicationStatusMethodResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.VolumesClient", "ReplicationStatusMethod", resp, "Failure responding to request") + return + } + + return +} + +// ReplicationStatusMethodPreparer prepares the ReplicationStatusMethod request. +func (client VolumesClient) ReplicationStatusMethodPreparer(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "poolName": autorest.Encode("path", poolName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "volumeName": autorest.Encode("path", volumeName), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/replicationStatus", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ReplicationStatusMethodSender sends the ReplicationStatusMethod request. The method will close the +// http.Response Body if it receives an error. +func (client VolumesClient) ReplicationStatusMethodSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ReplicationStatusMethodResponder handles the response to the ReplicationStatusMethod request. The method always +// closes the http.Response Body. +func (client VolumesClient) ReplicationStatusMethodResponder(resp *http.Response) (result ReplicationStatus, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// 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. +// Parameters: +// resourceGroupName - the name of the resource group. +// accountName - the name of the NetApp account +// poolName - the name of the capacity pool +// volumeName - the name of the volume +func (client VolumesClient) ResyncReplication(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string) (result VolumesResyncReplicationFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VolumesClient.ResyncReplication") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: poolName, + Constraints: []validation.Constraint{{Target: "poolName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "poolName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "poolName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}, + {TargetValue: volumeName, + Constraints: []validation.Constraint{{Target: "volumeName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "volumeName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "volumeName", Name: validation.Pattern, Rule: `^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("netapp.VolumesClient", "ResyncReplication", err.Error()) + } + + req, err := client.ResyncReplicationPreparer(ctx, resourceGroupName, accountName, poolName, volumeName) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.VolumesClient", "ResyncReplication", nil, "Failure preparing request") + return + } + + result, err = client.ResyncReplicationSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.VolumesClient", "ResyncReplication", nil, "Failure sending request") + return + } + + return +} + +// ResyncReplicationPreparer prepares the ResyncReplication request. +func (client VolumesClient) ResyncReplicationPreparer(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "poolName": autorest.Encode("path", poolName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "volumeName": autorest.Encode("path", volumeName), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/resyncReplication", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ResyncReplicationSender sends the ResyncReplication request. The method will close the +// http.Response Body if it receives an error. +func (client VolumesClient) ResyncReplicationSender(req *http.Request) (future VolumesResyncReplicationFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// ResyncReplicationResponder handles the response to the ResyncReplication request. The method always +// closes the http.Response Body. +func (client VolumesClient) ResyncReplicationResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// Revert revert a volume to the snapshot specified in the body +// Parameters: +// resourceGroupName - the name of the resource group. +// accountName - the name of the NetApp account +// poolName - the name of the capacity pool +// volumeName - the name of the volume +// body - object for snapshot to revert supplied in the body of the operation. +func (client VolumesClient) Revert(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, body VolumeRevert) (result VolumesRevertFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VolumesClient.Revert") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: poolName, + Constraints: []validation.Constraint{{Target: "poolName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "poolName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "poolName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}, + {TargetValue: volumeName, + Constraints: []validation.Constraint{{Target: "volumeName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "volumeName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "volumeName", Name: validation.Pattern, Rule: `^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("netapp.VolumesClient", "Revert", err.Error()) + } + + req, err := client.RevertPreparer(ctx, resourceGroupName, accountName, poolName, volumeName, body) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.VolumesClient", "Revert", nil, "Failure preparing request") + return + } + + result, err = client.RevertSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.VolumesClient", "Revert", nil, "Failure sending request") + return + } + + return +} + +// RevertPreparer prepares the Revert request. +func (client VolumesClient) RevertPreparer(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, body VolumeRevert) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "poolName": autorest.Encode("path", poolName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "volumeName": autorest.Encode("path", volumeName), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/revert", pathParameters), + autorest.WithJSON(body), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// RevertSender sends the Revert request. The method will close the +// http.Response Body if it receives an error. +func (client VolumesClient) RevertSender(req *http.Request) (future VolumesRevertFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// RevertResponder handles the response to the Revert request. The method always +// closes the http.Response Body. +func (client VolumesClient) RevertResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// Update patch the specified volume +// Parameters: +// body - volume object supplied in the body of the operation. +// resourceGroupName - the name of the resource group. +// accountName - the name of the NetApp account +// poolName - the name of the capacity pool +// volumeName - the name of the volume +func (client VolumesClient) Update(ctx context.Context, body VolumePatch, resourceGroupName string, accountName string, poolName string, volumeName string) (result VolumesUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VolumesClient.Update") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: poolName, + Constraints: []validation.Constraint{{Target: "poolName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "poolName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "poolName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}, + {TargetValue: volumeName, + Constraints: []validation.Constraint{{Target: "volumeName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "volumeName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "volumeName", Name: validation.Pattern, Rule: `^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("netapp.VolumesClient", "Update", err.Error()) + } + + req, err := client.UpdatePreparer(ctx, body, resourceGroupName, accountName, poolName, volumeName) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.VolumesClient", "Update", nil, "Failure preparing request") + return + } + + result, err = client.UpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.VolumesClient", "Update", nil, "Failure sending request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client VolumesClient) UpdatePreparer(ctx context.Context, body VolumePatch, resourceGroupName string, accountName string, poolName string, volumeName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "poolName": autorest.Encode("path", poolName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "volumeName": autorest.Encode("path", volumeName), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + body.ID = nil + body.Name = nil + body.Type = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}", pathParameters), + autorest.WithJSON(body), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client VolumesClient) UpdateSender(req *http.Request) (future VolumesUpdateFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client VolumesClient) UpdateResponder(resp *http.Response) (result Volume, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/preview/netapp/mgmt/2017-08-15/netapp/CHANGELOG.md b/services/preview/netapp/mgmt/2017-08-15/netapp/CHANGELOG.md index 52911e4cc5e4..a1ecf841edb0 100644 --- a/services/preview/netapp/mgmt/2017-08-15/netapp/CHANGELOG.md +++ b/services/preview/netapp/mgmt/2017-08-15/netapp/CHANGELOG.md @@ -1,2 +1,2 @@ -# Change History +# Unreleased diff --git a/services/preview/netapp/mgmt/2017-08-15/netapp/_meta.json b/services/preview/netapp/mgmt/2017-08-15/netapp/_meta.json index dd66156f6e6c..157144991ddc 100644 --- a/services/preview/netapp/mgmt/2017-08-15/netapp/_meta.json +++ b/services/preview/netapp/mgmt/2017-08-15/netapp/_meta.json @@ -1,5 +1,5 @@ { - "commit": "3c764635e7d442b3e74caf593029fcd440b3ef82", + "commit": "81ec17ce66f59c587024bfa8002fafb4436b83ef", "readme": "/_/azure-rest-api-specs/specification/netapp/resource-manager/readme.md", "tag": "package-2017-08-15", "use": "@microsoft.azure/autorest.go@2.1.183", diff --git a/services/preview/netapp/mgmt/2017-08-15/netapp/accounts.go b/services/preview/netapp/mgmt/2017-08-15/netapp/accounts.go index 0ff9af644e9f..9203ba18dac8 100644 --- a/services/preview/netapp/mgmt/2017-08-15/netapp/accounts.go +++ b/services/preview/netapp/mgmt/2017-08-15/netapp/accounts.go @@ -15,7 +15,7 @@ import ( "net/http" ) -// AccountsClient is the microsoft NetApp Azure Resource Provider specification +// AccountsClient is the microsoft NetApp Files Azure Resource Provider specification type AccountsClient struct { BaseClient } diff --git a/services/preview/netapp/mgmt/2017-08-15/netapp/client.go b/services/preview/netapp/mgmt/2017-08-15/netapp/client.go index 135b0fc1ab9a..3779c7ff4094 100644 --- a/services/preview/netapp/mgmt/2017-08-15/netapp/client.go +++ b/services/preview/netapp/mgmt/2017-08-15/netapp/client.go @@ -1,6 +1,6 @@ // Package netapp implements the Azure ARM Netapp service API version 2017-08-15. // -// Microsoft NetApp Azure Resource Provider specification +// Microsoft NetApp Files Azure Resource Provider specification package netapp // Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/services/preview/netapp/mgmt/2017-08-15/netapp/mounttargets.go b/services/preview/netapp/mgmt/2017-08-15/netapp/mounttargets.go index bee25660f666..25273b2bb870 100644 --- a/services/preview/netapp/mgmt/2017-08-15/netapp/mounttargets.go +++ b/services/preview/netapp/mgmt/2017-08-15/netapp/mounttargets.go @@ -15,7 +15,7 @@ import ( "net/http" ) -// MountTargetsClient is the microsoft NetApp Azure Resource Provider specification +// MountTargetsClient is the microsoft NetApp Files Azure Resource Provider specification type MountTargetsClient struct { BaseClient } diff --git a/services/preview/netapp/mgmt/2017-08-15/netapp/operations.go b/services/preview/netapp/mgmt/2017-08-15/netapp/operations.go index 0533df425804..d4c39393921e 100644 --- a/services/preview/netapp/mgmt/2017-08-15/netapp/operations.go +++ b/services/preview/netapp/mgmt/2017-08-15/netapp/operations.go @@ -14,7 +14,7 @@ import ( "net/http" ) -// OperationsClient is the microsoft NetApp Azure Resource Provider specification +// OperationsClient is the microsoft NetApp Files Azure Resource Provider specification type OperationsClient struct { BaseClient } diff --git a/services/preview/netapp/mgmt/2017-08-15/netapp/pools.go b/services/preview/netapp/mgmt/2017-08-15/netapp/pools.go index c62834717f9d..a800819d2c74 100644 --- a/services/preview/netapp/mgmt/2017-08-15/netapp/pools.go +++ b/services/preview/netapp/mgmt/2017-08-15/netapp/pools.go @@ -15,7 +15,7 @@ import ( "net/http" ) -// PoolsClient is the microsoft NetApp Azure Resource Provider specification +// PoolsClient is the microsoft NetApp Files Azure Resource Provider specification type PoolsClient struct { BaseClient } diff --git a/services/preview/netapp/mgmt/2017-08-15/netapp/snapshots.go b/services/preview/netapp/mgmt/2017-08-15/netapp/snapshots.go index 9357aa753ee9..11ffbd80792b 100644 --- a/services/preview/netapp/mgmt/2017-08-15/netapp/snapshots.go +++ b/services/preview/netapp/mgmt/2017-08-15/netapp/snapshots.go @@ -15,7 +15,7 @@ import ( "net/http" ) -// SnapshotsClient is the microsoft NetApp Azure Resource Provider specification +// SnapshotsClient is the microsoft NetApp Files Azure Resource Provider specification type SnapshotsClient struct { BaseClient } diff --git a/services/preview/netapp/mgmt/2017-08-15/netapp/volumes.go b/services/preview/netapp/mgmt/2017-08-15/netapp/volumes.go index 89732585b2f1..c08f69711186 100644 --- a/services/preview/netapp/mgmt/2017-08-15/netapp/volumes.go +++ b/services/preview/netapp/mgmt/2017-08-15/netapp/volumes.go @@ -15,7 +15,7 @@ import ( "net/http" ) -// VolumesClient is the microsoft NetApp Azure Resource Provider specification +// VolumesClient is the microsoft NetApp Files Azure Resource Provider specification type VolumesClient struct { BaseClient } diff --git a/services/preview/netapp/mgmt/2021-04-01-preview/netapp/CHANGELOG.md b/services/preview/netapp/mgmt/2021-04-01-preview/netapp/CHANGELOG.md new file mode 100644 index 000000000000..a1ecf841edb0 --- /dev/null +++ b/services/preview/netapp/mgmt/2021-04-01-preview/netapp/CHANGELOG.md @@ -0,0 +1,2 @@ +# Unreleased + diff --git a/services/preview/netapp/mgmt/2021-04-01-preview/netapp/_meta.json b/services/preview/netapp/mgmt/2021-04-01-preview/netapp/_meta.json new file mode 100644 index 000000000000..d0f81692c044 --- /dev/null +++ b/services/preview/netapp/mgmt/2021-04-01-preview/netapp/_meta.json @@ -0,0 +1,11 @@ +{ + "commit": "81ec17ce66f59c587024bfa8002fafb4436b83ef", + "readme": "/_/azure-rest-api-specs/specification/netapp/resource-manager/readme.md", + "tag": "package-netapp-2021-04-01-preview", + "use": "@microsoft.azure/autorest.go@2.1.183", + "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", + "autorest_command": "autorest --use=@microsoft.azure/autorest.go@2.1.183 --tag=package-netapp-2021-04-01-preview --go-sdk-folder=/_/azure-sdk-for-go --go --verbose --use-onever --version=V2 --go.license-header=MICROSOFT_MIT_NO_VERSION /_/azure-rest-api-specs/specification/netapp/resource-manager/readme.md", + "additional_properties": { + "additional_options": "--go --verbose --use-onever --version=V2 --go.license-header=MICROSOFT_MIT_NO_VERSION" + } +} \ No newline at end of file diff --git a/services/preview/netapp/mgmt/2021-04-01-preview/netapp/accountbackups.go b/services/preview/netapp/mgmt/2021-04-01-preview/netapp/accountbackups.go new file mode 100644 index 000000000000..5a20febfb1ed --- /dev/null +++ b/services/preview/netapp/mgmt/2021-04-01-preview/netapp/accountbackups.go @@ -0,0 +1,289 @@ +package netapp + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// AccountBackupsClient is the microsoft NetApp Files Azure Resource Provider specification +type AccountBackupsClient struct { + BaseClient +} + +// NewAccountBackupsClient creates an instance of the AccountBackupsClient client. +func NewAccountBackupsClient(subscriptionID string) AccountBackupsClient { + return NewAccountBackupsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewAccountBackupsClientWithBaseURI creates an instance of the AccountBackupsClient client using a custom endpoint. +// Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewAccountBackupsClientWithBaseURI(baseURI string, subscriptionID string) AccountBackupsClient { + return AccountBackupsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Delete delete the specified Backup for a Netapp Account +// Parameters: +// resourceGroupName - the name of the resource group. +// accountName - the name of the NetApp account +// backupName - the name of the backup +func (client AccountBackupsClient) Delete(ctx context.Context, resourceGroupName string, accountName string, backupName string) (result AccountBackupsDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AccountBackupsClient.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("netapp.AccountBackupsClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, accountName, backupName) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.AccountBackupsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.AccountBackupsClient", "Delete", nil, "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client AccountBackupsClient) DeletePreparer(ctx context.Context, resourceGroupName string, accountName string, backupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "backupName": autorest.Encode("path", backupName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-04-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/accountBackups/{backupName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client AccountBackupsClient) DeleteSender(req *http.Request) (future AccountBackupsDeleteFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client AccountBackupsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets the specified backup for a Netapp Account +// Parameters: +// resourceGroupName - the name of the resource group. +// accountName - the name of the NetApp account +// backupName - the name of the backup +func (client AccountBackupsClient) Get(ctx context.Context, resourceGroupName string, accountName string, backupName string) (result Backup, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AccountBackupsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("netapp.AccountBackupsClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, accountName, backupName) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.AccountBackupsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "netapp.AccountBackupsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.AccountBackupsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client AccountBackupsClient) GetPreparer(ctx context.Context, resourceGroupName string, accountName string, backupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "backupName": autorest.Encode("path", backupName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-04-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/accountBackups/{backupName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client AccountBackupsClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client AccountBackupsClient) GetResponder(resp *http.Response) (result Backup, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List list all Backups for a Netapp Account +// Parameters: +// resourceGroupName - the name of the resource group. +// accountName - the name of the NetApp account +func (client AccountBackupsClient) List(ctx context.Context, resourceGroupName string, accountName string) (result BackupsList, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AccountBackupsClient.List") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("netapp.AccountBackupsClient", "List", err.Error()) + } + + req, err := client.ListPreparer(ctx, resourceGroupName, accountName) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.AccountBackupsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "netapp.AccountBackupsClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.AccountBackupsClient", "List", resp, "Failure responding to request") + return + } + + return +} + +// ListPreparer prepares the List request. +func (client AccountBackupsClient) ListPreparer(ctx context.Context, resourceGroupName string, accountName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-04-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/accountBackups", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client AccountBackupsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client AccountBackupsClient) ListResponder(resp *http.Response) (result BackupsList, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/preview/netapp/mgmt/2021-04-01-preview/netapp/accounts.go b/services/preview/netapp/mgmt/2021-04-01-preview/netapp/accounts.go new file mode 100644 index 000000000000..8d0d0dca78e5 --- /dev/null +++ b/services/preview/netapp/mgmt/2021-04-01-preview/netapp/accounts.go @@ -0,0 +1,512 @@ +package netapp + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// AccountsClient is the microsoft NetApp Files Azure Resource Provider specification +type AccountsClient struct { + BaseClient +} + +// NewAccountsClient creates an instance of the AccountsClient client. +func NewAccountsClient(subscriptionID string) AccountsClient { + return NewAccountsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewAccountsClientWithBaseURI creates an instance of the AccountsClient client using a custom endpoint. Use this +// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewAccountsClientWithBaseURI(baseURI string, subscriptionID string) AccountsClient { + return AccountsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate create or update the specified NetApp account within the resource group +// Parameters: +// body - netApp Account object supplied in the body of the operation. +// resourceGroupName - the name of the resource group. +// accountName - the name of the NetApp account +func (client AccountsClient) CreateOrUpdate(ctx context.Context, body Account, resourceGroupName string, accountName string) (result AccountsCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AccountsClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: body, + Constraints: []validation.Constraint{{Target: "body.Location", Name: validation.Null, Rule: true, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("netapp.AccountsClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, body, resourceGroupName, accountName) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.AccountsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.AccountsClient", "CreateOrUpdate", nil, "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client AccountsClient) CreateOrUpdatePreparer(ctx context.Context, body Account, resourceGroupName string, accountName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-04-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + body.ID = nil + body.Name = nil + body.Type = nil + body.SystemData = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}", pathParameters), + autorest.WithJSON(body), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client AccountsClient) CreateOrUpdateSender(req *http.Request) (future AccountsCreateOrUpdateFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client AccountsClient) CreateOrUpdateResponder(resp *http.Response) (result Account, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete delete the specified NetApp account +// Parameters: +// resourceGroupName - the name of the resource group. +// accountName - the name of the NetApp account +func (client AccountsClient) Delete(ctx context.Context, resourceGroupName string, accountName string) (result AccountsDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AccountsClient.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("netapp.AccountsClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, accountName) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.AccountsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.AccountsClient", "Delete", nil, "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client AccountsClient) DeletePreparer(ctx context.Context, resourceGroupName string, accountName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-04-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client AccountsClient) DeleteSender(req *http.Request) (future AccountsDeleteFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client AccountsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get get the NetApp account +// Parameters: +// resourceGroupName - the name of the resource group. +// accountName - the name of the NetApp account +func (client AccountsClient) Get(ctx context.Context, resourceGroupName string, accountName string) (result Account, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AccountsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("netapp.AccountsClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, accountName) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.AccountsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "netapp.AccountsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.AccountsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client AccountsClient) GetPreparer(ctx context.Context, resourceGroupName string, accountName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-04-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client AccountsClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client AccountsClient) GetResponder(resp *http.Response) (result Account, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List list and describe all NetApp accounts in the resource group. +// Parameters: +// resourceGroupName - the name of the resource group. +func (client AccountsClient) List(ctx context.Context, resourceGroupName string) (result AccountListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AccountsClient.List") + defer func() { + sc := -1 + if result.al.Response.Response != nil { + sc = result.al.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("netapp.AccountsClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.AccountsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.al.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "netapp.AccountsClient", "List", resp, "Failure sending request") + return + } + + result.al, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.AccountsClient", "List", resp, "Failure responding to request") + return + } + if result.al.hasNextLink() && result.al.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client AccountsClient) ListPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-04-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client AccountsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client AccountsClient) ListResponder(resp *http.Response) (result AccountList, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client AccountsClient) listNextResults(ctx context.Context, lastResults AccountList) (result AccountList, err error) { + req, err := lastResults.accountListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "netapp.AccountsClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "netapp.AccountsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.AccountsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client AccountsClient) ListComplete(ctx context.Context, resourceGroupName string) (result AccountListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AccountsClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, resourceGroupName) + return +} + +// Update patch the specified NetApp account +// Parameters: +// body - netApp Account object supplied in the body of the operation. +// resourceGroupName - the name of the resource group. +// accountName - the name of the NetApp account +func (client AccountsClient) Update(ctx context.Context, body AccountPatch, resourceGroupName string, accountName string) (result AccountsUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AccountsClient.Update") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("netapp.AccountsClient", "Update", err.Error()) + } + + req, err := client.UpdatePreparer(ctx, body, resourceGroupName, accountName) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.AccountsClient", "Update", nil, "Failure preparing request") + return + } + + result, err = client.UpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.AccountsClient", "Update", nil, "Failure sending request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client AccountsClient) UpdatePreparer(ctx context.Context, body AccountPatch, resourceGroupName string, accountName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-04-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + body.ID = nil + body.Name = nil + body.Type = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}", pathParameters), + autorest.WithJSON(body), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client AccountsClient) UpdateSender(req *http.Request) (future AccountsUpdateFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client AccountsClient) UpdateResponder(resp *http.Response) (result Account, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/preview/netapp/mgmt/2021-04-01-preview/netapp/backuppolicies.go b/services/preview/netapp/mgmt/2021-04-01-preview/netapp/backuppolicies.go new file mode 100644 index 000000000000..27e56c051a2f --- /dev/null +++ b/services/preview/netapp/mgmt/2021-04-01-preview/netapp/backuppolicies.go @@ -0,0 +1,480 @@ +package netapp + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// BackupPoliciesClient is the microsoft NetApp Files Azure Resource Provider specification +type BackupPoliciesClient struct { + BaseClient +} + +// NewBackupPoliciesClient creates an instance of the BackupPoliciesClient client. +func NewBackupPoliciesClient(subscriptionID string) BackupPoliciesClient { + return NewBackupPoliciesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewBackupPoliciesClientWithBaseURI creates an instance of the BackupPoliciesClient client using a custom endpoint. +// Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewBackupPoliciesClientWithBaseURI(baseURI string, subscriptionID string) BackupPoliciesClient { + return BackupPoliciesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Create create a backup policy for Netapp Account +// Parameters: +// resourceGroupName - the name of the resource group. +// accountName - the name of the NetApp account +// backupPolicyName - backup policy Name which uniquely identify backup policy. +// body - backup policy object supplied in the body of the operation. +func (client BackupPoliciesClient) Create(ctx context.Context, resourceGroupName string, accountName string, backupPolicyName string, body BackupPolicy) (result BackupPoliciesCreateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BackupPoliciesClient.Create") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: body, + Constraints: []validation.Constraint{{Target: "body.Location", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "body.BackupPolicyProperties", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("netapp.BackupPoliciesClient", "Create", err.Error()) + } + + req, err := client.CreatePreparer(ctx, resourceGroupName, accountName, backupPolicyName, body) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.BackupPoliciesClient", "Create", nil, "Failure preparing request") + return + } + + result, err = client.CreateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.BackupPoliciesClient", "Create", nil, "Failure sending request") + return + } + + return +} + +// CreatePreparer prepares the Create request. +func (client BackupPoliciesClient) CreatePreparer(ctx context.Context, resourceGroupName string, accountName string, backupPolicyName string, body BackupPolicy) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "backupPolicyName": autorest.Encode("path", backupPolicyName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-04-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + body.ID = nil + body.Name = nil + body.Type = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/backupPolicies/{backupPolicyName}", pathParameters), + autorest.WithJSON(body), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateSender sends the Create request. The method will close the +// http.Response Body if it receives an error. +func (client BackupPoliciesClient) CreateSender(req *http.Request) (future BackupPoliciesCreateFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateResponder handles the response to the Create request. The method always +// closes the http.Response Body. +func (client BackupPoliciesClient) CreateResponder(resp *http.Response) (result BackupPolicy, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete delete backup policy +// Parameters: +// resourceGroupName - the name of the resource group. +// accountName - the name of the NetApp account +// backupPolicyName - backup policy Name which uniquely identify backup policy. +func (client BackupPoliciesClient) Delete(ctx context.Context, resourceGroupName string, accountName string, backupPolicyName string) (result BackupPoliciesDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BackupPoliciesClient.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("netapp.BackupPoliciesClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, accountName, backupPolicyName) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.BackupPoliciesClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.BackupPoliciesClient", "Delete", nil, "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client BackupPoliciesClient) DeletePreparer(ctx context.Context, resourceGroupName string, accountName string, backupPolicyName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "backupPolicyName": autorest.Encode("path", backupPolicyName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-04-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/backupPolicies/{backupPolicyName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client BackupPoliciesClient) DeleteSender(req *http.Request) (future BackupPoliciesDeleteFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client BackupPoliciesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get get a particular backup Policy +// Parameters: +// resourceGroupName - the name of the resource group. +// accountName - the name of the NetApp account +// backupPolicyName - backup policy Name which uniquely identify backup policy. +func (client BackupPoliciesClient) Get(ctx context.Context, resourceGroupName string, accountName string, backupPolicyName string) (result BackupPolicy, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BackupPoliciesClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("netapp.BackupPoliciesClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, accountName, backupPolicyName) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.BackupPoliciesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "netapp.BackupPoliciesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.BackupPoliciesClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client BackupPoliciesClient) GetPreparer(ctx context.Context, resourceGroupName string, accountName string, backupPolicyName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "backupPolicyName": autorest.Encode("path", backupPolicyName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-04-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/backupPolicies/{backupPolicyName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client BackupPoliciesClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client BackupPoliciesClient) GetResponder(resp *http.Response) (result BackupPolicy, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List list backup policies for Netapp Account +// Parameters: +// resourceGroupName - the name of the resource group. +// accountName - the name of the NetApp account +func (client BackupPoliciesClient) List(ctx context.Context, resourceGroupName string, accountName string) (result BackupPoliciesList, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BackupPoliciesClient.List") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("netapp.BackupPoliciesClient", "List", err.Error()) + } + + req, err := client.ListPreparer(ctx, resourceGroupName, accountName) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.BackupPoliciesClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "netapp.BackupPoliciesClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.BackupPoliciesClient", "List", resp, "Failure responding to request") + return + } + + return +} + +// ListPreparer prepares the List request. +func (client BackupPoliciesClient) ListPreparer(ctx context.Context, resourceGroupName string, accountName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-04-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/backupPolicies", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client BackupPoliciesClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client BackupPoliciesClient) ListResponder(resp *http.Response) (result BackupPoliciesList, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Update patch a backup policy for Netapp Account +// Parameters: +// resourceGroupName - the name of the resource group. +// accountName - the name of the NetApp account +// backupPolicyName - backup policy Name which uniquely identify backup policy. +// body - backup policy object supplied in the body of the operation. +func (client BackupPoliciesClient) Update(ctx context.Context, resourceGroupName string, accountName string, backupPolicyName string, body BackupPolicyPatch) (result BackupPoliciesUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BackupPoliciesClient.Update") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("netapp.BackupPoliciesClient", "Update", err.Error()) + } + + req, err := client.UpdatePreparer(ctx, resourceGroupName, accountName, backupPolicyName, body) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.BackupPoliciesClient", "Update", nil, "Failure preparing request") + return + } + + result, err = client.UpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.BackupPoliciesClient", "Update", nil, "Failure sending request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client BackupPoliciesClient) UpdatePreparer(ctx context.Context, resourceGroupName string, accountName string, backupPolicyName string, body BackupPolicyPatch) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "backupPolicyName": autorest.Encode("path", backupPolicyName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-04-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + body.ID = nil + body.Name = nil + body.Type = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/backupPolicies/{backupPolicyName}", pathParameters), + autorest.WithJSON(body), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client BackupPoliciesClient) UpdateSender(req *http.Request) (future BackupPoliciesUpdateFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client BackupPoliciesClient) UpdateResponder(resp *http.Response) (result BackupPolicy, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/preview/netapp/mgmt/2021-04-01-preview/netapp/backups.go b/services/preview/netapp/mgmt/2021-04-01-preview/netapp/backups.go new file mode 100644 index 000000000000..afd11cdb8095 --- /dev/null +++ b/services/preview/netapp/mgmt/2021-04-01-preview/netapp/backups.go @@ -0,0 +1,642 @@ +package netapp + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// BackupsClient is the microsoft NetApp Files Azure Resource Provider specification +type BackupsClient struct { + BaseClient +} + +// NewBackupsClient creates an instance of the BackupsClient client. +func NewBackupsClient(subscriptionID string) BackupsClient { + return NewBackupsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewBackupsClientWithBaseURI creates an instance of the BackupsClient client using a custom endpoint. Use this when +// interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewBackupsClientWithBaseURI(baseURI string, subscriptionID string) BackupsClient { + return BackupsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Create create a backup for the volume +// Parameters: +// resourceGroupName - the name of the resource group. +// accountName - the name of the NetApp account +// poolName - the name of the capacity pool +// volumeName - the name of the volume +// backupName - the name of the backup +// body - backup object supplied in the body of the operation. +func (client BackupsClient) Create(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, backupName string, body Backup) (result BackupsCreateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BackupsClient.Create") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: poolName, + Constraints: []validation.Constraint{{Target: "poolName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "poolName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "poolName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}, + {TargetValue: volumeName, + Constraints: []validation.Constraint{{Target: "volumeName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "volumeName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "volumeName", Name: validation.Pattern, Rule: `^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}, + {TargetValue: body, + Constraints: []validation.Constraint{{Target: "body.Location", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "body.BackupProperties", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "body.BackupProperties.BackupID", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "body.BackupProperties.BackupID", Name: validation.MaxLength, Rule: 36, Chain: nil}, + {Target: "body.BackupProperties.BackupID", Name: validation.MinLength, Rule: 36, Chain: nil}, + {Target: "body.BackupProperties.BackupID", Name: validation.Pattern, Rule: `^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$`, Chain: nil}, + }}, + }}}}}); err != nil { + return result, validation.NewError("netapp.BackupsClient", "Create", err.Error()) + } + + req, err := client.CreatePreparer(ctx, resourceGroupName, accountName, poolName, volumeName, backupName, body) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.BackupsClient", "Create", nil, "Failure preparing request") + return + } + + result, err = client.CreateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.BackupsClient", "Create", nil, "Failure sending request") + return + } + + return +} + +// CreatePreparer prepares the Create request. +func (client BackupsClient) CreatePreparer(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, backupName string, body Backup) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "backupName": autorest.Encode("path", backupName), + "poolName": autorest.Encode("path", poolName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "volumeName": autorest.Encode("path", volumeName), + } + + const APIVersion = "2021-04-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + body.ID = nil + body.Name = nil + body.Type = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/backups/{backupName}", pathParameters), + autorest.WithJSON(body), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateSender sends the Create request. The method will close the +// http.Response Body if it receives an error. +func (client BackupsClient) CreateSender(req *http.Request) (future BackupsCreateFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateResponder handles the response to the Create request. The method always +// closes the http.Response Body. +func (client BackupsClient) CreateResponder(resp *http.Response) (result Backup, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete delete a backup of the volume +// Parameters: +// resourceGroupName - the name of the resource group. +// accountName - the name of the NetApp account +// poolName - the name of the capacity pool +// volumeName - the name of the volume +// backupName - the name of the backup +func (client BackupsClient) Delete(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, backupName string) (result BackupsDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BackupsClient.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: poolName, + Constraints: []validation.Constraint{{Target: "poolName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "poolName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "poolName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}, + {TargetValue: volumeName, + Constraints: []validation.Constraint{{Target: "volumeName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "volumeName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "volumeName", Name: validation.Pattern, Rule: `^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("netapp.BackupsClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, accountName, poolName, volumeName, backupName) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.BackupsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.BackupsClient", "Delete", nil, "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client BackupsClient) DeletePreparer(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, backupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "backupName": autorest.Encode("path", backupName), + "poolName": autorest.Encode("path", poolName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "volumeName": autorest.Encode("path", volumeName), + } + + const APIVersion = "2021-04-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/backups/{backupName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client BackupsClient) DeleteSender(req *http.Request) (future BackupsDeleteFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client BackupsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets the specified backup of the volume +// Parameters: +// resourceGroupName - the name of the resource group. +// accountName - the name of the NetApp account +// poolName - the name of the capacity pool +// volumeName - the name of the volume +// backupName - the name of the backup +func (client BackupsClient) Get(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, backupName string) (result Backup, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BackupsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: poolName, + Constraints: []validation.Constraint{{Target: "poolName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "poolName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "poolName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}, + {TargetValue: volumeName, + Constraints: []validation.Constraint{{Target: "volumeName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "volumeName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "volumeName", Name: validation.Pattern, Rule: `^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("netapp.BackupsClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, accountName, poolName, volumeName, backupName) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.BackupsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "netapp.BackupsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.BackupsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client BackupsClient) GetPreparer(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, backupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "backupName": autorest.Encode("path", backupName), + "poolName": autorest.Encode("path", poolName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "volumeName": autorest.Encode("path", volumeName), + } + + const APIVersion = "2021-04-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/backups/{backupName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client BackupsClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client BackupsClient) GetResponder(resp *http.Response) (result Backup, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetStatus get the status of the backup for a volume +// Parameters: +// resourceGroupName - the name of the resource group. +// accountName - the name of the NetApp account +// poolName - the name of the capacity pool +// volumeName - the name of the volume +func (client BackupsClient) GetStatus(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string) (result BackupStatus, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BackupsClient.GetStatus") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: poolName, + Constraints: []validation.Constraint{{Target: "poolName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "poolName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "poolName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}, + {TargetValue: volumeName, + Constraints: []validation.Constraint{{Target: "volumeName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "volumeName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "volumeName", Name: validation.Pattern, Rule: `^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("netapp.BackupsClient", "GetStatus", err.Error()) + } + + req, err := client.GetStatusPreparer(ctx, resourceGroupName, accountName, poolName, volumeName) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.BackupsClient", "GetStatus", nil, "Failure preparing request") + return + } + + resp, err := client.GetStatusSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "netapp.BackupsClient", "GetStatus", resp, "Failure sending request") + return + } + + result, err = client.GetStatusResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.BackupsClient", "GetStatus", resp, "Failure responding to request") + return + } + + return +} + +// GetStatusPreparer prepares the GetStatus request. +func (client BackupsClient) GetStatusPreparer(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "poolName": autorest.Encode("path", poolName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "volumeName": autorest.Encode("path", volumeName), + } + + const APIVersion = "2021-04-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/backupStatus", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetStatusSender sends the GetStatus request. The method will close the +// http.Response Body if it receives an error. +func (client BackupsClient) GetStatusSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetStatusResponder handles the response to the GetStatus request. The method always +// closes the http.Response Body. +func (client BackupsClient) GetStatusResponder(resp *http.Response) (result BackupStatus, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List list all backups for a volume +// Parameters: +// resourceGroupName - the name of the resource group. +// accountName - the name of the NetApp account +// poolName - the name of the capacity pool +// volumeName - the name of the volume +func (client BackupsClient) List(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string) (result BackupsList, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BackupsClient.List") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: poolName, + Constraints: []validation.Constraint{{Target: "poolName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "poolName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "poolName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}, + {TargetValue: volumeName, + Constraints: []validation.Constraint{{Target: "volumeName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "volumeName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "volumeName", Name: validation.Pattern, Rule: `^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("netapp.BackupsClient", "List", err.Error()) + } + + req, err := client.ListPreparer(ctx, resourceGroupName, accountName, poolName, volumeName) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.BackupsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "netapp.BackupsClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.BackupsClient", "List", resp, "Failure responding to request") + return + } + + return +} + +// ListPreparer prepares the List request. +func (client BackupsClient) ListPreparer(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "poolName": autorest.Encode("path", poolName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "volumeName": autorest.Encode("path", volumeName), + } + + const APIVersion = "2021-04-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/backups", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client BackupsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client BackupsClient) ListResponder(resp *http.Response) (result BackupsList, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Update patch a backup for the volume +// Parameters: +// resourceGroupName - the name of the resource group. +// accountName - the name of the NetApp account +// poolName - the name of the capacity pool +// volumeName - the name of the volume +// backupName - the name of the backup +// body - backup object supplied in the body of the operation. +func (client BackupsClient) Update(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, backupName string, body *BackupPatch) (result BackupsUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BackupsClient.Update") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: poolName, + Constraints: []validation.Constraint{{Target: "poolName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "poolName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "poolName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}, + {TargetValue: volumeName, + Constraints: []validation.Constraint{{Target: "volumeName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "volumeName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "volumeName", Name: validation.Pattern, Rule: `^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("netapp.BackupsClient", "Update", err.Error()) + } + + req, err := client.UpdatePreparer(ctx, resourceGroupName, accountName, poolName, volumeName, backupName, body) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.BackupsClient", "Update", nil, "Failure preparing request") + return + } + + result, err = client.UpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.BackupsClient", "Update", nil, "Failure sending request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client BackupsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, backupName string, body *BackupPatch) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "backupName": autorest.Encode("path", backupName), + "poolName": autorest.Encode("path", poolName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "volumeName": autorest.Encode("path", volumeName), + } + + const APIVersion = "2021-04-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/backups/{backupName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + if body != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithJSON(body)) + } + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client BackupsClient) UpdateSender(req *http.Request) (future BackupsUpdateFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client BackupsClient) UpdateResponder(resp *http.Response) (result Backup, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/preview/netapp/mgmt/2021-04-01-preview/netapp/client.go b/services/preview/netapp/mgmt/2021-04-01-preview/netapp/client.go new file mode 100644 index 000000000000..e18bf974929b --- /dev/null +++ b/services/preview/netapp/mgmt/2021-04-01-preview/netapp/client.go @@ -0,0 +1,41 @@ +// Package netapp implements the Azure ARM Netapp service API version 2021-04-01-preview. +// +// Microsoft NetApp Files Azure Resource Provider specification +package netapp + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" +) + +const ( + // DefaultBaseURI is the default URI used for the service Netapp + DefaultBaseURI = "https://management.azure.com" +) + +// BaseClient is the base client for Netapp. +type BaseClient struct { + autorest.Client + BaseURI string + SubscriptionID string +} + +// New creates an instance of the BaseClient client. +func New(subscriptionID string) BaseClient { + return NewWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewWithBaseURI creates an instance of the BaseClient client using a custom endpoint. Use this when interacting with +// an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewWithBaseURI(baseURI string, subscriptionID string) BaseClient { + return BaseClient{ + Client: autorest.NewClientWithUserAgent(UserAgent()), + BaseURI: baseURI, + SubscriptionID: subscriptionID, + } +} diff --git a/services/preview/netapp/mgmt/2021-04-01-preview/netapp/enums.go b/services/preview/netapp/mgmt/2021-04-01-preview/netapp/enums.go new file mode 100644 index 000000000000..f2be670510ca --- /dev/null +++ b/services/preview/netapp/mgmt/2021-04-01-preview/netapp/enums.go @@ -0,0 +1,277 @@ +package netapp + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// ActiveDirectoryStatus enumerates the values for active directory status. +type ActiveDirectoryStatus string + +const ( + // Created Active Directory created but not in use + Created ActiveDirectoryStatus = "Created" + // Deleted Active Directory Deleted + Deleted ActiveDirectoryStatus = "Deleted" + // Error Error with the Active Directory + Error ActiveDirectoryStatus = "Error" + // InUse Active Directory in use by SMB Volume + InUse ActiveDirectoryStatus = "InUse" + // Updating Active Directory Updating + Updating ActiveDirectoryStatus = "Updating" +) + +// PossibleActiveDirectoryStatusValues returns an array of possible values for the ActiveDirectoryStatus const type. +func PossibleActiveDirectoryStatusValues() []ActiveDirectoryStatus { + return []ActiveDirectoryStatus{Created, Deleted, Error, InUse, Updating} +} + +// BackupType enumerates the values for backup type. +type BackupType string + +const ( + // Manual Manual backup + Manual BackupType = "Manual" + // Scheduled Scheduled backup + Scheduled BackupType = "Scheduled" +) + +// PossibleBackupTypeValues returns an array of possible values for the BackupType const type. +func PossibleBackupTypeValues() []BackupType { + return []BackupType{Manual, Scheduled} +} + +// CheckNameResourceTypes enumerates the values for check name resource types. +type CheckNameResourceTypes string + +const ( + // MicrosoftNetAppnetAppAccounts ... + MicrosoftNetAppnetAppAccounts CheckNameResourceTypes = "Microsoft.NetApp/netAppAccounts" + // MicrosoftNetAppnetAppAccountscapacityPools ... + MicrosoftNetAppnetAppAccountscapacityPools CheckNameResourceTypes = "Microsoft.NetApp/netAppAccounts/capacityPools" + // MicrosoftNetAppnetAppAccountscapacityPoolsvolumes ... + MicrosoftNetAppnetAppAccountscapacityPoolsvolumes CheckNameResourceTypes = "Microsoft.NetApp/netAppAccounts/capacityPools/volumes" + // MicrosoftNetAppnetAppAccountscapacityPoolsvolumessnapshots ... + MicrosoftNetAppnetAppAccountscapacityPoolsvolumessnapshots CheckNameResourceTypes = "Microsoft.NetApp/netAppAccounts/capacityPools/volumes/snapshots" +) + +// PossibleCheckNameResourceTypesValues returns an array of possible values for the CheckNameResourceTypes const type. +func PossibleCheckNameResourceTypesValues() []CheckNameResourceTypes { + return []CheckNameResourceTypes{MicrosoftNetAppnetAppAccounts, MicrosoftNetAppnetAppAccountscapacityPools, MicrosoftNetAppnetAppAccountscapacityPoolsvolumes, MicrosoftNetAppnetAppAccountscapacityPoolsvolumessnapshots} +} + +// CheckQuotaNameResourceTypes enumerates the values for check quota name resource types. +type CheckQuotaNameResourceTypes string + +const ( + // CheckQuotaNameResourceTypesMicrosoftNetAppnetAppAccounts ... + CheckQuotaNameResourceTypesMicrosoftNetAppnetAppAccounts CheckQuotaNameResourceTypes = "Microsoft.NetApp/netAppAccounts" + // CheckQuotaNameResourceTypesMicrosoftNetAppnetAppAccountscapacityPools ... + CheckQuotaNameResourceTypesMicrosoftNetAppnetAppAccountscapacityPools CheckQuotaNameResourceTypes = "Microsoft.NetApp/netAppAccounts/capacityPools" + // CheckQuotaNameResourceTypesMicrosoftNetAppnetAppAccountscapacityPoolsvolumes ... + CheckQuotaNameResourceTypesMicrosoftNetAppnetAppAccountscapacityPoolsvolumes CheckQuotaNameResourceTypes = "Microsoft.NetApp/netAppAccounts/capacityPools/volumes" + // CheckQuotaNameResourceTypesMicrosoftNetAppnetAppAccountscapacityPoolsvolumessnapshots ... + CheckQuotaNameResourceTypesMicrosoftNetAppnetAppAccountscapacityPoolsvolumessnapshots CheckQuotaNameResourceTypes = "Microsoft.NetApp/netAppAccounts/capacityPools/volumes/snapshots" +) + +// PossibleCheckQuotaNameResourceTypesValues returns an array of possible values for the CheckQuotaNameResourceTypes const type. +func PossibleCheckQuotaNameResourceTypesValues() []CheckQuotaNameResourceTypes { + return []CheckQuotaNameResourceTypes{CheckQuotaNameResourceTypesMicrosoftNetAppnetAppAccounts, CheckQuotaNameResourceTypesMicrosoftNetAppnetAppAccountscapacityPools, CheckQuotaNameResourceTypesMicrosoftNetAppnetAppAccountscapacityPoolsvolumes, CheckQuotaNameResourceTypesMicrosoftNetAppnetAppAccountscapacityPoolsvolumessnapshots} +} + +// CreatedByType enumerates the values for created by type. +type CreatedByType string + +const ( + // Application ... + Application CreatedByType = "Application" + // Key ... + Key CreatedByType = "Key" + // ManagedIdentity ... + ManagedIdentity CreatedByType = "ManagedIdentity" + // User ... + User CreatedByType = "User" +) + +// PossibleCreatedByTypeValues returns an array of possible values for the CreatedByType const type. +func PossibleCreatedByTypeValues() []CreatedByType { + return []CreatedByType{Application, Key, ManagedIdentity, User} +} + +// EndpointType enumerates the values for endpoint type. +type EndpointType string + +const ( + // Dst ... + Dst EndpointType = "dst" + // Src ... + Src EndpointType = "src" +) + +// PossibleEndpointTypeValues returns an array of possible values for the EndpointType const type. +func PossibleEndpointTypeValues() []EndpointType { + return []EndpointType{Dst, Src} +} + +// InAvailabilityReasonType enumerates the values for in availability reason type. +type InAvailabilityReasonType string + +const ( + // AlreadyExists ... + AlreadyExists InAvailabilityReasonType = "AlreadyExists" + // Invalid ... + Invalid InAvailabilityReasonType = "Invalid" +) + +// PossibleInAvailabilityReasonTypeValues returns an array of possible values for the InAvailabilityReasonType const type. +func PossibleInAvailabilityReasonTypeValues() []InAvailabilityReasonType { + return []InAvailabilityReasonType{AlreadyExists, Invalid} +} + +// MirrorState enumerates the values for mirror state. +type MirrorState string + +const ( + // Broken ... + Broken MirrorState = "Broken" + // Mirrored ... + Mirrored MirrorState = "Mirrored" + // Uninitialized ... + Uninitialized MirrorState = "Uninitialized" +) + +// PossibleMirrorStateValues returns an array of possible values for the MirrorState const type. +func PossibleMirrorStateValues() []MirrorState { + return []MirrorState{Broken, Mirrored, Uninitialized} +} + +// NetworkFeatures enumerates the values for network features. +type NetworkFeatures string + +const ( + // Basic Basic network feature. + Basic NetworkFeatures = "Basic" + // Standard Standard network feature. + Standard NetworkFeatures = "Standard" +) + +// PossibleNetworkFeaturesValues returns an array of possible values for the NetworkFeatures const type. +func PossibleNetworkFeaturesValues() []NetworkFeatures { + return []NetworkFeatures{Basic, Standard} +} + +// QosType enumerates the values for qos type. +type QosType string + +const ( + // QosTypeAuto qos type Auto + QosTypeAuto QosType = "Auto" + // QosTypeManual qos type Manual + QosTypeManual QosType = "Manual" +) + +// PossibleQosTypeValues returns an array of possible values for the QosType const type. +func PossibleQosTypeValues() []QosType { + return []QosType{QosTypeAuto, QosTypeManual} +} + +// RegionStorageToNetworkProximity enumerates the values for region storage to network proximity. +type RegionStorageToNetworkProximity string + +const ( + // Default Basic network connectivity. + Default RegionStorageToNetworkProximity = "Default" + // T1 Standard T1 network connectivity. + T1 RegionStorageToNetworkProximity = "T1" + // T1AndT2 Standard T1 and T2 network connectivity. + T1AndT2 RegionStorageToNetworkProximity = "T1AndT2" + // T2 Standard T2 network connectivity. + T2 RegionStorageToNetworkProximity = "T2" +) + +// PossibleRegionStorageToNetworkProximityValues returns an array of possible values for the RegionStorageToNetworkProximity const type. +func PossibleRegionStorageToNetworkProximityValues() []RegionStorageToNetworkProximity { + return []RegionStorageToNetworkProximity{Default, T1, T1AndT2, T2} +} + +// RelationshipStatus enumerates the values for relationship status. +type RelationshipStatus string + +const ( + // Idle ... + Idle RelationshipStatus = "Idle" + // Transferring ... + Transferring RelationshipStatus = "Transferring" +) + +// PossibleRelationshipStatusValues returns an array of possible values for the RelationshipStatus const type. +func PossibleRelationshipStatusValues() []RelationshipStatus { + return []RelationshipStatus{Idle, Transferring} +} + +// ReplicationSchedule enumerates the values for replication schedule. +type ReplicationSchedule string + +const ( + // OneZerominutely ... + OneZerominutely ReplicationSchedule = "_10minutely" + // Daily ... + Daily ReplicationSchedule = "daily" + // Hourly ... + Hourly ReplicationSchedule = "hourly" +) + +// PossibleReplicationScheduleValues returns an array of possible values for the ReplicationSchedule const type. +func PossibleReplicationScheduleValues() []ReplicationSchedule { + return []ReplicationSchedule{OneZerominutely, Daily, Hourly} +} + +// SecurityStyle enumerates the values for security style. +type SecurityStyle string + +const ( + // Ntfs ... + Ntfs SecurityStyle = "ntfs" + // Unix ... + Unix SecurityStyle = "unix" +) + +// PossibleSecurityStyleValues returns an array of possible values for the SecurityStyle const type. +func PossibleSecurityStyleValues() []SecurityStyle { + return []SecurityStyle{Ntfs, Unix} +} + +// ServiceLevel enumerates the values for service level. +type ServiceLevel string + +const ( + // ServiceLevelPremium Premium service level + ServiceLevelPremium ServiceLevel = "Premium" + // ServiceLevelStandard Standard service level + ServiceLevelStandard ServiceLevel = "Standard" + // ServiceLevelUltra Ultra service level + ServiceLevelUltra ServiceLevel = "Ultra" +) + +// PossibleServiceLevelValues returns an array of possible values for the ServiceLevel const type. +func PossibleServiceLevelValues() []ServiceLevel { + return []ServiceLevel{ServiceLevelPremium, ServiceLevelStandard, ServiceLevelUltra} +} + +// VolumeStorageToNetworkProximity enumerates the values for volume storage to network proximity. +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 an array of possible values for the VolumeStorageToNetworkProximity const type. +func PossibleVolumeStorageToNetworkProximityValues() []VolumeStorageToNetworkProximity { + return []VolumeStorageToNetworkProximity{VolumeStorageToNetworkProximityDefault, VolumeStorageToNetworkProximityT1, VolumeStorageToNetworkProximityT2} +} diff --git a/services/preview/netapp/mgmt/2021-04-01-preview/netapp/models.go b/services/preview/netapp/mgmt/2021-04-01-preview/netapp/models.go new file mode 100644 index 000000000000..123f31f1176a --- /dev/null +++ b/services/preview/netapp/mgmt/2021-04-01-preview/netapp/models.go @@ -0,0 +1,4195 @@ +package netapp + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "encoding/json" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/date" + "github.com/Azure/go-autorest/autorest/to" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// The package's fully qualified name. +const fqdn = "github.com/Azure/azure-sdk-for-go/services/preview/netapp/mgmt/2021-04-01-preview/netapp" + +// Account netApp account resource +type Account struct { + autorest.Response `json:"-"` + // Location - Resource location + Location *string `json:"location,omitempty"` + // ID - READ-ONLY; Resource Id + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type + Type *string `json:"type,omitempty"` + // Tags - Resource tags + Tags map[string]*string `json:"tags"` + // AccountProperties - NetApp Account properties + *AccountProperties `json:"properties,omitempty"` + // SystemData - READ-ONLY; The system meta data relating to this resource. + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for Account. +func (a Account) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if a.Location != nil { + objectMap["location"] = a.Location + } + if a.Tags != nil { + objectMap["tags"] = a.Tags + } + if a.AccountProperties != nil { + objectMap["properties"] = a.AccountProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for Account struct. +func (a *Account) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + a.Location = &location + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + a.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + a.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + a.Type = &typeVar + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + a.Tags = tags + } + case "properties": + if v != nil { + var accountProperties AccountProperties + err = json.Unmarshal(*v, &accountProperties) + if err != nil { + return err + } + a.AccountProperties = &accountProperties + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + a.SystemData = &systemData + } + } + } + + return nil +} + +// AccountBackupsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type AccountBackupsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(AccountBackupsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *AccountBackupsDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for AccountBackupsDeleteFuture.Result. +func (future *AccountBackupsDeleteFuture) result(client AccountBackupsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.AccountBackupsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("netapp.AccountBackupsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// AccountEncryption encryption settings +type AccountEncryption struct { + // KeySource - Encryption Key Source. Possible values are: 'Microsoft.NetApp'. + KeySource *string `json:"keySource,omitempty"` +} + +// AccountList list of NetApp account resources +type AccountList struct { + autorest.Response `json:"-"` + // Value - Multiple NetApp accounts + Value *[]Account `json:"value,omitempty"` + // NextLink - URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// AccountListIterator provides access to a complete listing of Account values. +type AccountListIterator struct { + i int + page AccountListPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *AccountListIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AccountListIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *AccountListIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter AccountListIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter AccountListIterator) Response() AccountList { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter AccountListIterator) Value() Account { + if !iter.page.NotDone() { + return Account{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the AccountListIterator type. +func NewAccountListIterator(page AccountListPage) AccountListIterator { + return AccountListIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (al AccountList) IsEmpty() bool { + return al.Value == nil || len(*al.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (al AccountList) hasNextLink() bool { + return al.NextLink != nil && len(*al.NextLink) != 0 +} + +// accountListPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (al AccountList) accountListPreparer(ctx context.Context) (*http.Request, error) { + if !al.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(al.NextLink))) +} + +// AccountListPage contains a page of Account values. +type AccountListPage struct { + fn func(context.Context, AccountList) (AccountList, error) + al AccountList +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *AccountListPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AccountListPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.al) + if err != nil { + return err + } + page.al = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *AccountListPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page AccountListPage) NotDone() bool { + return !page.al.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page AccountListPage) Response() AccountList { + return page.al +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page AccountListPage) Values() []Account { + if page.al.IsEmpty() { + return nil + } + return *page.al.Value +} + +// Creates a new instance of the AccountListPage type. +func NewAccountListPage(cur AccountList, getNextPage func(context.Context, AccountList) (AccountList, error)) AccountListPage { + return AccountListPage{ + fn: getNextPage, + al: cur, + } +} + +// AccountPatch netApp account patch resource +type AccountPatch struct { + // Location - Resource location + Location *string `json:"location,omitempty"` + // ID - READ-ONLY; Resource Id + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type + Type *string `json:"type,omitempty"` + // Tags - Resource tags + Tags map[string]*string `json:"tags"` + // AccountProperties - NetApp Account properties + *AccountProperties `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for AccountPatch. +func (ap AccountPatch) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ap.Location != nil { + objectMap["location"] = ap.Location + } + if ap.Tags != nil { + objectMap["tags"] = ap.Tags + } + if ap.AccountProperties != nil { + objectMap["properties"] = ap.AccountProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for AccountPatch struct. +func (ap *AccountPatch) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + ap.Location = &location + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + ap.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + ap.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + ap.Type = &typeVar + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + ap.Tags = tags + } + case "properties": + if v != nil { + var accountProperties AccountProperties + err = json.Unmarshal(*v, &accountProperties) + if err != nil { + return err + } + ap.AccountProperties = &accountProperties + } + } + } + + return nil +} + +// AccountProperties netApp account properties +type AccountProperties struct { + // ProvisioningState - READ-ONLY; Azure lifecycle management + ProvisioningState *string `json:"provisioningState,omitempty"` + // ActiveDirectories - Active Directories + ActiveDirectories *[]ActiveDirectory `json:"activeDirectories,omitempty"` + // Encryption - Encryption settings + Encryption *AccountEncryption `json:"encryption,omitempty"` +} + +// MarshalJSON is the custom marshaler for AccountProperties. +func (ap AccountProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ap.ActiveDirectories != nil { + objectMap["activeDirectories"] = ap.ActiveDirectories + } + if ap.Encryption != nil { + objectMap["encryption"] = ap.Encryption + } + return json.Marshal(objectMap) +} + +// AccountsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type AccountsCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(AccountsClient) (Account, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *AccountsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for AccountsCreateOrUpdateFuture.Result. +func (future *AccountsCreateOrUpdateFuture) result(client AccountsClient) (a Account, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.AccountsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + a.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("netapp.AccountsCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if a.Response.Response, err = future.GetResult(sender); err == nil && a.Response.Response.StatusCode != http.StatusNoContent { + a, err = client.CreateOrUpdateResponder(a.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.AccountsCreateOrUpdateFuture", "Result", a.Response.Response, "Failure responding to request") + } + } + return +} + +// AccountsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type AccountsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(AccountsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *AccountsDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for AccountsDeleteFuture.Result. +func (future *AccountsDeleteFuture) result(client AccountsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.AccountsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("netapp.AccountsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// AccountsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type AccountsUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(AccountsClient) (Account, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *AccountsUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for AccountsUpdateFuture.Result. +func (future *AccountsUpdateFuture) result(client AccountsClient) (a Account, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.AccountsUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + a.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("netapp.AccountsUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if a.Response.Response, err = future.GetResult(sender); err == nil && a.Response.Response.StatusCode != http.StatusNoContent { + a, err = client.UpdateResponder(a.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.AccountsUpdateFuture", "Result", a.Response.Response, "Failure responding to request") + } + } + return +} + +// ActiveDirectory active Directory +type ActiveDirectory struct { + // ActiveDirectoryID - Id of the Active Directory + ActiveDirectoryID *string `json:"activeDirectoryId,omitempty"` + // Username - Username of Active Directory domain administrator + Username *string `json:"username,omitempty"` + // Password - Plain text password of Active Directory domain administrator, value is masked in the response + Password *string `json:"password,omitempty"` + // Domain - Name of the Active Directory domain + Domain *string `json:"domain,omitempty"` + // DNS - Comma separated list of DNS server IP addresses (IPv4 only) for the Active Directory domain + DNS *string `json:"dns,omitempty"` + // Status - READ-ONLY; Status of the Active Directory. Possible values include: 'Created', 'InUse', 'Deleted', 'Error', 'Updating' + Status ActiveDirectoryStatus `json:"status,omitempty"` + // StatusDetails - READ-ONLY; Any details in regards to the Status of the Active Directory + StatusDetails *string `json:"statusDetails,omitempty"` + // SmbServerName - 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"` + // OrganizationalUnit - The Organizational Unit (OU) within the Windows Active Directory + OrganizationalUnit *string `json:"organizationalUnit,omitempty"` + // Site - The Active Directory site the service will limit Domain Controller discovery to + Site *string `json:"site,omitempty"` + // BackupOperators - 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"` + // KdcIP - kdc server IP addresses for the active directory machine. This optional parameter is used only while creating kerberos volume. + KdcIP *string `json:"kdcIP,omitempty"` + // AdName - Name of the active directory machine. This optional parameter is used only while creating kerberos volume + AdName *string `json:"adName,omitempty"` + // ServerRootCACertificate - 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"` + // AesEncryption - If enabled, AES encryption will be enabled for SMB communication. + AesEncryption *bool `json:"aesEncryption,omitempty"` + // LdapSigning - Specifies whether or not the LDAP traffic needs to be signed. + LdapSigning *bool `json:"ldapSigning,omitempty"` + // SecurityOperators - 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"` + // LdapOverTLS - Specifies whether or not the LDAP traffic needs to be secured via TLS. + LdapOverTLS *bool `json:"ldapOverTLS,omitempty"` + // AllowLocalNfsUsersWithLdap - If enabled, NFS client local users can also (in addition to LDAP users) access the NFS volumes. + AllowLocalNfsUsersWithLdap *bool `json:"allowLocalNfsUsersWithLdap,omitempty"` +} + +// MarshalJSON is the custom marshaler for ActiveDirectory. +func (ad ActiveDirectory) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ad.ActiveDirectoryID != nil { + objectMap["activeDirectoryId"] = ad.ActiveDirectoryID + } + if ad.Username != nil { + objectMap["username"] = ad.Username + } + if ad.Password != nil { + objectMap["password"] = ad.Password + } + if ad.Domain != nil { + objectMap["domain"] = ad.Domain + } + if ad.DNS != nil { + objectMap["dns"] = ad.DNS + } + if ad.SmbServerName != nil { + objectMap["smbServerName"] = ad.SmbServerName + } + if ad.OrganizationalUnit != nil { + objectMap["organizationalUnit"] = ad.OrganizationalUnit + } + if ad.Site != nil { + objectMap["site"] = ad.Site + } + if ad.BackupOperators != nil { + objectMap["backupOperators"] = ad.BackupOperators + } + if ad.KdcIP != nil { + objectMap["kdcIP"] = ad.KdcIP + } + if ad.AdName != nil { + objectMap["adName"] = ad.AdName + } + if ad.ServerRootCACertificate != nil { + objectMap["serverRootCACertificate"] = ad.ServerRootCACertificate + } + if ad.AesEncryption != nil { + objectMap["aesEncryption"] = ad.AesEncryption + } + if ad.LdapSigning != nil { + objectMap["ldapSigning"] = ad.LdapSigning + } + if ad.SecurityOperators != nil { + objectMap["securityOperators"] = ad.SecurityOperators + } + if ad.LdapOverTLS != nil { + objectMap["ldapOverTLS"] = ad.LdapOverTLS + } + if ad.AllowLocalNfsUsersWithLdap != nil { + objectMap["allowLocalNfsUsersWithLdap"] = ad.AllowLocalNfsUsersWithLdap + } + return json.Marshal(objectMap) +} + +// AuthorizeRequest authorize request +type AuthorizeRequest struct { + // RemoteVolumeResourceID - Resource id of the remote volume + RemoteVolumeResourceID *string `json:"remoteVolumeResourceId,omitempty"` +} + +// Backup backup of a Volume +type Backup struct { + autorest.Response `json:"-"` + // Location - Resource location + Location *string `json:"location,omitempty"` + // ID - READ-ONLY; Resource Id + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type + Type *string `json:"type,omitempty"` + // BackupProperties - Backup Properties + *BackupProperties `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for Backup. +func (b Backup) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if b.Location != nil { + objectMap["location"] = b.Location + } + if b.BackupProperties != nil { + objectMap["properties"] = b.BackupProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for Backup struct. +func (b *Backup) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + b.Location = &location + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + b.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + b.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + b.Type = &typeVar + } + case "properties": + if v != nil { + var backupProperties BackupProperties + err = json.Unmarshal(*v, &backupProperties) + if err != nil { + return err + } + b.BackupProperties = &backupProperties + } + } + } + + return nil +} + +// BackupPatch backup patch +type BackupPatch struct { + // Tags - Resource tags + Tags map[string]*string `json:"tags"` + // BackupProperties - Backup Properties + *BackupProperties `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for BackupPatch. +func (bp BackupPatch) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if bp.Tags != nil { + objectMap["tags"] = bp.Tags + } + if bp.BackupProperties != nil { + objectMap["properties"] = bp.BackupProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for BackupPatch struct. +func (bp *BackupPatch) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + bp.Tags = tags + } + case "properties": + if v != nil { + var backupProperties BackupProperties + err = json.Unmarshal(*v, &backupProperties) + if err != nil { + return err + } + bp.BackupProperties = &backupProperties + } + } + } + + return nil +} + +// BackupPoliciesCreateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type BackupPoliciesCreateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(BackupPoliciesClient) (BackupPolicy, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *BackupPoliciesCreateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for BackupPoliciesCreateFuture.Result. +func (future *BackupPoliciesCreateFuture) result(client BackupPoliciesClient) (bp BackupPolicy, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.BackupPoliciesCreateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + bp.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("netapp.BackupPoliciesCreateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if bp.Response.Response, err = future.GetResult(sender); err == nil && bp.Response.Response.StatusCode != http.StatusNoContent { + bp, err = client.CreateResponder(bp.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.BackupPoliciesCreateFuture", "Result", bp.Response.Response, "Failure responding to request") + } + } + return +} + +// BackupPoliciesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type BackupPoliciesDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(BackupPoliciesClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *BackupPoliciesDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for BackupPoliciesDeleteFuture.Result. +func (future *BackupPoliciesDeleteFuture) result(client BackupPoliciesClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.BackupPoliciesDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("netapp.BackupPoliciesDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// BackupPoliciesList list of Backup Policies +type BackupPoliciesList struct { + autorest.Response `json:"-"` + // Value - A list of backup policies + Value *[]BackupPolicy `json:"value,omitempty"` +} + +// BackupPoliciesUpdateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type BackupPoliciesUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(BackupPoliciesClient) (BackupPolicy, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *BackupPoliciesUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for BackupPoliciesUpdateFuture.Result. +func (future *BackupPoliciesUpdateFuture) result(client BackupPoliciesClient) (bp BackupPolicy, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.BackupPoliciesUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + bp.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("netapp.BackupPoliciesUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if bp.Response.Response, err = future.GetResult(sender); err == nil && bp.Response.Response.StatusCode != http.StatusNoContent { + bp, err = client.UpdateResponder(bp.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.BackupPoliciesUpdateFuture", "Result", bp.Response.Response, "Failure responding to request") + } + } + return +} + +// BackupPolicy backup policy information +type BackupPolicy struct { + autorest.Response `json:"-"` + // Location - Resource location + Location *string `json:"location,omitempty"` + // ID - READ-ONLY; Resource Id + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type + Type *string `json:"type,omitempty"` + // Tags - Resource tags + Tags map[string]*string `json:"tags"` + // BackupPolicyProperties - Backup policy Properties + *BackupPolicyProperties `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for BackupPolicy. +func (bp BackupPolicy) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if bp.Location != nil { + objectMap["location"] = bp.Location + } + if bp.Tags != nil { + objectMap["tags"] = bp.Tags + } + if bp.BackupPolicyProperties != nil { + objectMap["properties"] = bp.BackupPolicyProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for BackupPolicy struct. +func (bp *BackupPolicy) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + bp.Location = &location + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + bp.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + bp.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + bp.Type = &typeVar + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + bp.Tags = tags + } + case "properties": + if v != nil { + var backupPolicyProperties BackupPolicyProperties + err = json.Unmarshal(*v, &backupPolicyProperties) + if err != nil { + return err + } + bp.BackupPolicyProperties = &backupPolicyProperties + } + } + } + + return nil +} + +// BackupPolicyDetails backup policy properties +type BackupPolicyDetails struct { + // Location - Resource location + Location *string `json:"location,omitempty"` + // ID - READ-ONLY; Resource Id + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type + Type *string `json:"type,omitempty"` + // Tags - Resource tags + Tags map[string]*string `json:"tags"` + // BackupPolicyProperties - Backup policy Properties + *BackupPolicyProperties `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for BackupPolicyDetails. +func (bpd BackupPolicyDetails) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if bpd.Location != nil { + objectMap["location"] = bpd.Location + } + if bpd.Tags != nil { + objectMap["tags"] = bpd.Tags + } + if bpd.BackupPolicyProperties != nil { + objectMap["properties"] = bpd.BackupPolicyProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for BackupPolicyDetails struct. +func (bpd *BackupPolicyDetails) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + bpd.Location = &location + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + bpd.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + bpd.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + bpd.Type = &typeVar + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + bpd.Tags = tags + } + case "properties": + if v != nil { + var backupPolicyProperties BackupPolicyProperties + err = json.Unmarshal(*v, &backupPolicyProperties) + if err != nil { + return err + } + bpd.BackupPolicyProperties = &backupPolicyProperties + } + } + } + + return nil +} + +// BackupPolicyPatch backup policy Details for create and update +type BackupPolicyPatch struct { + // Location - Resource location + Location *string `json:"location,omitempty"` + // ID - READ-ONLY; Resource Id + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type + Type *string `json:"type,omitempty"` + // Tags - Resource tags + Tags map[string]*string `json:"tags"` + // BackupPolicyProperties - Backup policy Properties + *BackupPolicyProperties `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for BackupPolicyPatch. +func (bpp BackupPolicyPatch) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if bpp.Location != nil { + objectMap["location"] = bpp.Location + } + if bpp.Tags != nil { + objectMap["tags"] = bpp.Tags + } + if bpp.BackupPolicyProperties != nil { + objectMap["properties"] = bpp.BackupPolicyProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for BackupPolicyPatch struct. +func (bpp *BackupPolicyPatch) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + bpp.Location = &location + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + bpp.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + bpp.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + bpp.Type = &typeVar + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + bpp.Tags = tags + } + case "properties": + if v != nil { + var backupPolicyProperties BackupPolicyProperties + err = json.Unmarshal(*v, &backupPolicyProperties) + if err != nil { + return err + } + bpp.BackupPolicyProperties = &backupPolicyProperties + } + } + } + + return nil +} + +// BackupPolicyProperties backup policy properties +type BackupPolicyProperties struct { + // Name - READ-ONLY; Name of backup policy + Name *string `json:"name,omitempty"` + // ProvisioningState - READ-ONLY; Azure lifecycle management + ProvisioningState *string `json:"provisioningState,omitempty"` + // DailyBackupsToKeep - Daily backups count to keep + DailyBackupsToKeep *int32 `json:"dailyBackupsToKeep,omitempty"` + // WeeklyBackupsToKeep - Weekly backups count to keep + WeeklyBackupsToKeep *int32 `json:"weeklyBackupsToKeep,omitempty"` + // MonthlyBackupsToKeep - Monthly backups count to keep + MonthlyBackupsToKeep *int32 `json:"monthlyBackupsToKeep,omitempty"` + // YearlyBackupsToKeep - Yearly backups count to keep + YearlyBackupsToKeep *int32 `json:"yearlyBackupsToKeep,omitempty"` + // VolumesAssigned - Volumes using current backup policy + VolumesAssigned *int32 `json:"volumesAssigned,omitempty"` + // Enabled - The property to decide policy is enabled or not + Enabled *bool `json:"enabled,omitempty"` + // VolumeBackups - A list of volumes assigned to this policy + VolumeBackups *[]VolumeBackups `json:"volumeBackups,omitempty"` +} + +// MarshalJSON is the custom marshaler for BackupPolicyProperties. +func (bpp BackupPolicyProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if bpp.DailyBackupsToKeep != nil { + objectMap["dailyBackupsToKeep"] = bpp.DailyBackupsToKeep + } + if bpp.WeeklyBackupsToKeep != nil { + objectMap["weeklyBackupsToKeep"] = bpp.WeeklyBackupsToKeep + } + if bpp.MonthlyBackupsToKeep != nil { + objectMap["monthlyBackupsToKeep"] = bpp.MonthlyBackupsToKeep + } + if bpp.YearlyBackupsToKeep != nil { + objectMap["yearlyBackupsToKeep"] = bpp.YearlyBackupsToKeep + } + if bpp.VolumesAssigned != nil { + objectMap["volumesAssigned"] = bpp.VolumesAssigned + } + if bpp.Enabled != nil { + objectMap["enabled"] = bpp.Enabled + } + if bpp.VolumeBackups != nil { + objectMap["volumeBackups"] = bpp.VolumeBackups + } + return json.Marshal(objectMap) +} + +// BackupProperties backup properties +type BackupProperties struct { + // BackupID - READ-ONLY; UUID v4 used to identify the Backup + BackupID *string `json:"backupId,omitempty"` + // CreationDate - READ-ONLY; The creation date of the backup + CreationDate *date.Time `json:"creationDate,omitempty"` + // ProvisioningState - READ-ONLY; Azure lifecycle management + ProvisioningState *string `json:"provisioningState,omitempty"` + // Size - READ-ONLY; Size of backup + Size *int64 `json:"size,omitempty"` + // Label - Label for backup + Label *string `json:"label,omitempty"` + // BackupType - READ-ONLY; Type of backup Manual or Scheduled. Possible values include: 'Manual', 'Scheduled' + BackupType BackupType `json:"backupType,omitempty"` + // FailureReason - READ-ONLY; Failure reason + FailureReason *string `json:"failureReason,omitempty"` + // VolumeName - READ-ONLY; Volume name + VolumeName *string `json:"volumeName,omitempty"` + // UseExistingSnapshot - 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"` +} + +// MarshalJSON is the custom marshaler for BackupProperties. +func (bp BackupProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if bp.Label != nil { + objectMap["label"] = bp.Label + } + if bp.UseExistingSnapshot != nil { + objectMap["useExistingSnapshot"] = bp.UseExistingSnapshot + } + return json.Marshal(objectMap) +} + +// BackupsCreateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type BackupsCreateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(BackupsClient) (Backup, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *BackupsCreateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for BackupsCreateFuture.Result. +func (future *BackupsCreateFuture) result(client BackupsClient) (b Backup, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.BackupsCreateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + b.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("netapp.BackupsCreateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if b.Response.Response, err = future.GetResult(sender); err == nil && b.Response.Response.StatusCode != http.StatusNoContent { + b, err = client.CreateResponder(b.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.BackupsCreateFuture", "Result", b.Response.Response, "Failure responding to request") + } + } + return +} + +// BackupsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type BackupsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(BackupsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *BackupsDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for BackupsDeleteFuture.Result. +func (future *BackupsDeleteFuture) result(client BackupsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.BackupsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("netapp.BackupsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// BackupsList list of Backups +type BackupsList struct { + autorest.Response `json:"-"` + // Value - A list of Backups + Value *[]Backup `json:"value,omitempty"` +} + +// BackupStatus backup status +type BackupStatus struct { + autorest.Response `json:"-"` + // Healthy - READ-ONLY; Backup health status + Healthy *bool `json:"healthy,omitempty"` + // RelationshipStatus - READ-ONLY; Status of the backup mirror relationship. Possible values include: 'Idle', 'Transferring' + RelationshipStatus RelationshipStatus `json:"relationshipStatus,omitempty"` + // MirrorState - READ-ONLY; The status of the backup. Possible values include: 'Uninitialized', 'Mirrored', 'Broken' + MirrorState MirrorState `json:"mirrorState,omitempty"` + // UnhealthyReason - READ-ONLY; Reason for the unhealthy backup relationship + UnhealthyReason *string `json:"unhealthyReason,omitempty"` + // ErrorMessage - READ-ONLY; Displays error message if the backup is in an error state + ErrorMessage *string `json:"errorMessage,omitempty"` +} + +// MarshalJSON is the custom marshaler for BackupStatus. +func (bs BackupStatus) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// BackupsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type BackupsUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(BackupsClient) (Backup, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *BackupsUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for BackupsUpdateFuture.Result. +func (future *BackupsUpdateFuture) result(client BackupsClient) (b Backup, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.BackupsUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + b.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("netapp.BackupsUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if b.Response.Response, err = future.GetResult(sender); err == nil && b.Response.Response.StatusCode != http.StatusNoContent { + b, err = client.UpdateResponder(b.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.BackupsUpdateFuture", "Result", b.Response.Response, "Failure responding to request") + } + } + return +} + +// BreakReplicationRequest break replication request +type BreakReplicationRequest struct { + // ForceBreakReplication - 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 { + autorest.Response `json:"-"` + // Location - Resource location + Location *string `json:"location,omitempty"` + // ID - READ-ONLY; Resource Id + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type + Type *string `json:"type,omitempty"` + // Tags - Resource tags + Tags map[string]*string `json:"tags"` + // PoolProperties - Capacity pool properties + *PoolProperties `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for CapacityPool. +func (cp CapacityPool) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if cp.Location != nil { + objectMap["location"] = cp.Location + } + if cp.Tags != nil { + objectMap["tags"] = cp.Tags + } + if cp.PoolProperties != nil { + objectMap["properties"] = cp.PoolProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for CapacityPool struct. +func (cp *CapacityPool) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + cp.Location = &location + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + cp.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + cp.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + cp.Type = &typeVar + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + cp.Tags = tags + } + case "properties": + if v != nil { + var poolProperties PoolProperties + err = json.Unmarshal(*v, &poolProperties) + if err != nil { + return err + } + cp.PoolProperties = &poolProperties + } + } + } + + return nil +} + +// CapacityPoolList list of capacity pool resources +type CapacityPoolList struct { + autorest.Response `json:"-"` + // Value - List of Capacity pools + Value *[]CapacityPool `json:"value,omitempty"` + // NextLink - URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// CapacityPoolListIterator provides access to a complete listing of CapacityPool values. +type CapacityPoolListIterator struct { + i int + page CapacityPoolListPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *CapacityPoolListIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/CapacityPoolListIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *CapacityPoolListIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter CapacityPoolListIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter CapacityPoolListIterator) Response() CapacityPoolList { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter CapacityPoolListIterator) Value() CapacityPool { + if !iter.page.NotDone() { + return CapacityPool{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the CapacityPoolListIterator type. +func NewCapacityPoolListIterator(page CapacityPoolListPage) CapacityPoolListIterator { + return CapacityPoolListIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (cpl CapacityPoolList) IsEmpty() bool { + return cpl.Value == nil || len(*cpl.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (cpl CapacityPoolList) hasNextLink() bool { + return cpl.NextLink != nil && len(*cpl.NextLink) != 0 +} + +// capacityPoolListPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (cpl CapacityPoolList) capacityPoolListPreparer(ctx context.Context) (*http.Request, error) { + if !cpl.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(cpl.NextLink))) +} + +// CapacityPoolListPage contains a page of CapacityPool values. +type CapacityPoolListPage struct { + fn func(context.Context, CapacityPoolList) (CapacityPoolList, error) + cpl CapacityPoolList +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *CapacityPoolListPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/CapacityPoolListPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.cpl) + if err != nil { + return err + } + page.cpl = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *CapacityPoolListPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page CapacityPoolListPage) NotDone() bool { + return !page.cpl.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page CapacityPoolListPage) Response() CapacityPoolList { + return page.cpl +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page CapacityPoolListPage) Values() []CapacityPool { + if page.cpl.IsEmpty() { + return nil + } + return *page.cpl.Value +} + +// Creates a new instance of the CapacityPoolListPage type. +func NewCapacityPoolListPage(cur CapacityPoolList, getNextPage func(context.Context, CapacityPoolList) (CapacityPoolList, error)) CapacityPoolListPage { + return CapacityPoolListPage{ + fn: getNextPage, + cpl: cur, + } +} + +// CapacityPoolPatch capacity pool patch resource +type CapacityPoolPatch struct { + // Location - Resource location + Location *string `json:"location,omitempty"` + // ID - READ-ONLY; Resource Id + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type + Type *string `json:"type,omitempty"` + // Tags - Resource tags + Tags map[string]*string `json:"tags"` + // PoolPatchProperties - Capacity pool properties + *PoolPatchProperties `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for CapacityPoolPatch. +func (cpp CapacityPoolPatch) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if cpp.Location != nil { + objectMap["location"] = cpp.Location + } + if cpp.Tags != nil { + objectMap["tags"] = cpp.Tags + } + if cpp.PoolPatchProperties != nil { + objectMap["properties"] = cpp.PoolPatchProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for CapacityPoolPatch struct. +func (cpp *CapacityPoolPatch) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + cpp.Location = &location + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + cpp.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + cpp.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + cpp.Type = &typeVar + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + cpp.Tags = tags + } + case "properties": + if v != nil { + var poolPatchProperties PoolPatchProperties + err = json.Unmarshal(*v, &poolPatchProperties) + if err != nil { + return err + } + cpp.PoolPatchProperties = &poolPatchProperties + } + } + } + + return nil +} + +// CheckAvailabilityResponse information regarding availability of a resource. +type CheckAvailabilityResponse struct { + autorest.Response `json:"-"` + // IsAvailable - true indicates name is valid and available. false indicates the name is invalid, unavailable, or both. + IsAvailable *bool `json:"isAvailable,omitempty"` + // Reason - 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. Possible values include: 'Invalid', 'AlreadyExists' + Reason InAvailabilityReasonType `json:"reason,omitempty"` + // Message - 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"` +} + +// CloudError an error response from the service. +type CloudError struct { + // Error - Cloud error body. + Error *CloudErrorBody `json:"error,omitempty"` +} + +// CloudErrorBody an error response from the service. +type CloudErrorBody struct { + // Code - An identifier for the error. Codes are invariant and are intended to be consumed programmatically. + Code *string `json:"code,omitempty"` + // Message - A message describing the error, intended to be suitable for display in a user interface. + Message *string `json:"message,omitempty"` +} + +// DailySchedule daily Schedule properties +type DailySchedule struct { + // SnapshotsToKeep - Daily snapshot count to keep + SnapshotsToKeep *int32 `json:"snapshotsToKeep,omitempty"` + // Hour - Indicates which hour in UTC timezone a snapshot should be taken + Hour *int32 `json:"hour,omitempty"` + // Minute - Indicates which minute snapshot should be taken + Minute *int32 `json:"minute,omitempty"` + // UsedBytes - Resource size in bytes, current storage usage for the volume in bytes + UsedBytes *int64 `json:"usedBytes,omitempty"` +} + +// Dimension dimension of blobs, possibly be blob type or access tier. +type Dimension struct { + // Name - Display name of dimension. + Name *string `json:"name,omitempty"` + // DisplayName - Display name of dimension. + DisplayName *string `json:"displayName,omitempty"` +} + +// ExportPolicyRule volume Export Policy Rule +type ExportPolicyRule struct { + // RuleIndex - Order index + RuleIndex *int32 `json:"ruleIndex,omitempty"` + // UnixReadOnly - Read only access + UnixReadOnly *bool `json:"unixReadOnly,omitempty"` + // UnixReadWrite - Read and write access + UnixReadWrite *bool `json:"unixReadWrite,omitempty"` + // Kerberos5ReadOnly - Kerberos5 Read only access. To be use with swagger version 2020-05-01 or later + Kerberos5ReadOnly *bool `json:"kerberos5ReadOnly,omitempty"` + // Kerberos5ReadWrite - Kerberos5 Read and write access. To be use with swagger version 2020-05-01 or later + Kerberos5ReadWrite *bool `json:"kerberos5ReadWrite,omitempty"` + // Kerberos5iReadOnly - Kerberos5i Read only access. To be use with swagger version 2020-05-01 or later + Kerberos5iReadOnly *bool `json:"kerberos5iReadOnly,omitempty"` + // Kerberos5iReadWrite - Kerberos5i Read and write access. To be use with swagger version 2020-05-01 or later + Kerberos5iReadWrite *bool `json:"kerberos5iReadWrite,omitempty"` + // Kerberos5pReadOnly - Kerberos5p Read only access. To be use with swagger version 2020-05-01 or later + Kerberos5pReadOnly *bool `json:"kerberos5pReadOnly,omitempty"` + // Kerberos5pReadWrite - Kerberos5p Read and write access. To be use with swagger version 2020-05-01 or later + Kerberos5pReadWrite *bool `json:"kerberos5pReadWrite,omitempty"` + // Cifs - Allows CIFS protocol + Cifs *bool `json:"cifs,omitempty"` + // Nfsv3 - Allows NFSv3 protocol. Enable only for NFSv3 type volumes + Nfsv3 *bool `json:"nfsv3,omitempty"` + // Nfsv41 - Allows NFSv4.1 protocol. Enable only for NFSv4.1 type volumes + Nfsv41 *bool `json:"nfsv41,omitempty"` + // AllowedClients - Client ingress specification as comma separated string with IPv4 CIDRs, IPv4 host addresses and host names + AllowedClients *string `json:"allowedClients,omitempty"` + // HasRootAccess - Has root access to volume + HasRootAccess *bool `json:"hasRootAccess,omitempty"` +} + +// HourlySchedule hourly Schedule properties +type HourlySchedule struct { + // SnapshotsToKeep - Hourly snapshot count to keep + SnapshotsToKeep *int32 `json:"snapshotsToKeep,omitempty"` + // Minute - Indicates which minute snapshot should be taken + Minute *int32 `json:"minute,omitempty"` + // UsedBytes - Resource size in bytes, current storage usage for the volume in bytes + UsedBytes *int64 `json:"usedBytes,omitempty"` +} + +// MetricSpecification metric specification of operation. +type MetricSpecification struct { + // Name - Name of metric specification. + Name *string `json:"name,omitempty"` + // DisplayName - Display name of metric specification. + DisplayName *string `json:"displayName,omitempty"` + // DisplayDescription - Display description of metric specification. + DisplayDescription *string `json:"displayDescription,omitempty"` + // Unit - Unit could be Bytes or Count. + Unit *string `json:"unit,omitempty"` + // Dimensions - Dimensions of blobs, including blob type and access tier. + Dimensions *[]Dimension `json:"dimensions,omitempty"` + // AggregationType - Aggregation type could be Average. + AggregationType *string `json:"aggregationType,omitempty"` + // FillGapWithZero - The property to decide fill gap with zero or not. + FillGapWithZero *bool `json:"fillGapWithZero,omitempty"` + // Category - The category this metric specification belong to, could be Capacity. + Category *string `json:"category,omitempty"` + // ResourceIDDimensionNameOverride - Account Resource Id. + ResourceIDDimensionNameOverride *string `json:"resourceIdDimensionNameOverride,omitempty"` +} + +// MonthlySchedule monthly Schedule properties +type MonthlySchedule struct { + // SnapshotsToKeep - Monthly snapshot count to keep + SnapshotsToKeep *int32 `json:"snapshotsToKeep,omitempty"` + // DaysOfMonth - Indicates which days of the month snapshot should be taken. A comma delimited string. + DaysOfMonth *string `json:"daysOfMonth,omitempty"` + // Hour - Indicates which hour in UTC timezone a snapshot should be taken + Hour *int32 `json:"hour,omitempty"` + // Minute - Indicates which minute snapshot should be taken + Minute *int32 `json:"minute,omitempty"` + // UsedBytes - Resource size in bytes, current storage usage for the volume in bytes + UsedBytes *int64 `json:"usedBytes,omitempty"` +} + +// MountTarget mount Target +type MountTarget struct { + // Location - Resource location + Location *string `json:"location,omitempty"` + // ID - READ-ONLY; Resource Id + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type + Type *string `json:"type,omitempty"` + // Tags - Resource tags + Tags map[string]*string `json:"tags"` + // MountTargetProperties - Mount Target Properties + *MountTargetProperties `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for MountTarget. +func (mt MountTarget) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if mt.Location != nil { + objectMap["location"] = mt.Location + } + if mt.Tags != nil { + objectMap["tags"] = mt.Tags + } + if mt.MountTargetProperties != nil { + objectMap["properties"] = mt.MountTargetProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for MountTarget struct. +func (mt *MountTarget) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + mt.Location = &location + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + mt.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + mt.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + mt.Type = &typeVar + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + mt.Tags = tags + } + case "properties": + if v != nil { + var mountTargetProperties MountTargetProperties + err = json.Unmarshal(*v, &mountTargetProperties) + if err != nil { + return err + } + mt.MountTargetProperties = &mountTargetProperties + } + } + } + + return nil +} + +// MountTargetProperties mount target properties +type MountTargetProperties struct { + // MountTargetID - READ-ONLY; UUID v4 used to identify the MountTarget + MountTargetID *string `json:"mountTargetId,omitempty"` + // FileSystemID - UUID v4 used to identify the MountTarget + FileSystemID *string `json:"fileSystemId,omitempty"` + // IPAddress - READ-ONLY; The mount target's IPv4 address + IPAddress *string `json:"ipAddress,omitempty"` + // SmbServerFqdn - The SMB server's Fully Qualified Domain Name, FQDN + SmbServerFqdn *string `json:"smbServerFqdn,omitempty"` +} + +// MarshalJSON is the custom marshaler for MountTargetProperties. +func (mtp MountTargetProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if mtp.FileSystemID != nil { + objectMap["fileSystemId"] = mtp.FileSystemID + } + if mtp.SmbServerFqdn != nil { + objectMap["smbServerFqdn"] = mtp.SmbServerFqdn + } + return json.Marshal(objectMap) +} + +// Operation microsoft.NetApp REST API operation definition. +type Operation struct { + // Name - Operation name: {provider}/{resource}/{operation} + Name *string `json:"name,omitempty"` + // Display - Display metadata associated with the operation. + Display *OperationDisplay `json:"display,omitempty"` + // Origin - The origin of operations. + Origin *string `json:"origin,omitempty"` + // OperationProperties - Properties of operation, include metric specifications. + *OperationProperties `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for Operation. +func (o Operation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if o.Name != nil { + objectMap["name"] = o.Name + } + if o.Display != nil { + objectMap["display"] = o.Display + } + if o.Origin != nil { + objectMap["origin"] = o.Origin + } + if o.OperationProperties != nil { + objectMap["properties"] = o.OperationProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for Operation struct. +func (o *Operation) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + o.Name = &name + } + case "display": + if v != nil { + var display OperationDisplay + err = json.Unmarshal(*v, &display) + if err != nil { + return err + } + o.Display = &display + } + case "origin": + if v != nil { + var origin string + err = json.Unmarshal(*v, &origin) + if err != nil { + return err + } + o.Origin = &origin + } + case "properties": + if v != nil { + var operationProperties OperationProperties + err = json.Unmarshal(*v, &operationProperties) + if err != nil { + return err + } + o.OperationProperties = &operationProperties + } + } + } + + return nil +} + +// OperationDisplay display metadata associated with the operation. +type OperationDisplay struct { + // Provider - Service provider: Microsoft NetApp. + Provider *string `json:"provider,omitempty"` + // Resource - Resource on which the operation is performed etc. + Resource *string `json:"resource,omitempty"` + // Operation - Type of operation: get, read, delete, etc. + Operation *string `json:"operation,omitempty"` + // Description - Operation description. + Description *string `json:"description,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 { + autorest.Response `json:"-"` + // Value - List of Storage operations supported by the Storage resource provider. + Value *[]Operation `json:"value,omitempty"` +} + +// OperationProperties properties of operation, include metric specifications. +type OperationProperties struct { + // ServiceSpecification - One property of operation, include metric specifications. + ServiceSpecification *ServiceSpecification `json:"serviceSpecification,omitempty"` +} + +// PoolChangeRequest pool change request +type PoolChangeRequest struct { + // NewPoolResourceID - Resource id of the pool to move volume to + NewPoolResourceID *string `json:"newPoolResourceId,omitempty"` +} + +// PoolPatchProperties patchable pool properties +type PoolPatchProperties struct { + // Size - Provisioned size of the pool (in bytes). Allowed values are in 4TiB chunks (value must be multiply of 4398046511104). + Size *int64 `json:"size,omitempty"` + // QosType - The qos type of the pool. Possible values include: 'QosTypeAuto', 'QosTypeManual' + QosType QosType `json:"qosType,omitempty"` +} + +// PoolProperties pool properties +type PoolProperties struct { + // PoolID - READ-ONLY; UUID v4 used to identify the Pool + PoolID *string `json:"poolId,omitempty"` + // Size - Provisioned size of the pool (in bytes). Allowed values are in 4TiB chunks (value must be multiply of 4398046511104). + Size *int64 `json:"size,omitempty"` + // ServiceLevel - The service level of the file system. Possible values include: 'ServiceLevelStandard', 'ServiceLevelPremium', 'ServiceLevelUltra' + ServiceLevel ServiceLevel `json:"serviceLevel,omitempty"` + // ProvisioningState - READ-ONLY; Azure lifecycle management + ProvisioningState *string `json:"provisioningState,omitempty"` + // TotalThroughputMibps - READ-ONLY; Total throughput of pool in Mibps + TotalThroughputMibps *float64 `json:"totalThroughputMibps,omitempty"` + // UtilizedThroughputMibps - READ-ONLY; Utilized throughput of pool in Mibps + UtilizedThroughputMibps *float64 `json:"utilizedThroughputMibps,omitempty"` + // QosType - The qos type of the pool. Possible values include: 'QosTypeAuto', 'QosTypeManual' + QosType QosType `json:"qosType,omitempty"` +} + +// MarshalJSON is the custom marshaler for PoolProperties. +func (pp PoolProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if pp.Size != nil { + objectMap["size"] = pp.Size + } + if pp.ServiceLevel != "" { + objectMap["serviceLevel"] = pp.ServiceLevel + } + if pp.QosType != "" { + objectMap["qosType"] = pp.QosType + } + return json.Marshal(objectMap) +} + +// PoolsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type PoolsCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(PoolsClient) (CapacityPool, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *PoolsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for PoolsCreateOrUpdateFuture.Result. +func (future *PoolsCreateOrUpdateFuture) result(client PoolsClient) (cp CapacityPool, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.PoolsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + cp.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("netapp.PoolsCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if cp.Response.Response, err = future.GetResult(sender); err == nil && cp.Response.Response.StatusCode != http.StatusNoContent { + cp, err = client.CreateOrUpdateResponder(cp.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.PoolsCreateOrUpdateFuture", "Result", cp.Response.Response, "Failure responding to request") + } + } + return +} + +// PoolsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running operation. +type PoolsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(PoolsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *PoolsDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for PoolsDeleteFuture.Result. +func (future *PoolsDeleteFuture) result(client PoolsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.PoolsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("netapp.PoolsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// PoolsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running operation. +type PoolsUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(PoolsClient) (CapacityPool, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *PoolsUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for PoolsUpdateFuture.Result. +func (future *PoolsUpdateFuture) result(client PoolsClient) (cp CapacityPool, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.PoolsUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + cp.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("netapp.PoolsUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if cp.Response.Response, err = future.GetResult(sender); err == nil && cp.Response.Response.StatusCode != http.StatusNoContent { + cp, err = client.UpdateResponder(cp.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.PoolsUpdateFuture", "Result", cp.Response.Response, "Failure responding to request") + } + } + return +} + +// QuotaAvailabilityRequest quota availability request content. +type QuotaAvailabilityRequest struct { + // Name - Name of the resource to verify. + Name *string `json:"name,omitempty"` + // Type - Resource type used for verification. Possible values include: 'CheckQuotaNameResourceTypesMicrosoftNetAppnetAppAccounts', 'CheckQuotaNameResourceTypesMicrosoftNetAppnetAppAccountscapacityPools', 'CheckQuotaNameResourceTypesMicrosoftNetAppnetAppAccountscapacityPoolsvolumes', 'CheckQuotaNameResourceTypesMicrosoftNetAppnetAppAccountscapacityPoolsvolumessnapshots' + Type CheckQuotaNameResourceTypes `json:"type,omitempty"` + // ResourceGroup - Resource group name. + ResourceGroup *string `json:"resourceGroup,omitempty"` +} + +// RegionInfo provides region specific information. +type RegionInfo struct { + autorest.Response `json:"-"` + // StorageToNetworkProximity - Provides storage to network proximity information in the region. Possible values include: 'Default', 'T1', 'T2', 'T1AndT2' + StorageToNetworkProximity RegionStorageToNetworkProximity `json:"storageToNetworkProximity,omitempty"` +} + +// ReplicationObject replication properties +type ReplicationObject struct { + // ReplicationID - Id + ReplicationID *string `json:"replicationId,omitempty"` + // EndpointType - Indicates whether the local volume is the source or destination for the Volume Replication. Possible values include: 'Src', 'Dst' + EndpointType EndpointType `json:"endpointType,omitempty"` + // ReplicationSchedule - Schedule. Possible values include: '10minutely', 'Hourly', 'Daily' + ReplicationSchedule ReplicationSchedule `json:"replicationSchedule,omitempty"` + // RemoteVolumeResourceID - The resource ID of the remote volume. + RemoteVolumeResourceID *string `json:"remoteVolumeResourceId,omitempty"` + // RemoteVolumeRegion - The remote region for the other end of the Volume Replication. + RemoteVolumeRegion *string `json:"remoteVolumeRegion,omitempty"` +} + +// ReplicationStatus replication status +type ReplicationStatus struct { + autorest.Response `json:"-"` + // Healthy - Replication health check + Healthy *bool `json:"healthy,omitempty"` + // RelationshipStatus - Status of the mirror relationship. Possible values include: 'Idle', 'Transferring' + RelationshipStatus RelationshipStatus `json:"relationshipStatus,omitempty"` + // MirrorState - The status of the replication. Possible values include: 'Uninitialized', 'Mirrored', 'Broken' + MirrorState MirrorState `json:"mirrorState,omitempty"` + // TotalProgress - The progress of the replication + TotalProgress *string `json:"totalProgress,omitempty"` + // ErrorMessage - Displays error message if the replication is in an error state + ErrorMessage *string `json:"errorMessage,omitempty"` +} + +// ResourceIdentity identity for the resource. +type ResourceIdentity struct { + // PrincipalID - READ-ONLY; Object id of the identity resource + PrincipalID *string `json:"principalId,omitempty"` + // TenantID - READ-ONLY; The tenant id of the resource + TenantID *string `json:"tenantId,omitempty"` + // Type - Type of Identity. Supported values are: 'None', 'SystemAssigned' + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for ResourceIdentity. +func (ri ResourceIdentity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ri.Type != nil { + objectMap["type"] = ri.Type + } + return json.Marshal(objectMap) +} + +// ResourceNameAvailabilityRequest resource name availability request content. +type ResourceNameAvailabilityRequest struct { + // Name - Resource name to verify. + Name *string `json:"name,omitempty"` + // Type - Resource type used for verification. Possible values include: 'MicrosoftNetAppnetAppAccounts', 'MicrosoftNetAppnetAppAccountscapacityPools', 'MicrosoftNetAppnetAppAccountscapacityPoolsvolumes', 'MicrosoftNetAppnetAppAccountscapacityPoolsvolumessnapshots' + Type CheckNameResourceTypes `json:"type,omitempty"` + // ResourceGroup - Resource group name. + ResourceGroup *string `json:"resourceGroup,omitempty"` +} + +// ServiceSpecification one property of operation, include metric specifications. +type ServiceSpecification struct { + // MetricSpecifications - Metric specifications of operation. + MetricSpecifications *[]MetricSpecification `json:"metricSpecifications,omitempty"` +} + +// Snapshot snapshot of a Volume +type Snapshot struct { + autorest.Response `json:"-"` + // Location - Resource location + Location *string `json:"location,omitempty"` + // ID - READ-ONLY; Resource Id + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type + Type *string `json:"type,omitempty"` + // SnapshotProperties - Snapshot Properties + *SnapshotProperties `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for Snapshot. +func (s Snapshot) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if s.Location != nil { + objectMap["location"] = s.Location + } + if s.SnapshotProperties != nil { + objectMap["properties"] = s.SnapshotProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for Snapshot struct. +func (s *Snapshot) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + s.Location = &location + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + s.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + s.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + s.Type = &typeVar + } + case "properties": + if v != nil { + var snapshotProperties SnapshotProperties + err = json.Unmarshal(*v, &snapshotProperties) + if err != nil { + return err + } + s.SnapshotProperties = &snapshotProperties + } + } + } + + return nil +} + +// SnapshotPoliciesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type SnapshotPoliciesDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(SnapshotPoliciesClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *SnapshotPoliciesDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for SnapshotPoliciesDeleteFuture.Result. +func (future *SnapshotPoliciesDeleteFuture) result(client SnapshotPoliciesClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.SnapshotPoliciesDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("netapp.SnapshotPoliciesDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// SnapshotPoliciesList list of Snapshot Policies +type SnapshotPoliciesList struct { + autorest.Response `json:"-"` + // Value - A list of snapshot policies + Value *[]SnapshotPolicy `json:"value,omitempty"` +} + +// SnapshotPoliciesUpdateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type SnapshotPoliciesUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(SnapshotPoliciesClient) (SnapshotPolicy, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *SnapshotPoliciesUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for SnapshotPoliciesUpdateFuture.Result. +func (future *SnapshotPoliciesUpdateFuture) result(client SnapshotPoliciesClient) (sp SnapshotPolicy, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.SnapshotPoliciesUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + sp.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("netapp.SnapshotPoliciesUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if sp.Response.Response, err = future.GetResult(sender); err == nil && sp.Response.Response.StatusCode != http.StatusNoContent { + sp, err = client.UpdateResponder(sp.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.SnapshotPoliciesUpdateFuture", "Result", sp.Response.Response, "Failure responding to request") + } + } + return +} + +// SnapshotPolicy snapshot policy information +type SnapshotPolicy struct { + autorest.Response `json:"-"` + // Location - Resource location + Location *string `json:"location,omitempty"` + // ID - READ-ONLY; Resource Id + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type + Type *string `json:"type,omitempty"` + // Tags - Resource tags + Tags map[string]*string `json:"tags"` + // SnapshotPolicyProperties - Snapshot policy Properties + *SnapshotPolicyProperties `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for SnapshotPolicy. +func (sp SnapshotPolicy) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if sp.Location != nil { + objectMap["location"] = sp.Location + } + if sp.Tags != nil { + objectMap["tags"] = sp.Tags + } + if sp.SnapshotPolicyProperties != nil { + objectMap["properties"] = sp.SnapshotPolicyProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for SnapshotPolicy struct. +func (sp *SnapshotPolicy) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + sp.Location = &location + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + sp.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + sp.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + sp.Type = &typeVar + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + sp.Tags = tags + } + case "properties": + if v != nil { + var snapshotPolicyProperties SnapshotPolicyProperties + err = json.Unmarshal(*v, &snapshotPolicyProperties) + if err != nil { + return err + } + sp.SnapshotPolicyProperties = &snapshotPolicyProperties + } + } + } + + return nil +} + +// SnapshotPolicyDetails snapshot policy properties +type SnapshotPolicyDetails struct { + // Location - Resource location + Location *string `json:"location,omitempty"` + // ID - READ-ONLY; Resource Id + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type + Type *string `json:"type,omitempty"` + // Tags - Resource tags + Tags map[string]*string `json:"tags"` + // SnapshotPolicyProperties - Snapshot policy Properties + *SnapshotPolicyProperties `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for SnapshotPolicyDetails. +func (spd SnapshotPolicyDetails) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if spd.Location != nil { + objectMap["location"] = spd.Location + } + if spd.Tags != nil { + objectMap["tags"] = spd.Tags + } + if spd.SnapshotPolicyProperties != nil { + objectMap["properties"] = spd.SnapshotPolicyProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for SnapshotPolicyDetails struct. +func (spd *SnapshotPolicyDetails) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + spd.Location = &location + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + spd.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + spd.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + spd.Type = &typeVar + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + spd.Tags = tags + } + case "properties": + if v != nil { + var snapshotPolicyProperties SnapshotPolicyProperties + err = json.Unmarshal(*v, &snapshotPolicyProperties) + if err != nil { + return err + } + spd.SnapshotPolicyProperties = &snapshotPolicyProperties + } + } + } + + return nil +} + +// SnapshotPolicyPatch snapshot policy Details for create and update +type SnapshotPolicyPatch struct { + // Location - Resource location + Location *string `json:"location,omitempty"` + // ID - READ-ONLY; Resource Id + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type + Type *string `json:"type,omitempty"` + // Tags - Resource tags + Tags map[string]*string `json:"tags"` + // SnapshotPolicyProperties - Snapshot Policy properties + *SnapshotPolicyProperties `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for SnapshotPolicyPatch. +func (spp SnapshotPolicyPatch) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if spp.Location != nil { + objectMap["location"] = spp.Location + } + if spp.Tags != nil { + objectMap["tags"] = spp.Tags + } + if spp.SnapshotPolicyProperties != nil { + objectMap["properties"] = spp.SnapshotPolicyProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for SnapshotPolicyPatch struct. +func (spp *SnapshotPolicyPatch) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + spp.Location = &location + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + spp.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + spp.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + spp.Type = &typeVar + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + spp.Tags = tags + } + case "properties": + if v != nil { + var snapshotPolicyProperties SnapshotPolicyProperties + err = json.Unmarshal(*v, &snapshotPolicyProperties) + if err != nil { + return err + } + spp.SnapshotPolicyProperties = &snapshotPolicyProperties + } + } + } + + return nil +} + +// SnapshotPolicyProperties snapshot policy properties +type SnapshotPolicyProperties struct { + // HourlySchedule - Schedule for hourly snapshots + HourlySchedule *HourlySchedule `json:"hourlySchedule,omitempty"` + // DailySchedule - Schedule for daily snapshots + DailySchedule *DailySchedule `json:"dailySchedule,omitempty"` + // WeeklySchedule - Schedule for weekly snapshots + WeeklySchedule *WeeklySchedule `json:"weeklySchedule,omitempty"` + // MonthlySchedule - Schedule for monthly snapshots + MonthlySchedule *MonthlySchedule `json:"monthlySchedule,omitempty"` + // Enabled - The property to decide policy is enabled or not + Enabled *bool `json:"enabled,omitempty"` + // ProvisioningState - READ-ONLY; Azure lifecycle management + ProvisioningState *string `json:"provisioningState,omitempty"` +} + +// MarshalJSON is the custom marshaler for SnapshotPolicyProperties. +func (spp SnapshotPolicyProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if spp.HourlySchedule != nil { + objectMap["hourlySchedule"] = spp.HourlySchedule + } + if spp.DailySchedule != nil { + objectMap["dailySchedule"] = spp.DailySchedule + } + if spp.WeeklySchedule != nil { + objectMap["weeklySchedule"] = spp.WeeklySchedule + } + if spp.MonthlySchedule != nil { + objectMap["monthlySchedule"] = spp.MonthlySchedule + } + if spp.Enabled != nil { + objectMap["enabled"] = spp.Enabled + } + return json.Marshal(objectMap) +} + +// SnapshotPolicyVolumeList volumes associated with snapshot policy +type SnapshotPolicyVolumeList struct { + autorest.Response `json:"-"` + // Value - List of volumes + Value *[]interface{} `json:"value,omitempty"` +} + +// SnapshotProperties snapshot properties +type SnapshotProperties struct { + // SnapshotID - READ-ONLY; UUID v4 used to identify the Snapshot + SnapshotID *string `json:"snapshotId,omitempty"` + // Created - READ-ONLY; The creation date of the snapshot + Created *date.Time `json:"created,omitempty"` + // ProvisioningState - READ-ONLY; Azure lifecycle management + ProvisioningState *string `json:"provisioningState,omitempty"` +} + +// MarshalJSON is the custom marshaler for SnapshotProperties. +func (sp SnapshotProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// SnapshotsCreateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type SnapshotsCreateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(SnapshotsClient) (Snapshot, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *SnapshotsCreateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for SnapshotsCreateFuture.Result. +func (future *SnapshotsCreateFuture) result(client SnapshotsClient) (s Snapshot, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.SnapshotsCreateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + s.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("netapp.SnapshotsCreateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if s.Response.Response, err = future.GetResult(sender); err == nil && s.Response.Response.StatusCode != http.StatusNoContent { + s, err = client.CreateResponder(s.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.SnapshotsCreateFuture", "Result", s.Response.Response, "Failure responding to request") + } + } + return +} + +// SnapshotsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type SnapshotsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(SnapshotsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *SnapshotsDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for SnapshotsDeleteFuture.Result. +func (future *SnapshotsDeleteFuture) result(client SnapshotsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.SnapshotsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("netapp.SnapshotsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// SnapshotsList list of Snapshots +type SnapshotsList struct { + autorest.Response `json:"-"` + // Value - A list of Snapshots + Value *[]Snapshot `json:"value,omitempty"` +} + +// SnapshotsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type SnapshotsUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(SnapshotsClient) (Snapshot, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *SnapshotsUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for SnapshotsUpdateFuture.Result. +func (future *SnapshotsUpdateFuture) result(client SnapshotsClient) (s Snapshot, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.SnapshotsUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + s.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("netapp.SnapshotsUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if s.Response.Response, err = future.GetResult(sender); err == nil && s.Response.Response.StatusCode != http.StatusNoContent { + s, err = client.UpdateResponder(s.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.SnapshotsUpdateFuture", "Result", s.Response.Response, "Failure responding to request") + } + } + return +} + +// SystemData metadata pertaining to creation and last modification of the resource. +type SystemData struct { + // CreatedBy - The identity that created the resource. + CreatedBy *string `json:"createdBy,omitempty"` + // CreatedByType - The type of identity that created the resource. Possible values include: 'User', 'Application', 'ManagedIdentity', 'Key' + CreatedByType CreatedByType `json:"createdByType,omitempty"` + // CreatedAt - The timestamp of resource creation (UTC). + CreatedAt *date.Time `json:"createdAt,omitempty"` + // LastModifiedBy - The identity that last modified the resource. + LastModifiedBy *string `json:"lastModifiedBy,omitempty"` + // LastModifiedByType - The type of identity that last modified the resource. Possible values include: 'User', 'Application', 'ManagedIdentity', 'Key' + LastModifiedByType CreatedByType `json:"lastModifiedByType,omitempty"` + // LastModifiedAt - The timestamp of resource last modification (UTC) + LastModifiedAt *date.Time `json:"lastModifiedAt,omitempty"` +} + +// Vault vault information +type Vault struct { + // Location - Resource location + Location *string `json:"location,omitempty"` + // ID - READ-ONLY; Resource Id + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type + Type *string `json:"type,omitempty"` + // VaultProperties - Vault Properties + *VaultProperties `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for Vault. +func (vVar Vault) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if vVar.Location != nil { + objectMap["location"] = vVar.Location + } + if vVar.VaultProperties != nil { + objectMap["properties"] = vVar.VaultProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for Vault struct. +func (vVar *Vault) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + vVar.Location = &location + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + vVar.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + vVar.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + vVar.Type = &typeVar + } + case "properties": + if v != nil { + var vaultProperties VaultProperties + err = json.Unmarshal(*v, &vaultProperties) + if err != nil { + return err + } + vVar.VaultProperties = &vaultProperties + } + } + } + + return nil +} + +// VaultList list of Vaults +type VaultList struct { + autorest.Response `json:"-"` + // Value - A list of vaults + Value *[]Vault `json:"value,omitempty"` +} + +// VaultProperties vault properties +type VaultProperties struct { + // VaultName - Vault Name + VaultName *string `json:"vaultName,omitempty"` +} + +// Volume volume resource +type Volume struct { + autorest.Response `json:"-"` + // Location - Resource location + Location *string `json:"location,omitempty"` + // ID - READ-ONLY; Resource Id + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type + Type *string `json:"type,omitempty"` + // Tags - Resource tags + Tags map[string]*string `json:"tags"` + // VolumeProperties - Volume properties + *VolumeProperties `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for Volume. +func (vVar Volume) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if vVar.Location != nil { + objectMap["location"] = vVar.Location + } + if vVar.Tags != nil { + objectMap["tags"] = vVar.Tags + } + if vVar.VolumeProperties != nil { + objectMap["properties"] = vVar.VolumeProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for Volume struct. +func (vVar *Volume) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + vVar.Location = &location + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + vVar.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + vVar.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + vVar.Type = &typeVar + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + vVar.Tags = tags + } + case "properties": + if v != nil { + var volumeProperties VolumeProperties + err = json.Unmarshal(*v, &volumeProperties) + if err != nil { + return err + } + vVar.VolumeProperties = &volumeProperties + } + } + } + + return nil +} + +// VolumeBackupProperties volume Backup Properties +type VolumeBackupProperties struct { + // BackupPolicyID - Backup Policy Resource ID + BackupPolicyID *string `json:"backupPolicyId,omitempty"` + // PolicyEnforced - Policy Enforced + PolicyEnforced *bool `json:"policyEnforced,omitempty"` + // VaultID - Vault Resource ID + VaultID *string `json:"vaultId,omitempty"` + // BackupEnabled - Backup Enabled + BackupEnabled *bool `json:"backupEnabled,omitempty"` +} + +// VolumeBackups volume details using the backup policy +type VolumeBackups struct { + // VolumeName - Volume name + VolumeName *string `json:"volumeName,omitempty"` + // BackupsCount - Total count of backups for volume + BackupsCount *int32 `json:"backupsCount,omitempty"` + // PolicyEnabled - Policy enabled + PolicyEnabled *bool `json:"policyEnabled,omitempty"` +} + +// VolumeList list of volume resources +type VolumeList struct { + autorest.Response `json:"-"` + // Value - List of volumes + Value *[]Volume `json:"value,omitempty"` + // NextLink - URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// VolumeListIterator provides access to a complete listing of Volume values. +type VolumeListIterator struct { + i int + page VolumeListPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *VolumeListIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VolumeListIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *VolumeListIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter VolumeListIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter VolumeListIterator) Response() VolumeList { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter VolumeListIterator) Value() Volume { + if !iter.page.NotDone() { + return Volume{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the VolumeListIterator type. +func NewVolumeListIterator(page VolumeListPage) VolumeListIterator { + return VolumeListIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (vl VolumeList) IsEmpty() bool { + return vl.Value == nil || len(*vl.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (vl VolumeList) hasNextLink() bool { + return vl.NextLink != nil && len(*vl.NextLink) != 0 +} + +// volumeListPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (vl VolumeList) volumeListPreparer(ctx context.Context) (*http.Request, error) { + if !vl.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(vl.NextLink))) +} + +// VolumeListPage contains a page of Volume values. +type VolumeListPage struct { + fn func(context.Context, VolumeList) (VolumeList, error) + vl VolumeList +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *VolumeListPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VolumeListPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.vl) + if err != nil { + return err + } + page.vl = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *VolumeListPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page VolumeListPage) NotDone() bool { + return !page.vl.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page VolumeListPage) Response() VolumeList { + return page.vl +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page VolumeListPage) Values() []Volume { + if page.vl.IsEmpty() { + return nil + } + return *page.vl.Value +} + +// Creates a new instance of the VolumeListPage type. +func NewVolumeListPage(cur VolumeList, getNextPage func(context.Context, VolumeList) (VolumeList, error)) VolumeListPage { + return VolumeListPage{ + fn: getNextPage, + vl: cur, + } +} + +// VolumePatch volume patch resource +type VolumePatch struct { + // Location - Resource location + Location *string `json:"location,omitempty"` + // ID - READ-ONLY; Resource Id + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type + Type *string `json:"type,omitempty"` + // Tags - Resource tags + Tags map[string]*string `json:"tags"` + // VolumePatchProperties - Patchable volume properties + *VolumePatchProperties `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for VolumePatch. +func (vp VolumePatch) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if vp.Location != nil { + objectMap["location"] = vp.Location + } + if vp.Tags != nil { + objectMap["tags"] = vp.Tags + } + if vp.VolumePatchProperties != nil { + objectMap["properties"] = vp.VolumePatchProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for VolumePatch struct. +func (vp *VolumePatch) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + vp.Location = &location + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + vp.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + vp.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + vp.Type = &typeVar + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + vp.Tags = tags + } + case "properties": + if v != nil { + var volumePatchProperties VolumePatchProperties + err = json.Unmarshal(*v, &volumePatchProperties) + if err != nil { + return err + } + vp.VolumePatchProperties = &volumePatchProperties + } + } + } + + return nil +} + +// VolumePatchProperties patchable volume properties +type VolumePatchProperties struct { + // ServiceLevel - The service level of the file system. Possible values include: 'ServiceLevelStandard', 'ServiceLevelPremium', 'ServiceLevelUltra' + ServiceLevel ServiceLevel `json:"serviceLevel,omitempty"` + // UsageThreshold - 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"` + // ExportPolicy - Set of export policy rules + ExportPolicy *VolumePatchPropertiesExportPolicy `json:"exportPolicy,omitempty"` + ThroughputMibps *float64 `json:"throughputMibps,omitempty"` + // DataProtection - DataProtection type volumes include an object containing details of the replication + DataProtection *VolumePatchPropertiesDataProtection `json:"dataProtection,omitempty"` +} + +// VolumePatchPropertiesDataProtection dataProtection type volumes include an object containing details of +// the replication +type VolumePatchPropertiesDataProtection struct { + // Backup - Backup Properties + Backup *VolumeBackupProperties `json:"backup,omitempty"` + // Snapshot - Snapshot properties. + Snapshot *VolumeSnapshotProperties `json:"snapshot,omitempty"` +} + +// VolumePatchPropertiesExportPolicy set of export policy rules +type VolumePatchPropertiesExportPolicy struct { + // Rules - Export policy rule + Rules *[]ExportPolicyRule `json:"rules,omitempty"` +} + +// VolumeProperties volume properties +type VolumeProperties struct { + // FileSystemID - READ-ONLY; Unique FileSystem Identifier. + FileSystemID *string `json:"fileSystemId,omitempty"` + // CreationToken - A unique file path for the volume. Used when creating mount targets + CreationToken *string `json:"creationToken,omitempty"` + // ServiceLevel - The service level of the file system. Possible values include: 'ServiceLevelStandard', 'ServiceLevelPremium', 'ServiceLevelUltra' + ServiceLevel ServiceLevel `json:"serviceLevel,omitempty"` + // UsageThreshold - 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"` + // ExportPolicy - Set of export policy rules + ExportPolicy *VolumePropertiesExportPolicy `json:"exportPolicy,omitempty"` + // ProtocolTypes - Set of protocol types, default NFSv3, CIFS for SMB protocol + ProtocolTypes *[]string `json:"protocolTypes,omitempty"` + // ProvisioningState - READ-ONLY; Azure lifecycle management + ProvisioningState *string `json:"provisioningState,omitempty"` + // SnapshotID - UUID v4 or resource identifier used to identify the Snapshot. + SnapshotID *string `json:"snapshotId,omitempty"` + // BackupID - UUID v4 or resource identifier used to identify the Backup. + BackupID *string `json:"backupId,omitempty"` + // BaremetalTenantID - READ-ONLY; Unique Baremetal Tenant Identifier. + BaremetalTenantID *string `json:"baremetalTenantId,omitempty"` + // SubnetID - The Azure Resource URI for a delegated subnet. Must have the delegation Microsoft.NetApp/volumes + SubnetID *string `json:"subnetId,omitempty"` + // NetworkFeatures - Basic network, or Standard features available to the volume. Possible values include: 'Basic', 'Standard' + NetworkFeatures NetworkFeatures `json:"networkFeatures,omitempty"` + // NetworkSiblingSetID - READ-ONLY; Network Sibling Set ID for the the group of volumes sharing networking resources. + NetworkSiblingSetID *string `json:"networkSiblingSetId,omitempty"` + // StorageToNetworkProximity - READ-ONLY; Provides storage to network proximity information for the volume. Possible values include: 'VolumeStorageToNetworkProximityDefault', 'VolumeStorageToNetworkProximityT1', 'VolumeStorageToNetworkProximityT2' + StorageToNetworkProximity VolumeStorageToNetworkProximity `json:"storageToNetworkProximity,omitempty"` + // MountTargets - READ-ONLY; List of mount targets + MountTargets *[]MountTargetProperties `json:"mountTargets,omitempty"` + // VolumeType - What type of volume is this + VolumeType *string `json:"volumeType,omitempty"` + // DataProtection - DataProtection type volumes include an object containing details of the replication + DataProtection *VolumePropertiesDataProtection `json:"dataProtection,omitempty"` + // IsRestoring - Restoring + IsRestoring *bool `json:"isRestoring,omitempty"` + // SnapshotDirectoryVisible - 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"` + // KerberosEnabled - Describe if a volume is KerberosEnabled. To be use with swagger version 2020-05-01 or later + KerberosEnabled *bool `json:"kerberosEnabled,omitempty"` + // SecurityStyle - The security style of volume, default unix, defaults to ntfs for dual protocol or CIFS protocol. Possible values include: 'Ntfs', 'Unix' + SecurityStyle SecurityStyle `json:"securityStyle,omitempty"` + // SmbEncryption - 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"` + // SmbContinuouslyAvailable - Enables continuously available share property for smb volume. Only applicable for SMB volume + SmbContinuouslyAvailable *bool `json:"smbContinuouslyAvailable,omitempty"` + ThroughputMibps *float64 `json:"throughputMibps,omitempty"` + // EncryptionKeySource - Encryption Key Source. Possible values are: 'Microsoft.NetApp' + EncryptionKeySource *string `json:"encryptionKeySource,omitempty"` + // LdapEnabled - Specifies whether LDAP is enabled or not for a given NFS volume. + LdapEnabled *bool `json:"ldapEnabled,omitempty"` +} + +// MarshalJSON is the custom marshaler for VolumeProperties. +func (vp VolumeProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if vp.CreationToken != nil { + objectMap["creationToken"] = vp.CreationToken + } + if vp.ServiceLevel != "" { + objectMap["serviceLevel"] = vp.ServiceLevel + } + if vp.UsageThreshold != nil { + objectMap["usageThreshold"] = vp.UsageThreshold + } + if vp.ExportPolicy != nil { + objectMap["exportPolicy"] = vp.ExportPolicy + } + if vp.ProtocolTypes != nil { + objectMap["protocolTypes"] = vp.ProtocolTypes + } + if vp.SnapshotID != nil { + objectMap["snapshotId"] = vp.SnapshotID + } + if vp.BackupID != nil { + objectMap["backupId"] = vp.BackupID + } + if vp.SubnetID != nil { + objectMap["subnetId"] = vp.SubnetID + } + if vp.NetworkFeatures != "" { + objectMap["networkFeatures"] = vp.NetworkFeatures + } + if vp.VolumeType != nil { + objectMap["volumeType"] = vp.VolumeType + } + if vp.DataProtection != nil { + objectMap["dataProtection"] = vp.DataProtection + } + if vp.IsRestoring != nil { + objectMap["isRestoring"] = vp.IsRestoring + } + if vp.SnapshotDirectoryVisible != nil { + objectMap["snapshotDirectoryVisible"] = vp.SnapshotDirectoryVisible + } + if vp.KerberosEnabled != nil { + objectMap["kerberosEnabled"] = vp.KerberosEnabled + } + if vp.SecurityStyle != "" { + objectMap["securityStyle"] = vp.SecurityStyle + } + if vp.SmbEncryption != nil { + objectMap["smbEncryption"] = vp.SmbEncryption + } + if vp.SmbContinuouslyAvailable != nil { + objectMap["smbContinuouslyAvailable"] = vp.SmbContinuouslyAvailable + } + if vp.ThroughputMibps != nil { + objectMap["throughputMibps"] = vp.ThroughputMibps + } + if vp.EncryptionKeySource != nil { + objectMap["encryptionKeySource"] = vp.EncryptionKeySource + } + if vp.LdapEnabled != nil { + objectMap["ldapEnabled"] = vp.LdapEnabled + } + return json.Marshal(objectMap) +} + +// VolumePropertiesDataProtection dataProtection type volumes include an object containing details of the +// replication +type VolumePropertiesDataProtection struct { + // Backup - Backup Properties + Backup *VolumeBackupProperties `json:"backup,omitempty"` + // Replication - Replication properties + Replication *ReplicationObject `json:"replication,omitempty"` + // Snapshot - Snapshot properties. + Snapshot *VolumeSnapshotProperties `json:"snapshot,omitempty"` +} + +// VolumePropertiesExportPolicy set of export policy rules +type VolumePropertiesExportPolicy struct { + // Rules - Export policy rule + Rules *[]ExportPolicyRule `json:"rules,omitempty"` +} + +// VolumeRevert revert a volume to the snapshot +type VolumeRevert struct { + // SnapshotID - Resource id of the snapshot + SnapshotID *string `json:"snapshotId,omitempty"` +} + +// VolumesAuthorizeReplicationFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type VolumesAuthorizeReplicationFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(VolumesClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *VolumesAuthorizeReplicationFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for VolumesAuthorizeReplicationFuture.Result. +func (future *VolumesAuthorizeReplicationFuture) result(client VolumesClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.VolumesAuthorizeReplicationFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("netapp.VolumesAuthorizeReplicationFuture") + return + } + ar.Response = future.Response() + return +} + +// VolumesBreakReplicationFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type VolumesBreakReplicationFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(VolumesClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *VolumesBreakReplicationFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for VolumesBreakReplicationFuture.Result. +func (future *VolumesBreakReplicationFuture) result(client VolumesClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.VolumesBreakReplicationFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("netapp.VolumesBreakReplicationFuture") + return + } + ar.Response = future.Response() + return +} + +// VolumesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type VolumesCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(VolumesClient) (Volume, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *VolumesCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for VolumesCreateOrUpdateFuture.Result. +func (future *VolumesCreateOrUpdateFuture) result(client VolumesClient) (vVar Volume, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.VolumesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + vVar.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("netapp.VolumesCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if vVar.Response.Response, err = future.GetResult(sender); err == nil && vVar.Response.Response.StatusCode != http.StatusNoContent { + vVar, err = client.CreateOrUpdateResponder(vVar.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.VolumesCreateOrUpdateFuture", "Result", vVar.Response.Response, "Failure responding to request") + } + } + return +} + +// VolumesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type VolumesDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(VolumesClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *VolumesDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for VolumesDeleteFuture.Result. +func (future *VolumesDeleteFuture) result(client VolumesClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.VolumesDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("netapp.VolumesDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// VolumesDeleteReplicationFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type VolumesDeleteReplicationFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(VolumesClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *VolumesDeleteReplicationFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for VolumesDeleteReplicationFuture.Result. +func (future *VolumesDeleteReplicationFuture) result(client VolumesClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.VolumesDeleteReplicationFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("netapp.VolumesDeleteReplicationFuture") + return + } + ar.Response = future.Response() + return +} + +// VolumeSnapshotProperties volume Snapshot Properties +type VolumeSnapshotProperties struct { + // SnapshotPolicyID - Snapshot Policy ResourceId + SnapshotPolicyID *string `json:"snapshotPolicyId,omitempty"` +} + +// VolumesPoolChangeFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type VolumesPoolChangeFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(VolumesClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *VolumesPoolChangeFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for VolumesPoolChangeFuture.Result. +func (future *VolumesPoolChangeFuture) result(client VolumesClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.VolumesPoolChangeFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("netapp.VolumesPoolChangeFuture") + return + } + ar.Response = future.Response() + return +} + +// VolumesReInitializeReplicationFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type VolumesReInitializeReplicationFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(VolumesClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *VolumesReInitializeReplicationFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for VolumesReInitializeReplicationFuture.Result. +func (future *VolumesReInitializeReplicationFuture) result(client VolumesClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.VolumesReInitializeReplicationFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("netapp.VolumesReInitializeReplicationFuture") + return + } + ar.Response = future.Response() + return +} + +// VolumesResyncReplicationFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type VolumesResyncReplicationFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(VolumesClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *VolumesResyncReplicationFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for VolumesResyncReplicationFuture.Result. +func (future *VolumesResyncReplicationFuture) result(client VolumesClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.VolumesResyncReplicationFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("netapp.VolumesResyncReplicationFuture") + return + } + ar.Response = future.Response() + return +} + +// VolumesRevertFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type VolumesRevertFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(VolumesClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *VolumesRevertFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for VolumesRevertFuture.Result. +func (future *VolumesRevertFuture) result(client VolumesClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.VolumesRevertFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("netapp.VolumesRevertFuture") + return + } + ar.Response = future.Response() + return +} + +// VolumesUpdateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type VolumesUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(VolumesClient) (Volume, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *VolumesUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for VolumesUpdateFuture.Result. +func (future *VolumesUpdateFuture) result(client VolumesClient) (vVar Volume, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.VolumesUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + vVar.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("netapp.VolumesUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if vVar.Response.Response, err = future.GetResult(sender); err == nil && vVar.Response.Response.StatusCode != http.StatusNoContent { + vVar, err = client.UpdateResponder(vVar.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.VolumesUpdateFuture", "Result", vVar.Response.Response, "Failure responding to request") + } + } + return +} + +// WeeklySchedule weekly Schedule properties, make a snapshot every week at a specific day or days +type WeeklySchedule struct { + // SnapshotsToKeep - Weekly snapshot count to keep + SnapshotsToKeep *int32 `json:"snapshotsToKeep,omitempty"` + // Day - Indicates which weekdays snapshot should be taken, accepts a comma separated list of week day names in english + Day *string `json:"day,omitempty"` + // Hour - Indicates which hour in UTC timezone a snapshot should be taken + Hour *int32 `json:"hour,omitempty"` + // Minute - Indicates which minute snapshot should be taken + Minute *int32 `json:"minute,omitempty"` + // UsedBytes - Resource size in bytes, current storage usage for the volume in bytes + UsedBytes *int64 `json:"usedBytes,omitempty"` +} diff --git a/services/preview/netapp/mgmt/2021-04-01-preview/netapp/netappapi/interfaces.go b/services/preview/netapp/mgmt/2021-04-01-preview/netapp/netappapi/interfaces.go new file mode 100644 index 000000000000..51865633f798 --- /dev/null +++ b/services/preview/netapp/mgmt/2021-04-01-preview/netapp/netappapi/interfaces.go @@ -0,0 +1,141 @@ +package netappapi + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/azure-sdk-for-go/services/preview/netapp/mgmt/2021-04-01-preview/netapp" +) + +// OperationsClientAPI contains the set of methods on the OperationsClient type. +type OperationsClientAPI interface { + List(ctx context.Context) (result netapp.OperationListResult, err error) +} + +var _ OperationsClientAPI = (*netapp.OperationsClient)(nil) + +// ResourceClientAPI contains the set of methods on the ResourceClient type. +type ResourceClientAPI interface { + CheckFilePathAvailability(ctx context.Context, body netapp.ResourceNameAvailabilityRequest, location string) (result netapp.CheckAvailabilityResponse, err error) + CheckNameAvailability(ctx context.Context, body netapp.ResourceNameAvailabilityRequest, location string) (result netapp.CheckAvailabilityResponse, err error) + CheckQuotaAvailability(ctx context.Context, body netapp.QuotaAvailabilityRequest, location string) (result netapp.CheckAvailabilityResponse, err error) +} + +var _ ResourceClientAPI = (*netapp.ResourceClient)(nil) + +// ResourceRegionInfoClientAPI contains the set of methods on the ResourceRegionInfoClient type. +type ResourceRegionInfoClientAPI interface { + Get(ctx context.Context, location string) (result netapp.RegionInfo, err error) +} + +var _ ResourceRegionInfoClientAPI = (*netapp.ResourceRegionInfoClient)(nil) + +// AccountsClientAPI contains the set of methods on the AccountsClient type. +type AccountsClientAPI interface { + CreateOrUpdate(ctx context.Context, body netapp.Account, resourceGroupName string, accountName string) (result netapp.AccountsCreateOrUpdateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, accountName string) (result netapp.AccountsDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, accountName string) (result netapp.Account, err error) + List(ctx context.Context, resourceGroupName string) (result netapp.AccountListPage, err error) + ListComplete(ctx context.Context, resourceGroupName string) (result netapp.AccountListIterator, err error) + Update(ctx context.Context, body netapp.AccountPatch, resourceGroupName string, accountName string) (result netapp.AccountsUpdateFuture, err error) +} + +var _ AccountsClientAPI = (*netapp.AccountsClient)(nil) + +// PoolsClientAPI contains the set of methods on the PoolsClient type. +type PoolsClientAPI interface { + CreateOrUpdate(ctx context.Context, body netapp.CapacityPool, resourceGroupName string, accountName string, poolName string) (result netapp.PoolsCreateOrUpdateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, accountName string, poolName string) (result netapp.PoolsDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, accountName string, poolName string) (result netapp.CapacityPool, err error) + List(ctx context.Context, resourceGroupName string, accountName string) (result netapp.CapacityPoolListPage, err error) + ListComplete(ctx context.Context, resourceGroupName string, accountName string) (result netapp.CapacityPoolListIterator, err error) + Update(ctx context.Context, body netapp.CapacityPoolPatch, resourceGroupName string, accountName string, poolName string) (result netapp.PoolsUpdateFuture, err error) +} + +var _ PoolsClientAPI = (*netapp.PoolsClient)(nil) + +// VolumesClientAPI contains the set of methods on the VolumesClient type. +type VolumesClientAPI interface { + AuthorizeReplication(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, body netapp.AuthorizeRequest) (result netapp.VolumesAuthorizeReplicationFuture, err error) + BreakReplication(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, body *netapp.BreakReplicationRequest) (result netapp.VolumesBreakReplicationFuture, err error) + CreateOrUpdate(ctx context.Context, body netapp.Volume, resourceGroupName string, accountName string, poolName string, volumeName string) (result netapp.VolumesCreateOrUpdateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string) (result netapp.VolumesDeleteFuture, err error) + DeleteReplication(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string) (result netapp.VolumesDeleteReplicationFuture, err error) + Get(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string) (result netapp.Volume, err error) + List(ctx context.Context, resourceGroupName string, accountName string, poolName string) (result netapp.VolumeListPage, err error) + ListComplete(ctx context.Context, resourceGroupName string, accountName string, poolName string) (result netapp.VolumeListIterator, err error) + PoolChange(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, body netapp.PoolChangeRequest) (result netapp.VolumesPoolChangeFuture, err error) + ReInitializeReplication(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string) (result netapp.VolumesReInitializeReplicationFuture, err error) + ReplicationStatusMethod(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string) (result netapp.ReplicationStatus, err error) + ResyncReplication(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string) (result netapp.VolumesResyncReplicationFuture, err error) + Revert(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, body netapp.VolumeRevert) (result netapp.VolumesRevertFuture, err error) + Update(ctx context.Context, body netapp.VolumePatch, resourceGroupName string, accountName string, poolName string, volumeName string) (result netapp.VolumesUpdateFuture, err error) +} + +var _ VolumesClientAPI = (*netapp.VolumesClient)(nil) + +// SnapshotsClientAPI contains the set of methods on the SnapshotsClient type. +type SnapshotsClientAPI interface { + Create(ctx context.Context, body netapp.Snapshot, resourceGroupName string, accountName string, poolName string, volumeName string, snapshotName string) (result netapp.SnapshotsCreateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, snapshotName string) (result netapp.SnapshotsDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, snapshotName string) (result netapp.Snapshot, err error) + List(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string) (result netapp.SnapshotsList, err error) + Update(ctx context.Context, body interface{}, resourceGroupName string, accountName string, poolName string, volumeName string, snapshotName string) (result netapp.SnapshotsUpdateFuture, err error) +} + +var _ SnapshotsClientAPI = (*netapp.SnapshotsClient)(nil) + +// SnapshotPoliciesClientAPI contains the set of methods on the SnapshotPoliciesClient type. +type SnapshotPoliciesClientAPI interface { + Create(ctx context.Context, body netapp.SnapshotPolicy, resourceGroupName string, accountName string, snapshotPolicyName string) (result netapp.SnapshotPolicy, err error) + Delete(ctx context.Context, resourceGroupName string, accountName string, snapshotPolicyName string) (result netapp.SnapshotPoliciesDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, accountName string, snapshotPolicyName string) (result netapp.SnapshotPolicy, err error) + List(ctx context.Context, resourceGroupName string, accountName string) (result netapp.SnapshotPoliciesList, err error) + ListVolumes(ctx context.Context, resourceGroupName string, accountName string, snapshotPolicyName string) (result netapp.SnapshotPolicyVolumeList, err error) + Update(ctx context.Context, body netapp.SnapshotPolicyPatch, resourceGroupName string, accountName string, snapshotPolicyName string) (result netapp.SnapshotPoliciesUpdateFuture, err error) +} + +var _ SnapshotPoliciesClientAPI = (*netapp.SnapshotPoliciesClient)(nil) + +// BackupsClientAPI contains the set of methods on the BackupsClient type. +type BackupsClientAPI interface { + Create(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, backupName string, body netapp.Backup) (result netapp.BackupsCreateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, backupName string) (result netapp.BackupsDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, backupName string) (result netapp.Backup, err error) + GetStatus(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string) (result netapp.BackupStatus, err error) + List(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string) (result netapp.BackupsList, err error) + Update(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, backupName string, body *netapp.BackupPatch) (result netapp.BackupsUpdateFuture, err error) +} + +var _ BackupsClientAPI = (*netapp.BackupsClient)(nil) + +// AccountBackupsClientAPI contains the set of methods on the AccountBackupsClient type. +type AccountBackupsClientAPI interface { + Delete(ctx context.Context, resourceGroupName string, accountName string, backupName string) (result netapp.AccountBackupsDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, accountName string, backupName string) (result netapp.Backup, err error) + List(ctx context.Context, resourceGroupName string, accountName string) (result netapp.BackupsList, err error) +} + +var _ AccountBackupsClientAPI = (*netapp.AccountBackupsClient)(nil) + +// BackupPoliciesClientAPI contains the set of methods on the BackupPoliciesClient type. +type BackupPoliciesClientAPI interface { + Create(ctx context.Context, resourceGroupName string, accountName string, backupPolicyName string, body netapp.BackupPolicy) (result netapp.BackupPoliciesCreateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, accountName string, backupPolicyName string) (result netapp.BackupPoliciesDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, accountName string, backupPolicyName string) (result netapp.BackupPolicy, err error) + List(ctx context.Context, resourceGroupName string, accountName string) (result netapp.BackupPoliciesList, err error) + Update(ctx context.Context, resourceGroupName string, accountName string, backupPolicyName string, body netapp.BackupPolicyPatch) (result netapp.BackupPoliciesUpdateFuture, err error) +} + +var _ BackupPoliciesClientAPI = (*netapp.BackupPoliciesClient)(nil) + +// VaultsClientAPI contains the set of methods on the VaultsClient type. +type VaultsClientAPI interface { + List(ctx context.Context, resourceGroupName string, accountName string) (result netapp.VaultList, err error) +} + +var _ VaultsClientAPI = (*netapp.VaultsClient)(nil) diff --git a/services/preview/netapp/mgmt/2021-04-01-preview/netapp/operations.go b/services/preview/netapp/mgmt/2021-04-01-preview/netapp/operations.go new file mode 100644 index 000000000000..90c5eb1f15e6 --- /dev/null +++ b/services/preview/netapp/mgmt/2021-04-01-preview/netapp/operations.go @@ -0,0 +1,98 @@ +package netapp + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// OperationsClient is the microsoft NetApp Files Azure Resource Provider specification +type OperationsClient struct { + BaseClient +} + +// NewOperationsClient creates an instance of the OperationsClient client. +func NewOperationsClient(subscriptionID string) OperationsClient { + return NewOperationsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewOperationsClientWithBaseURI creates an instance of the OperationsClient client using a custom endpoint. Use this +// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewOperationsClientWithBaseURI(baseURI string, subscriptionID string) OperationsClient { + return OperationsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List lists all of the available Microsoft.NetApp Rest API operations +func (client OperationsClient) List(ctx context.Context) (result OperationListResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.List") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ListPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.OperationsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "netapp.OperationsClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.OperationsClient", "List", resp, "Failure responding to request") + return + } + + return +} + +// ListPreparer prepares the List request. +func (client OperationsClient) ListPreparer(ctx context.Context) (*http.Request, error) { + const APIVersion = "2021-04-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPath("/providers/Microsoft.NetApp/operations"), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client OperationsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client OperationsClient) ListResponder(resp *http.Response) (result OperationListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/preview/netapp/mgmt/2021-04-01-preview/netapp/pools.go b/services/preview/netapp/mgmt/2021-04-01-preview/netapp/pools.go new file mode 100644 index 000000000000..d4fd2a75b55c --- /dev/null +++ b/services/preview/netapp/mgmt/2021-04-01-preview/netapp/pools.go @@ -0,0 +1,548 @@ +package netapp + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// PoolsClient is the microsoft NetApp Files Azure Resource Provider specification +type PoolsClient struct { + BaseClient +} + +// NewPoolsClient creates an instance of the PoolsClient client. +func NewPoolsClient(subscriptionID string) PoolsClient { + return NewPoolsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewPoolsClientWithBaseURI creates an instance of the PoolsClient client using a custom endpoint. Use this when +// interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewPoolsClientWithBaseURI(baseURI string, subscriptionID string) PoolsClient { + return PoolsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate create or Update a capacity pool +// Parameters: +// body - capacity pool object supplied in the body of the operation. +// resourceGroupName - the name of the resource group. +// accountName - the name of the NetApp account +// poolName - the name of the capacity pool +func (client PoolsClient) CreateOrUpdate(ctx context.Context, body CapacityPool, resourceGroupName string, accountName string, poolName string) (result PoolsCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PoolsClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: body, + Constraints: []validation.Constraint{{Target: "body.Location", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "body.PoolProperties", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "body.PoolProperties.PoolID", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "body.PoolProperties.PoolID", Name: validation.MaxLength, Rule: 36, Chain: nil}, + {Target: "body.PoolProperties.PoolID", Name: validation.MinLength, Rule: 36, Chain: nil}, + {Target: "body.PoolProperties.PoolID", Name: validation.Pattern, Rule: `^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$`, Chain: nil}, + }}, + {Target: "body.PoolProperties.Size", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "body.PoolProperties.Size", Name: validation.InclusiveMaximum, Rule: int64(549755813888000), Chain: nil}, + {Target: "body.PoolProperties.Size", Name: validation.InclusiveMinimum, Rule: int64(4398046511104), Chain: nil}, + }}, + }}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: poolName, + Constraints: []validation.Constraint{{Target: "poolName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "poolName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "poolName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("netapp.PoolsClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, body, resourceGroupName, accountName, poolName) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.PoolsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.PoolsClient", "CreateOrUpdate", nil, "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client PoolsClient) CreateOrUpdatePreparer(ctx context.Context, body CapacityPool, resourceGroupName string, accountName string, poolName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "poolName": autorest.Encode("path", poolName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-04-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + body.ID = nil + body.Name = nil + body.Type = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}", pathParameters), + autorest.WithJSON(body), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client PoolsClient) CreateOrUpdateSender(req *http.Request) (future PoolsCreateOrUpdateFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client PoolsClient) CreateOrUpdateResponder(resp *http.Response) (result CapacityPool, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete delete the specified capacity pool +// Parameters: +// resourceGroupName - the name of the resource group. +// accountName - the name of the NetApp account +// poolName - the name of the capacity pool +func (client PoolsClient) Delete(ctx context.Context, resourceGroupName string, accountName string, poolName string) (result PoolsDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PoolsClient.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: poolName, + Constraints: []validation.Constraint{{Target: "poolName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "poolName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "poolName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("netapp.PoolsClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, accountName, poolName) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.PoolsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.PoolsClient", "Delete", nil, "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client PoolsClient) DeletePreparer(ctx context.Context, resourceGroupName string, accountName string, poolName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "poolName": autorest.Encode("path", poolName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-04-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client PoolsClient) DeleteSender(req *http.Request) (future PoolsDeleteFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client PoolsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get get details of the specified capacity pool +// Parameters: +// resourceGroupName - the name of the resource group. +// accountName - the name of the NetApp account +// poolName - the name of the capacity pool +func (client PoolsClient) Get(ctx context.Context, resourceGroupName string, accountName string, poolName string) (result CapacityPool, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PoolsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: poolName, + Constraints: []validation.Constraint{{Target: "poolName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "poolName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "poolName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("netapp.PoolsClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, accountName, poolName) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.PoolsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "netapp.PoolsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.PoolsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client PoolsClient) GetPreparer(ctx context.Context, resourceGroupName string, accountName string, poolName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "poolName": autorest.Encode("path", poolName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-04-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client PoolsClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client PoolsClient) GetResponder(resp *http.Response) (result CapacityPool, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List list all capacity pools in the NetApp Account +// Parameters: +// resourceGroupName - the name of the resource group. +// accountName - the name of the NetApp account +func (client PoolsClient) List(ctx context.Context, resourceGroupName string, accountName string) (result CapacityPoolListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PoolsClient.List") + defer func() { + sc := -1 + if result.cpl.Response.Response != nil { + sc = result.cpl.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("netapp.PoolsClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, accountName) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.PoolsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.cpl.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "netapp.PoolsClient", "List", resp, "Failure sending request") + return + } + + result.cpl, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.PoolsClient", "List", resp, "Failure responding to request") + return + } + if result.cpl.hasNextLink() && result.cpl.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client PoolsClient) ListPreparer(ctx context.Context, resourceGroupName string, accountName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-04-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client PoolsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client PoolsClient) ListResponder(resp *http.Response) (result CapacityPoolList, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client PoolsClient) listNextResults(ctx context.Context, lastResults CapacityPoolList) (result CapacityPoolList, err error) { + req, err := lastResults.capacityPoolListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "netapp.PoolsClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "netapp.PoolsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.PoolsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client PoolsClient) ListComplete(ctx context.Context, resourceGroupName string, accountName string) (result CapacityPoolListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PoolsClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, resourceGroupName, accountName) + return +} + +// Update patch the specified capacity pool +// Parameters: +// body - capacity pool object supplied in the body of the operation. +// resourceGroupName - the name of the resource group. +// accountName - the name of the NetApp account +// poolName - the name of the capacity pool +func (client PoolsClient) Update(ctx context.Context, body CapacityPoolPatch, resourceGroupName string, accountName string, poolName string) (result PoolsUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PoolsClient.Update") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: poolName, + Constraints: []validation.Constraint{{Target: "poolName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "poolName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "poolName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("netapp.PoolsClient", "Update", err.Error()) + } + + req, err := client.UpdatePreparer(ctx, body, resourceGroupName, accountName, poolName) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.PoolsClient", "Update", nil, "Failure preparing request") + return + } + + result, err = client.UpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.PoolsClient", "Update", nil, "Failure sending request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client PoolsClient) UpdatePreparer(ctx context.Context, body CapacityPoolPatch, resourceGroupName string, accountName string, poolName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "poolName": autorest.Encode("path", poolName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-04-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + body.ID = nil + body.Name = nil + body.Type = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}", pathParameters), + autorest.WithJSON(body), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client PoolsClient) UpdateSender(req *http.Request) (future PoolsUpdateFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client PoolsClient) UpdateResponder(resp *http.Response) (result CapacityPool, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/preview/netapp/mgmt/2021-04-01-preview/netapp/resource.go b/services/preview/netapp/mgmt/2021-04-01-preview/netapp/resource.go new file mode 100644 index 000000000000..47fc71159cd4 --- /dev/null +++ b/services/preview/netapp/mgmt/2021-04-01-preview/netapp/resource.go @@ -0,0 +1,284 @@ +package netapp + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// ResourceClient is the microsoft NetApp Files Azure Resource Provider specification +type ResourceClient struct { + BaseClient +} + +// NewResourceClient creates an instance of the ResourceClient client. +func NewResourceClient(subscriptionID string) ResourceClient { + return NewResourceClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewResourceClientWithBaseURI creates an instance of the ResourceClient client using a custom endpoint. Use this +// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewResourceClientWithBaseURI(baseURI string, subscriptionID string) ResourceClient { + return ResourceClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CheckFilePathAvailability check if a file path is available. +// Parameters: +// body - file path availability request. +// location - the location +func (client ResourceClient) CheckFilePathAvailability(ctx context.Context, body ResourceNameAvailabilityRequest, location string) (result CheckAvailabilityResponse, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ResourceClient.CheckFilePathAvailability") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: body, + Constraints: []validation.Constraint{{Target: "body.Name", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "body.ResourceGroup", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("netapp.ResourceClient", "CheckFilePathAvailability", err.Error()) + } + + req, err := client.CheckFilePathAvailabilityPreparer(ctx, body, location) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.ResourceClient", "CheckFilePathAvailability", nil, "Failure preparing request") + return + } + + resp, err := client.CheckFilePathAvailabilitySender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "netapp.ResourceClient", "CheckFilePathAvailability", resp, "Failure sending request") + return + } + + result, err = client.CheckFilePathAvailabilityResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.ResourceClient", "CheckFilePathAvailability", resp, "Failure responding to request") + return + } + + return +} + +// CheckFilePathAvailabilityPreparer prepares the CheckFilePathAvailability request. +func (client ResourceClient) CheckFilePathAvailabilityPreparer(ctx context.Context, body ResourceNameAvailabilityRequest, location string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "location": autorest.Encode("path", location), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-04-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.NetApp/locations/{location}/checkFilePathAvailability", pathParameters), + autorest.WithJSON(body), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CheckFilePathAvailabilitySender sends the CheckFilePathAvailability request. The method will close the +// http.Response Body if it receives an error. +func (client ResourceClient) CheckFilePathAvailabilitySender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CheckFilePathAvailabilityResponder handles the response to the CheckFilePathAvailability request. The method always +// closes the http.Response Body. +func (client ResourceClient) CheckFilePathAvailabilityResponder(resp *http.Response) (result CheckAvailabilityResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// CheckNameAvailability check if a resource name is available. +// Parameters: +// body - name availability request. +// location - the location +func (client ResourceClient) CheckNameAvailability(ctx context.Context, body ResourceNameAvailabilityRequest, location string) (result CheckAvailabilityResponse, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ResourceClient.CheckNameAvailability") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: body, + Constraints: []validation.Constraint{{Target: "body.Name", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "body.ResourceGroup", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("netapp.ResourceClient", "CheckNameAvailability", err.Error()) + } + + req, err := client.CheckNameAvailabilityPreparer(ctx, body, location) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.ResourceClient", "CheckNameAvailability", nil, "Failure preparing request") + return + } + + resp, err := client.CheckNameAvailabilitySender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "netapp.ResourceClient", "CheckNameAvailability", resp, "Failure sending request") + return + } + + result, err = client.CheckNameAvailabilityResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.ResourceClient", "CheckNameAvailability", resp, "Failure responding to request") + return + } + + return +} + +// CheckNameAvailabilityPreparer prepares the CheckNameAvailability request. +func (client ResourceClient) CheckNameAvailabilityPreparer(ctx context.Context, body ResourceNameAvailabilityRequest, location string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "location": autorest.Encode("path", location), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-04-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.NetApp/locations/{location}/checkNameAvailability", pathParameters), + autorest.WithJSON(body), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CheckNameAvailabilitySender sends the CheckNameAvailability request. The method will close the +// http.Response Body if it receives an error. +func (client ResourceClient) CheckNameAvailabilitySender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CheckNameAvailabilityResponder handles the response to the CheckNameAvailability request. The method always +// closes the http.Response Body. +func (client ResourceClient) CheckNameAvailabilityResponder(resp *http.Response) (result CheckAvailabilityResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// CheckQuotaAvailability check if a quota is available. +// Parameters: +// body - quota availability request. +// location - the location +func (client ResourceClient) CheckQuotaAvailability(ctx context.Context, body QuotaAvailabilityRequest, location string) (result CheckAvailabilityResponse, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ResourceClient.CheckQuotaAvailability") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: body, + Constraints: []validation.Constraint{{Target: "body.Name", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "body.ResourceGroup", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("netapp.ResourceClient", "CheckQuotaAvailability", err.Error()) + } + + req, err := client.CheckQuotaAvailabilityPreparer(ctx, body, location) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.ResourceClient", "CheckQuotaAvailability", nil, "Failure preparing request") + return + } + + resp, err := client.CheckQuotaAvailabilitySender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "netapp.ResourceClient", "CheckQuotaAvailability", resp, "Failure sending request") + return + } + + result, err = client.CheckQuotaAvailabilityResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.ResourceClient", "CheckQuotaAvailability", resp, "Failure responding to request") + return + } + + return +} + +// CheckQuotaAvailabilityPreparer prepares the CheckQuotaAvailability request. +func (client ResourceClient) CheckQuotaAvailabilityPreparer(ctx context.Context, body QuotaAvailabilityRequest, location string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "location": autorest.Encode("path", location), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-04-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.NetApp/locations/{location}/checkQuotaAvailability", pathParameters), + autorest.WithJSON(body), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CheckQuotaAvailabilitySender sends the CheckQuotaAvailability request. The method will close the +// http.Response Body if it receives an error. +func (client ResourceClient) CheckQuotaAvailabilitySender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CheckQuotaAvailabilityResponder handles the response to the CheckQuotaAvailability request. The method always +// closes the http.Response Body. +func (client ResourceClient) CheckQuotaAvailabilityResponder(resp *http.Response) (result CheckAvailabilityResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/preview/netapp/mgmt/2021-04-01-preview/netapp/resourceregioninfo.go b/services/preview/netapp/mgmt/2021-04-01-preview/netapp/resourceregioninfo.go new file mode 100644 index 000000000000..e196a907e18f --- /dev/null +++ b/services/preview/netapp/mgmt/2021-04-01-preview/netapp/resourceregioninfo.go @@ -0,0 +1,106 @@ +package netapp + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// ResourceRegionInfoClient is the microsoft NetApp Files Azure Resource Provider specification +type ResourceRegionInfoClient struct { + BaseClient +} + +// NewResourceRegionInfoClient creates an instance of the ResourceRegionInfoClient client. +func NewResourceRegionInfoClient(subscriptionID string) ResourceRegionInfoClient { + return NewResourceRegionInfoClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewResourceRegionInfoClientWithBaseURI creates an instance of the ResourceRegionInfoClient client using a custom +// endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure +// stack). +func NewResourceRegionInfoClientWithBaseURI(baseURI string, subscriptionID string) ResourceRegionInfoClient { + return ResourceRegionInfoClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Get provides storage to network proximity information. +// Parameters: +// location - the location +func (client ResourceRegionInfoClient) Get(ctx context.Context, location string) (result RegionInfo, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ResourceRegionInfoClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, location) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.ResourceRegionInfoClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "netapp.ResourceRegionInfoClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.ResourceRegionInfoClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client ResourceRegionInfoClient) GetPreparer(ctx context.Context, location string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "location": autorest.Encode("path", location), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-04-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.NetApp/locations/{location}/regionInfo", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client ResourceRegionInfoClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client ResourceRegionInfoClient) GetResponder(resp *http.Response) (result RegionInfo, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/preview/netapp/mgmt/2021-04-01-preview/netapp/snapshotpolicies.go b/services/preview/netapp/mgmt/2021-04-01-preview/netapp/snapshotpolicies.go new file mode 100644 index 000000000000..1e512233b245 --- /dev/null +++ b/services/preview/netapp/mgmt/2021-04-01-preview/netapp/snapshotpolicies.go @@ -0,0 +1,565 @@ +package netapp + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// SnapshotPoliciesClient is the microsoft NetApp Files Azure Resource Provider specification +type SnapshotPoliciesClient struct { + BaseClient +} + +// NewSnapshotPoliciesClient creates an instance of the SnapshotPoliciesClient client. +func NewSnapshotPoliciesClient(subscriptionID string) SnapshotPoliciesClient { + return NewSnapshotPoliciesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewSnapshotPoliciesClientWithBaseURI creates an instance of the SnapshotPoliciesClient client using a custom +// endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure +// stack). +func NewSnapshotPoliciesClientWithBaseURI(baseURI string, subscriptionID string) SnapshotPoliciesClient { + return SnapshotPoliciesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Create create a snapshot policy +// Parameters: +// body - snapshot policy object supplied in the body of the operation. +// resourceGroupName - the name of the resource group. +// accountName - the name of the NetApp account +// snapshotPolicyName - the name of the snapshot policy target +func (client SnapshotPoliciesClient) Create(ctx context.Context, body SnapshotPolicy, resourceGroupName string, accountName string, snapshotPolicyName string) (result SnapshotPolicy, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SnapshotPoliciesClient.Create") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: body, + Constraints: []validation.Constraint{{Target: "body.Location", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "body.SnapshotPolicyProperties", Name: validation.Null, Rule: true, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("netapp.SnapshotPoliciesClient", "Create", err.Error()) + } + + req, err := client.CreatePreparer(ctx, body, resourceGroupName, accountName, snapshotPolicyName) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.SnapshotPoliciesClient", "Create", nil, "Failure preparing request") + return + } + + resp, err := client.CreateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "netapp.SnapshotPoliciesClient", "Create", resp, "Failure sending request") + return + } + + result, err = client.CreateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.SnapshotPoliciesClient", "Create", resp, "Failure responding to request") + return + } + + return +} + +// CreatePreparer prepares the Create request. +func (client SnapshotPoliciesClient) CreatePreparer(ctx context.Context, body SnapshotPolicy, resourceGroupName string, accountName string, snapshotPolicyName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "snapshotPolicyName": autorest.Encode("path", snapshotPolicyName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-04-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + body.ID = nil + body.Name = nil + body.Type = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/snapshotPolicies/{snapshotPolicyName}", pathParameters), + autorest.WithJSON(body), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateSender sends the Create request. The method will close the +// http.Response Body if it receives an error. +func (client SnapshotPoliciesClient) CreateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CreateResponder handles the response to the Create request. The method always +// closes the http.Response Body. +func (client SnapshotPoliciesClient) CreateResponder(resp *http.Response) (result SnapshotPolicy, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete delete snapshot policy +// Parameters: +// resourceGroupName - the name of the resource group. +// accountName - the name of the NetApp account +// snapshotPolicyName - the name of the snapshot policy target +func (client SnapshotPoliciesClient) Delete(ctx context.Context, resourceGroupName string, accountName string, snapshotPolicyName string) (result SnapshotPoliciesDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SnapshotPoliciesClient.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("netapp.SnapshotPoliciesClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, accountName, snapshotPolicyName) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.SnapshotPoliciesClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.SnapshotPoliciesClient", "Delete", nil, "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client SnapshotPoliciesClient) DeletePreparer(ctx context.Context, resourceGroupName string, accountName string, snapshotPolicyName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "snapshotPolicyName": autorest.Encode("path", snapshotPolicyName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-04-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/snapshotPolicies/{snapshotPolicyName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client SnapshotPoliciesClient) DeleteSender(req *http.Request) (future SnapshotPoliciesDeleteFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client SnapshotPoliciesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get get a snapshot Policy +// Parameters: +// resourceGroupName - the name of the resource group. +// accountName - the name of the NetApp account +// snapshotPolicyName - the name of the snapshot policy target +func (client SnapshotPoliciesClient) Get(ctx context.Context, resourceGroupName string, accountName string, snapshotPolicyName string) (result SnapshotPolicy, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SnapshotPoliciesClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("netapp.SnapshotPoliciesClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, accountName, snapshotPolicyName) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.SnapshotPoliciesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "netapp.SnapshotPoliciesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.SnapshotPoliciesClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client SnapshotPoliciesClient) GetPreparer(ctx context.Context, resourceGroupName string, accountName string, snapshotPolicyName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "snapshotPolicyName": autorest.Encode("path", snapshotPolicyName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-04-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/snapshotPolicies/{snapshotPolicyName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client SnapshotPoliciesClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client SnapshotPoliciesClient) GetResponder(resp *http.Response) (result SnapshotPolicy, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List list snapshot policy +// Parameters: +// resourceGroupName - the name of the resource group. +// accountName - the name of the NetApp account +func (client SnapshotPoliciesClient) List(ctx context.Context, resourceGroupName string, accountName string) (result SnapshotPoliciesList, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SnapshotPoliciesClient.List") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("netapp.SnapshotPoliciesClient", "List", err.Error()) + } + + req, err := client.ListPreparer(ctx, resourceGroupName, accountName) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.SnapshotPoliciesClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "netapp.SnapshotPoliciesClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.SnapshotPoliciesClient", "List", resp, "Failure responding to request") + return + } + + return +} + +// ListPreparer prepares the List request. +func (client SnapshotPoliciesClient) ListPreparer(ctx context.Context, resourceGroupName string, accountName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-04-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/snapshotPolicies", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client SnapshotPoliciesClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client SnapshotPoliciesClient) ListResponder(resp *http.Response) (result SnapshotPoliciesList, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListVolumes get volumes associated with snapshot policy +// Parameters: +// resourceGroupName - the name of the resource group. +// accountName - the name of the NetApp account +// snapshotPolicyName - the name of the snapshot policy target +func (client SnapshotPoliciesClient) ListVolumes(ctx context.Context, resourceGroupName string, accountName string, snapshotPolicyName string) (result SnapshotPolicyVolumeList, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SnapshotPoliciesClient.ListVolumes") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("netapp.SnapshotPoliciesClient", "ListVolumes", err.Error()) + } + + req, err := client.ListVolumesPreparer(ctx, resourceGroupName, accountName, snapshotPolicyName) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.SnapshotPoliciesClient", "ListVolumes", nil, "Failure preparing request") + return + } + + resp, err := client.ListVolumesSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "netapp.SnapshotPoliciesClient", "ListVolumes", resp, "Failure sending request") + return + } + + result, err = client.ListVolumesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.SnapshotPoliciesClient", "ListVolumes", resp, "Failure responding to request") + return + } + + return +} + +// ListVolumesPreparer prepares the ListVolumes request. +func (client SnapshotPoliciesClient) ListVolumesPreparer(ctx context.Context, resourceGroupName string, accountName string, snapshotPolicyName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "snapshotPolicyName": autorest.Encode("path", snapshotPolicyName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-04-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/snapshotPolicies/{snapshotPolicyName}/volumes", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListVolumesSender sends the ListVolumes request. The method will close the +// http.Response Body if it receives an error. +func (client SnapshotPoliciesClient) ListVolumesSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListVolumesResponder handles the response to the ListVolumes request. The method always +// closes the http.Response Body. +func (client SnapshotPoliciesClient) ListVolumesResponder(resp *http.Response) (result SnapshotPolicyVolumeList, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Update patch a snapshot policy +// Parameters: +// body - snapshot policy object supplied in the body of the operation. +// resourceGroupName - the name of the resource group. +// accountName - the name of the NetApp account +// snapshotPolicyName - the name of the snapshot policy target +func (client SnapshotPoliciesClient) Update(ctx context.Context, body SnapshotPolicyPatch, resourceGroupName string, accountName string, snapshotPolicyName string) (result SnapshotPoliciesUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SnapshotPoliciesClient.Update") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("netapp.SnapshotPoliciesClient", "Update", err.Error()) + } + + req, err := client.UpdatePreparer(ctx, body, resourceGroupName, accountName, snapshotPolicyName) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.SnapshotPoliciesClient", "Update", nil, "Failure preparing request") + return + } + + result, err = client.UpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.SnapshotPoliciesClient", "Update", nil, "Failure sending request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client SnapshotPoliciesClient) UpdatePreparer(ctx context.Context, body SnapshotPolicyPatch, resourceGroupName string, accountName string, snapshotPolicyName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "snapshotPolicyName": autorest.Encode("path", snapshotPolicyName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-04-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + body.ID = nil + body.Name = nil + body.Type = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/snapshotPolicies/{snapshotPolicyName}", pathParameters), + autorest.WithJSON(body), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client SnapshotPoliciesClient) UpdateSender(req *http.Request) (future SnapshotPoliciesUpdateFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client SnapshotPoliciesClient) UpdateResponder(resp *http.Response) (result SnapshotPolicy, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/preview/netapp/mgmt/2021-04-01-preview/netapp/snapshots.go b/services/preview/netapp/mgmt/2021-04-01-preview/netapp/snapshots.go new file mode 100644 index 000000000000..4c1568fb378c --- /dev/null +++ b/services/preview/netapp/mgmt/2021-04-01-preview/netapp/snapshots.go @@ -0,0 +1,543 @@ +package netapp + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// SnapshotsClient is the microsoft NetApp Files Azure Resource Provider specification +type SnapshotsClient struct { + BaseClient +} + +// NewSnapshotsClient creates an instance of the SnapshotsClient client. +func NewSnapshotsClient(subscriptionID string) SnapshotsClient { + return NewSnapshotsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewSnapshotsClientWithBaseURI creates an instance of the SnapshotsClient client using a custom endpoint. Use this +// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewSnapshotsClientWithBaseURI(baseURI string, subscriptionID string) SnapshotsClient { + return SnapshotsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Create create the specified snapshot within the given volume +// Parameters: +// body - snapshot object supplied in the body of the operation. +// resourceGroupName - the name of the resource group. +// accountName - the name of the NetApp account +// poolName - the name of the capacity pool +// volumeName - the name of the volume +// snapshotName - the name of the mount target +func (client SnapshotsClient) Create(ctx context.Context, body Snapshot, resourceGroupName string, accountName string, poolName string, volumeName string, snapshotName string) (result SnapshotsCreateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SnapshotsClient.Create") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: body, + Constraints: []validation.Constraint{{Target: "body.Location", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "body.SnapshotProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "body.SnapshotProperties.SnapshotID", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "body.SnapshotProperties.SnapshotID", Name: validation.MaxLength, Rule: 36, Chain: nil}, + {Target: "body.SnapshotProperties.SnapshotID", Name: validation.MinLength, Rule: 36, Chain: nil}, + {Target: "body.SnapshotProperties.SnapshotID", Name: validation.Pattern, Rule: `^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$`, Chain: nil}, + }}, + }}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: poolName, + Constraints: []validation.Constraint{{Target: "poolName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "poolName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "poolName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}, + {TargetValue: volumeName, + Constraints: []validation.Constraint{{Target: "volumeName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "volumeName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "volumeName", Name: validation.Pattern, Rule: `^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("netapp.SnapshotsClient", "Create", err.Error()) + } + + req, err := client.CreatePreparer(ctx, body, resourceGroupName, accountName, poolName, volumeName, snapshotName) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.SnapshotsClient", "Create", nil, "Failure preparing request") + return + } + + result, err = client.CreateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.SnapshotsClient", "Create", nil, "Failure sending request") + return + } + + return +} + +// CreatePreparer prepares the Create request. +func (client SnapshotsClient) CreatePreparer(ctx context.Context, body Snapshot, resourceGroupName string, accountName string, poolName string, volumeName string, snapshotName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "poolName": autorest.Encode("path", poolName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "snapshotName": autorest.Encode("path", snapshotName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "volumeName": autorest.Encode("path", volumeName), + } + + const APIVersion = "2021-04-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + body.ID = nil + body.Name = nil + body.Type = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/snapshots/{snapshotName}", pathParameters), + autorest.WithJSON(body), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateSender sends the Create request. The method will close the +// http.Response Body if it receives an error. +func (client SnapshotsClient) CreateSender(req *http.Request) (future SnapshotsCreateFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateResponder handles the response to the Create request. The method always +// closes the http.Response Body. +func (client SnapshotsClient) CreateResponder(resp *http.Response) (result Snapshot, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete delete snapshot +// Parameters: +// resourceGroupName - the name of the resource group. +// accountName - the name of the NetApp account +// poolName - the name of the capacity pool +// volumeName - the name of the volume +// snapshotName - the name of the mount target +func (client SnapshotsClient) Delete(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, snapshotName string) (result SnapshotsDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SnapshotsClient.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: poolName, + Constraints: []validation.Constraint{{Target: "poolName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "poolName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "poolName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}, + {TargetValue: volumeName, + Constraints: []validation.Constraint{{Target: "volumeName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "volumeName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "volumeName", Name: validation.Pattern, Rule: `^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("netapp.SnapshotsClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, accountName, poolName, volumeName, snapshotName) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.SnapshotsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.SnapshotsClient", "Delete", nil, "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client SnapshotsClient) DeletePreparer(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, snapshotName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "poolName": autorest.Encode("path", poolName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "snapshotName": autorest.Encode("path", snapshotName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "volumeName": autorest.Encode("path", volumeName), + } + + const APIVersion = "2021-04-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/snapshots/{snapshotName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client SnapshotsClient) DeleteSender(req *http.Request) (future SnapshotsDeleteFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client SnapshotsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get get details of the specified snapshot +// Parameters: +// resourceGroupName - the name of the resource group. +// accountName - the name of the NetApp account +// poolName - the name of the capacity pool +// volumeName - the name of the volume +// snapshotName - the name of the mount target +func (client SnapshotsClient) Get(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, snapshotName string) (result Snapshot, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SnapshotsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: poolName, + Constraints: []validation.Constraint{{Target: "poolName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "poolName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "poolName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}, + {TargetValue: volumeName, + Constraints: []validation.Constraint{{Target: "volumeName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "volumeName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "volumeName", Name: validation.Pattern, Rule: `^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("netapp.SnapshotsClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, accountName, poolName, volumeName, snapshotName) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.SnapshotsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "netapp.SnapshotsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.SnapshotsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client SnapshotsClient) GetPreparer(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, snapshotName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "poolName": autorest.Encode("path", poolName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "snapshotName": autorest.Encode("path", snapshotName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "volumeName": autorest.Encode("path", volumeName), + } + + const APIVersion = "2021-04-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/snapshots/{snapshotName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client SnapshotsClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client SnapshotsClient) GetResponder(resp *http.Response) (result Snapshot, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List list all snapshots associated with the volume +// Parameters: +// resourceGroupName - the name of the resource group. +// accountName - the name of the NetApp account +// poolName - the name of the capacity pool +// volumeName - the name of the volume +func (client SnapshotsClient) List(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string) (result SnapshotsList, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SnapshotsClient.List") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: poolName, + Constraints: []validation.Constraint{{Target: "poolName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "poolName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "poolName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}, + {TargetValue: volumeName, + Constraints: []validation.Constraint{{Target: "volumeName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "volumeName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "volumeName", Name: validation.Pattern, Rule: `^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("netapp.SnapshotsClient", "List", err.Error()) + } + + req, err := client.ListPreparer(ctx, resourceGroupName, accountName, poolName, volumeName) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.SnapshotsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "netapp.SnapshotsClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.SnapshotsClient", "List", resp, "Failure responding to request") + return + } + + return +} + +// ListPreparer prepares the List request. +func (client SnapshotsClient) ListPreparer(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "poolName": autorest.Encode("path", poolName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "volumeName": autorest.Encode("path", volumeName), + } + + const APIVersion = "2021-04-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/snapshots", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client SnapshotsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client SnapshotsClient) ListResponder(resp *http.Response) (result SnapshotsList, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Update patch a snapshot +// Parameters: +// body - snapshot object supplied in the body of the operation. +// resourceGroupName - the name of the resource group. +// accountName - the name of the NetApp account +// poolName - the name of the capacity pool +// volumeName - the name of the volume +// snapshotName - the name of the mount target +func (client SnapshotsClient) Update(ctx context.Context, body interface{}, resourceGroupName string, accountName string, poolName string, volumeName string, snapshotName string) (result SnapshotsUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SnapshotsClient.Update") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: poolName, + Constraints: []validation.Constraint{{Target: "poolName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "poolName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "poolName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}, + {TargetValue: volumeName, + Constraints: []validation.Constraint{{Target: "volumeName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "volumeName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "volumeName", Name: validation.Pattern, Rule: `^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("netapp.SnapshotsClient", "Update", err.Error()) + } + + req, err := client.UpdatePreparer(ctx, body, resourceGroupName, accountName, poolName, volumeName, snapshotName) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.SnapshotsClient", "Update", nil, "Failure preparing request") + return + } + + result, err = client.UpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.SnapshotsClient", "Update", nil, "Failure sending request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client SnapshotsClient) UpdatePreparer(ctx context.Context, body interface{}, resourceGroupName string, accountName string, poolName string, volumeName string, snapshotName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "poolName": autorest.Encode("path", poolName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "snapshotName": autorest.Encode("path", snapshotName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "volumeName": autorest.Encode("path", volumeName), + } + + const APIVersion = "2021-04-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/snapshots/{snapshotName}", pathParameters), + autorest.WithJSON(body), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client SnapshotsClient) UpdateSender(req *http.Request) (future SnapshotsUpdateFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client SnapshotsClient) UpdateResponder(resp *http.Response) (result Snapshot, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/preview/netapp/mgmt/2021-04-01-preview/netapp/vaults.go b/services/preview/netapp/mgmt/2021-04-01-preview/netapp/vaults.go new file mode 100644 index 000000000000..ff7a618fc9be --- /dev/null +++ b/services/preview/netapp/mgmt/2021-04-01-preview/netapp/vaults.go @@ -0,0 +1,116 @@ +package netapp + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// VaultsClient is the microsoft NetApp Files Azure Resource Provider specification +type VaultsClient struct { + BaseClient +} + +// NewVaultsClient creates an instance of the VaultsClient client. +func NewVaultsClient(subscriptionID string) VaultsClient { + return NewVaultsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewVaultsClientWithBaseURI creates an instance of the VaultsClient client using a custom endpoint. Use this when +// interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewVaultsClientWithBaseURI(baseURI string, subscriptionID string) VaultsClient { + return VaultsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List list vaults for a Netapp Account +// Parameters: +// resourceGroupName - the name of the resource group. +// accountName - the name of the NetApp account +func (client VaultsClient) List(ctx context.Context, resourceGroupName string, accountName string) (result VaultList, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VaultsClient.List") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("netapp.VaultsClient", "List", err.Error()) + } + + req, err := client.ListPreparer(ctx, resourceGroupName, accountName) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.VaultsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "netapp.VaultsClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.VaultsClient", "List", resp, "Failure responding to request") + return + } + + return +} + +// ListPreparer prepares the List request. +func (client VaultsClient) ListPreparer(ctx context.Context, resourceGroupName string, accountName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-04-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/vaults", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client VaultsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client VaultsClient) ListResponder(resp *http.Response) (result VaultList, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/preview/netapp/mgmt/2021-04-01-preview/netapp/version.go b/services/preview/netapp/mgmt/2021-04-01-preview/netapp/version.go new file mode 100644 index 000000000000..469631b19bc8 --- /dev/null +++ b/services/preview/netapp/mgmt/2021-04-01-preview/netapp/version.go @@ -0,0 +1,19 @@ +package netapp + +import "github.com/Azure/azure-sdk-for-go/version" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// UserAgent returns the UserAgent string to use when sending http.Requests. +func UserAgent() string { + return "Azure-SDK-For-Go/" + Version() + " netapp/2021-04-01-preview" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return version.Number +} diff --git a/services/preview/netapp/mgmt/2021-04-01-preview/netapp/volumes.go b/services/preview/netapp/mgmt/2021-04-01-preview/netapp/volumes.go new file mode 100644 index 000000000000..cea770906b54 --- /dev/null +++ b/services/preview/netapp/mgmt/2021-04-01-preview/netapp/volumes.go @@ -0,0 +1,1401 @@ +package netapp + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// VolumesClient is the microsoft NetApp Files Azure Resource Provider specification +type VolumesClient struct { + BaseClient +} + +// NewVolumesClient creates an instance of the VolumesClient client. +func NewVolumesClient(subscriptionID string) VolumesClient { + return NewVolumesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewVolumesClientWithBaseURI creates an instance of the VolumesClient client using a custom endpoint. Use this when +// interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewVolumesClientWithBaseURI(baseURI string, subscriptionID string) VolumesClient { + return VolumesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// AuthorizeReplication authorize the replication connection on the source volume +// Parameters: +// resourceGroupName - the name of the resource group. +// accountName - the name of the NetApp account +// poolName - the name of the capacity pool +// volumeName - the name of the volume +// body - authorize request object supplied in the body of the operation. +func (client VolumesClient) AuthorizeReplication(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, body AuthorizeRequest) (result VolumesAuthorizeReplicationFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VolumesClient.AuthorizeReplication") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: poolName, + Constraints: []validation.Constraint{{Target: "poolName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "poolName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "poolName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}, + {TargetValue: volumeName, + Constraints: []validation.Constraint{{Target: "volumeName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "volumeName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "volumeName", Name: validation.Pattern, Rule: `^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("netapp.VolumesClient", "AuthorizeReplication", err.Error()) + } + + req, err := client.AuthorizeReplicationPreparer(ctx, resourceGroupName, accountName, poolName, volumeName, body) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.VolumesClient", "AuthorizeReplication", nil, "Failure preparing request") + return + } + + result, err = client.AuthorizeReplicationSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.VolumesClient", "AuthorizeReplication", nil, "Failure sending request") + return + } + + return +} + +// AuthorizeReplicationPreparer prepares the AuthorizeReplication request. +func (client VolumesClient) AuthorizeReplicationPreparer(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, body AuthorizeRequest) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "poolName": autorest.Encode("path", poolName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "volumeName": autorest.Encode("path", volumeName), + } + + const APIVersion = "2021-04-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/authorizeReplication", pathParameters), + autorest.WithJSON(body), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// AuthorizeReplicationSender sends the AuthorizeReplication request. The method will close the +// http.Response Body if it receives an error. +func (client VolumesClient) AuthorizeReplicationSender(req *http.Request) (future VolumesAuthorizeReplicationFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// AuthorizeReplicationResponder handles the response to the AuthorizeReplication request. The method always +// closes the http.Response Body. +func (client VolumesClient) AuthorizeReplicationResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// BreakReplication break the replication connection on the destination volume +// Parameters: +// resourceGroupName - the name of the resource group. +// accountName - the name of the NetApp account +// poolName - the name of the capacity pool +// volumeName - the name of the volume +// body - optional body to force break the replication. +func (client VolumesClient) BreakReplication(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, body *BreakReplicationRequest) (result VolumesBreakReplicationFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VolumesClient.BreakReplication") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: poolName, + Constraints: []validation.Constraint{{Target: "poolName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "poolName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "poolName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}, + {TargetValue: volumeName, + Constraints: []validation.Constraint{{Target: "volumeName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "volumeName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "volumeName", Name: validation.Pattern, Rule: `^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("netapp.VolumesClient", "BreakReplication", err.Error()) + } + + req, err := client.BreakReplicationPreparer(ctx, resourceGroupName, accountName, poolName, volumeName, body) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.VolumesClient", "BreakReplication", nil, "Failure preparing request") + return + } + + result, err = client.BreakReplicationSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.VolumesClient", "BreakReplication", nil, "Failure sending request") + return + } + + return +} + +// BreakReplicationPreparer prepares the BreakReplication request. +func (client VolumesClient) BreakReplicationPreparer(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, body *BreakReplicationRequest) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "poolName": autorest.Encode("path", poolName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "volumeName": autorest.Encode("path", volumeName), + } + + const APIVersion = "2021-04-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/breakReplication", pathParameters), + autorest.WithQueryParameters(queryParameters)) + if body != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithJSON(body)) + } + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// BreakReplicationSender sends the BreakReplication request. The method will close the +// http.Response Body if it receives an error. +func (client VolumesClient) BreakReplicationSender(req *http.Request) (future VolumesBreakReplicationFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// BreakReplicationResponder handles the response to the BreakReplication request. The method always +// closes the http.Response Body. +func (client VolumesClient) BreakReplicationResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// CreateOrUpdate create or update the specified volume within the capacity pool +// Parameters: +// body - volume object supplied in the body of the operation. +// resourceGroupName - the name of the resource group. +// accountName - the name of the NetApp account +// poolName - the name of the capacity pool +// volumeName - the name of the volume +func (client VolumesClient) CreateOrUpdate(ctx context.Context, body Volume, resourceGroupName string, accountName string, poolName string, volumeName string) (result VolumesCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VolumesClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: body, + Constraints: []validation.Constraint{{Target: "body.Location", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "body.VolumeProperties", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "body.VolumeProperties.FileSystemID", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "body.VolumeProperties.FileSystemID", Name: validation.MaxLength, Rule: 36, Chain: nil}, + {Target: "body.VolumeProperties.FileSystemID", Name: validation.MinLength, Rule: 36, Chain: nil}, + {Target: "body.VolumeProperties.FileSystemID", Name: validation.Pattern, Rule: `^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$`, Chain: nil}, + }}, + {Target: "body.VolumeProperties.CreationToken", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "body.VolumeProperties.CreationToken", Name: validation.MaxLength, Rule: 80, Chain: nil}, + {Target: "body.VolumeProperties.CreationToken", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "body.VolumeProperties.CreationToken", Name: validation.Pattern, Rule: `^[a-zA-Z][a-zA-Z0-9\-]{0,79}$`, Chain: nil}, + }}, + {Target: "body.VolumeProperties.UsageThreshold", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "body.VolumeProperties.UsageThreshold", Name: validation.InclusiveMaximum, Rule: int64(109951162777600), Chain: nil}, + {Target: "body.VolumeProperties.UsageThreshold", Name: validation.InclusiveMinimum, Rule: int64(107374182400), Chain: nil}, + }}, + {Target: "body.VolumeProperties.SnapshotID", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "body.VolumeProperties.SnapshotID", Name: validation.MaxLength, Rule: 36, Chain: nil}, + {Target: "body.VolumeProperties.SnapshotID", Name: validation.MinLength, Rule: 36, Chain: nil}, + {Target: "body.VolumeProperties.SnapshotID", Name: validation.Pattern, Rule: `^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}|(\\?([^\/]*[\/])*)([^\/]+)$`, Chain: nil}, + }}, + {Target: "body.VolumeProperties.BackupID", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "body.VolumeProperties.BackupID", Name: validation.MaxLength, Rule: 36, Chain: nil}, + {Target: "body.VolumeProperties.BackupID", Name: validation.MinLength, Rule: 36, Chain: nil}, + {Target: "body.VolumeProperties.BackupID", Name: validation.Pattern, Rule: `^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}|(\\?([^\/]*[\/])*)([^\/]+)$`, Chain: nil}, + }}, + {Target: "body.VolumeProperties.SubnetID", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "body.VolumeProperties.NetworkSiblingSetID", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "body.VolumeProperties.NetworkSiblingSetID", Name: validation.MaxLength, Rule: 36, Chain: nil}, + {Target: "body.VolumeProperties.NetworkSiblingSetID", Name: validation.MinLength, Rule: 36, Chain: nil}, + {Target: "body.VolumeProperties.NetworkSiblingSetID", Name: validation.Pattern, Rule: `^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$`, Chain: nil}, + }}, + {Target: "body.VolumeProperties.DataProtection", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "body.VolumeProperties.DataProtection.Replication", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "body.VolumeProperties.DataProtection.Replication.RemoteVolumeResourceID", Name: validation.Null, Rule: true, Chain: nil}}}, + }}, + {Target: "body.VolumeProperties.ThroughputMibps", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "body.VolumeProperties.ThroughputMibps", Name: validation.InclusiveMaximum, Rule: float64(4500), Chain: nil}, + {Target: "body.VolumeProperties.ThroughputMibps", Name: validation.InclusiveMinimum, Rule: float64(0), Chain: nil}, + }}, + }}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: poolName, + Constraints: []validation.Constraint{{Target: "poolName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "poolName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "poolName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}, + {TargetValue: volumeName, + Constraints: []validation.Constraint{{Target: "volumeName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "volumeName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "volumeName", Name: validation.Pattern, Rule: `^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("netapp.VolumesClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, body, resourceGroupName, accountName, poolName, volumeName) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.VolumesClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.VolumesClient", "CreateOrUpdate", nil, "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client VolumesClient) CreateOrUpdatePreparer(ctx context.Context, body Volume, resourceGroupName string, accountName string, poolName string, volumeName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "poolName": autorest.Encode("path", poolName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "volumeName": autorest.Encode("path", volumeName), + } + + const APIVersion = "2021-04-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + body.ID = nil + body.Name = nil + body.Type = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}", pathParameters), + autorest.WithJSON(body), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client VolumesClient) CreateOrUpdateSender(req *http.Request) (future VolumesCreateOrUpdateFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client VolumesClient) CreateOrUpdateResponder(resp *http.Response) (result Volume, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete delete the specified volume +// Parameters: +// resourceGroupName - the name of the resource group. +// accountName - the name of the NetApp account +// poolName - the name of the capacity pool +// volumeName - the name of the volume +func (client VolumesClient) Delete(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string) (result VolumesDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VolumesClient.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: poolName, + Constraints: []validation.Constraint{{Target: "poolName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "poolName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "poolName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}, + {TargetValue: volumeName, + Constraints: []validation.Constraint{{Target: "volumeName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "volumeName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "volumeName", Name: validation.Pattern, Rule: `^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("netapp.VolumesClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, accountName, poolName, volumeName) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.VolumesClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.VolumesClient", "Delete", nil, "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client VolumesClient) DeletePreparer(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "poolName": autorest.Encode("path", poolName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "volumeName": autorest.Encode("path", volumeName), + } + + const APIVersion = "2021-04-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client VolumesClient) DeleteSender(req *http.Request) (future VolumesDeleteFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client VolumesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// DeleteReplication delete the replication connection on the destination volume, and send release to the source +// replication +// Parameters: +// resourceGroupName - the name of the resource group. +// accountName - the name of the NetApp account +// poolName - the name of the capacity pool +// volumeName - the name of the volume +func (client VolumesClient) DeleteReplication(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string) (result VolumesDeleteReplicationFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VolumesClient.DeleteReplication") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: poolName, + Constraints: []validation.Constraint{{Target: "poolName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "poolName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "poolName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}, + {TargetValue: volumeName, + Constraints: []validation.Constraint{{Target: "volumeName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "volumeName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "volumeName", Name: validation.Pattern, Rule: `^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("netapp.VolumesClient", "DeleteReplication", err.Error()) + } + + req, err := client.DeleteReplicationPreparer(ctx, resourceGroupName, accountName, poolName, volumeName) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.VolumesClient", "DeleteReplication", nil, "Failure preparing request") + return + } + + result, err = client.DeleteReplicationSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.VolumesClient", "DeleteReplication", nil, "Failure sending request") + return + } + + return +} + +// DeleteReplicationPreparer prepares the DeleteReplication request. +func (client VolumesClient) DeleteReplicationPreparer(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "poolName": autorest.Encode("path", poolName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "volumeName": autorest.Encode("path", volumeName), + } + + const APIVersion = "2021-04-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/deleteReplication", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteReplicationSender sends the DeleteReplication request. The method will close the +// http.Response Body if it receives an error. +func (client VolumesClient) DeleteReplicationSender(req *http.Request) (future VolumesDeleteReplicationFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteReplicationResponder handles the response to the DeleteReplication request. The method always +// closes the http.Response Body. +func (client VolumesClient) DeleteReplicationResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get get the details of the specified volume +// Parameters: +// resourceGroupName - the name of the resource group. +// accountName - the name of the NetApp account +// poolName - the name of the capacity pool +// volumeName - the name of the volume +func (client VolumesClient) Get(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string) (result Volume, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VolumesClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: poolName, + Constraints: []validation.Constraint{{Target: "poolName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "poolName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "poolName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}, + {TargetValue: volumeName, + Constraints: []validation.Constraint{{Target: "volumeName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "volumeName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "volumeName", Name: validation.Pattern, Rule: `^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("netapp.VolumesClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, accountName, poolName, volumeName) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.VolumesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "netapp.VolumesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.VolumesClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client VolumesClient) GetPreparer(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "poolName": autorest.Encode("path", poolName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "volumeName": autorest.Encode("path", volumeName), + } + + const APIVersion = "2021-04-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client VolumesClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client VolumesClient) GetResponder(resp *http.Response) (result Volume, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List list all volumes within the capacity pool +// Parameters: +// resourceGroupName - the name of the resource group. +// accountName - the name of the NetApp account +// poolName - the name of the capacity pool +func (client VolumesClient) List(ctx context.Context, resourceGroupName string, accountName string, poolName string) (result VolumeListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VolumesClient.List") + defer func() { + sc := -1 + if result.vl.Response.Response != nil { + sc = result.vl.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: poolName, + Constraints: []validation.Constraint{{Target: "poolName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "poolName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "poolName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("netapp.VolumesClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, accountName, poolName) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.VolumesClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.vl.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "netapp.VolumesClient", "List", resp, "Failure sending request") + return + } + + result.vl, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.VolumesClient", "List", resp, "Failure responding to request") + return + } + if result.vl.hasNextLink() && result.vl.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client VolumesClient) ListPreparer(ctx context.Context, resourceGroupName string, accountName string, poolName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "poolName": autorest.Encode("path", poolName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-04-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client VolumesClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client VolumesClient) ListResponder(resp *http.Response) (result VolumeList, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client VolumesClient) listNextResults(ctx context.Context, lastResults VolumeList) (result VolumeList, err error) { + req, err := lastResults.volumeListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "netapp.VolumesClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "netapp.VolumesClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.VolumesClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client VolumesClient) ListComplete(ctx context.Context, resourceGroupName string, accountName string, poolName string) (result VolumeListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VolumesClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, resourceGroupName, accountName, poolName) + return +} + +// PoolChange moves volume to another pool +// Parameters: +// resourceGroupName - the name of the resource group. +// accountName - the name of the NetApp account +// poolName - the name of the capacity pool +// volumeName - the name of the volume +// body - move volume to the pool supplied in the body of the operation. +func (client VolumesClient) PoolChange(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, body PoolChangeRequest) (result VolumesPoolChangeFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VolumesClient.PoolChange") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: poolName, + Constraints: []validation.Constraint{{Target: "poolName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "poolName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "poolName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}, + {TargetValue: volumeName, + Constraints: []validation.Constraint{{Target: "volumeName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "volumeName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "volumeName", Name: validation.Pattern, Rule: `^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}, + {TargetValue: body, + Constraints: []validation.Constraint{{Target: "body.NewPoolResourceID", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("netapp.VolumesClient", "PoolChange", err.Error()) + } + + req, err := client.PoolChangePreparer(ctx, resourceGroupName, accountName, poolName, volumeName, body) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.VolumesClient", "PoolChange", nil, "Failure preparing request") + return + } + + result, err = client.PoolChangeSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.VolumesClient", "PoolChange", nil, "Failure sending request") + return + } + + return +} + +// PoolChangePreparer prepares the PoolChange request. +func (client VolumesClient) PoolChangePreparer(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, body PoolChangeRequest) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "poolName": autorest.Encode("path", poolName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "volumeName": autorest.Encode("path", volumeName), + } + + const APIVersion = "2021-04-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/poolChange", pathParameters), + autorest.WithJSON(body), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// PoolChangeSender sends the PoolChange request. The method will close the +// http.Response Body if it receives an error. +func (client VolumesClient) PoolChangeSender(req *http.Request) (future VolumesPoolChangeFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// PoolChangeResponder handles the response to the PoolChange request. The method always +// closes the http.Response Body. +func (client VolumesClient) PoolChangeResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// ReInitializeReplication re-Initializes the replication connection on the destination volume +// Parameters: +// resourceGroupName - the name of the resource group. +// accountName - the name of the NetApp account +// poolName - the name of the capacity pool +// volumeName - the name of the volume +func (client VolumesClient) ReInitializeReplication(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string) (result VolumesReInitializeReplicationFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VolumesClient.ReInitializeReplication") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: poolName, + Constraints: []validation.Constraint{{Target: "poolName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "poolName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "poolName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}, + {TargetValue: volumeName, + Constraints: []validation.Constraint{{Target: "volumeName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "volumeName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "volumeName", Name: validation.Pattern, Rule: `^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("netapp.VolumesClient", "ReInitializeReplication", err.Error()) + } + + req, err := client.ReInitializeReplicationPreparer(ctx, resourceGroupName, accountName, poolName, volumeName) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.VolumesClient", "ReInitializeReplication", nil, "Failure preparing request") + return + } + + result, err = client.ReInitializeReplicationSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.VolumesClient", "ReInitializeReplication", nil, "Failure sending request") + return + } + + return +} + +// ReInitializeReplicationPreparer prepares the ReInitializeReplication request. +func (client VolumesClient) ReInitializeReplicationPreparer(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "poolName": autorest.Encode("path", poolName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "volumeName": autorest.Encode("path", volumeName), + } + + const APIVersion = "2021-04-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/reinitializeReplication", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ReInitializeReplicationSender sends the ReInitializeReplication request. The method will close the +// http.Response Body if it receives an error. +func (client VolumesClient) ReInitializeReplicationSender(req *http.Request) (future VolumesReInitializeReplicationFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// ReInitializeReplicationResponder handles the response to the ReInitializeReplication request. The method always +// closes the http.Response Body. +func (client VolumesClient) ReInitializeReplicationResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// ReplicationStatusMethod get the status of the replication +// Parameters: +// resourceGroupName - the name of the resource group. +// accountName - the name of the NetApp account +// poolName - the name of the capacity pool +// volumeName - the name of the volume +func (client VolumesClient) ReplicationStatusMethod(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string) (result ReplicationStatus, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VolumesClient.ReplicationStatusMethod") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: poolName, + Constraints: []validation.Constraint{{Target: "poolName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "poolName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "poolName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}, + {TargetValue: volumeName, + Constraints: []validation.Constraint{{Target: "volumeName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "volumeName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "volumeName", Name: validation.Pattern, Rule: `^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("netapp.VolumesClient", "ReplicationStatusMethod", err.Error()) + } + + req, err := client.ReplicationStatusMethodPreparer(ctx, resourceGroupName, accountName, poolName, volumeName) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.VolumesClient", "ReplicationStatusMethod", nil, "Failure preparing request") + return + } + + resp, err := client.ReplicationStatusMethodSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "netapp.VolumesClient", "ReplicationStatusMethod", resp, "Failure sending request") + return + } + + result, err = client.ReplicationStatusMethodResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.VolumesClient", "ReplicationStatusMethod", resp, "Failure responding to request") + return + } + + return +} + +// ReplicationStatusMethodPreparer prepares the ReplicationStatusMethod request. +func (client VolumesClient) ReplicationStatusMethodPreparer(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "poolName": autorest.Encode("path", poolName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "volumeName": autorest.Encode("path", volumeName), + } + + const APIVersion = "2021-04-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/replicationStatus", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ReplicationStatusMethodSender sends the ReplicationStatusMethod request. The method will close the +// http.Response Body if it receives an error. +func (client VolumesClient) ReplicationStatusMethodSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ReplicationStatusMethodResponder handles the response to the ReplicationStatusMethod request. The method always +// closes the http.Response Body. +func (client VolumesClient) ReplicationStatusMethodResponder(resp *http.Response) (result ReplicationStatus, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// 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. +// Parameters: +// resourceGroupName - the name of the resource group. +// accountName - the name of the NetApp account +// poolName - the name of the capacity pool +// volumeName - the name of the volume +func (client VolumesClient) ResyncReplication(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string) (result VolumesResyncReplicationFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VolumesClient.ResyncReplication") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: poolName, + Constraints: []validation.Constraint{{Target: "poolName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "poolName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "poolName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}, + {TargetValue: volumeName, + Constraints: []validation.Constraint{{Target: "volumeName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "volumeName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "volumeName", Name: validation.Pattern, Rule: `^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("netapp.VolumesClient", "ResyncReplication", err.Error()) + } + + req, err := client.ResyncReplicationPreparer(ctx, resourceGroupName, accountName, poolName, volumeName) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.VolumesClient", "ResyncReplication", nil, "Failure preparing request") + return + } + + result, err = client.ResyncReplicationSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.VolumesClient", "ResyncReplication", nil, "Failure sending request") + return + } + + return +} + +// ResyncReplicationPreparer prepares the ResyncReplication request. +func (client VolumesClient) ResyncReplicationPreparer(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "poolName": autorest.Encode("path", poolName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "volumeName": autorest.Encode("path", volumeName), + } + + const APIVersion = "2021-04-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/resyncReplication", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ResyncReplicationSender sends the ResyncReplication request. The method will close the +// http.Response Body if it receives an error. +func (client VolumesClient) ResyncReplicationSender(req *http.Request) (future VolumesResyncReplicationFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// ResyncReplicationResponder handles the response to the ResyncReplication request. The method always +// closes the http.Response Body. +func (client VolumesClient) ResyncReplicationResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// Revert revert a volume to the snapshot specified in the body +// Parameters: +// resourceGroupName - the name of the resource group. +// accountName - the name of the NetApp account +// poolName - the name of the capacity pool +// volumeName - the name of the volume +// body - object for snapshot to revert supplied in the body of the operation. +func (client VolumesClient) Revert(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, body VolumeRevert) (result VolumesRevertFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VolumesClient.Revert") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: poolName, + Constraints: []validation.Constraint{{Target: "poolName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "poolName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "poolName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}, + {TargetValue: volumeName, + Constraints: []validation.Constraint{{Target: "volumeName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "volumeName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "volumeName", Name: validation.Pattern, Rule: `^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("netapp.VolumesClient", "Revert", err.Error()) + } + + req, err := client.RevertPreparer(ctx, resourceGroupName, accountName, poolName, volumeName, body) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.VolumesClient", "Revert", nil, "Failure preparing request") + return + } + + result, err = client.RevertSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.VolumesClient", "Revert", nil, "Failure sending request") + return + } + + return +} + +// RevertPreparer prepares the Revert request. +func (client VolumesClient) RevertPreparer(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, body VolumeRevert) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "poolName": autorest.Encode("path", poolName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "volumeName": autorest.Encode("path", volumeName), + } + + const APIVersion = "2021-04-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/revert", pathParameters), + autorest.WithJSON(body), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// RevertSender sends the Revert request. The method will close the +// http.Response Body if it receives an error. +func (client VolumesClient) RevertSender(req *http.Request) (future VolumesRevertFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// RevertResponder handles the response to the Revert request. The method always +// closes the http.Response Body. +func (client VolumesClient) RevertResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// Update patch the specified volume +// Parameters: +// body - volume object supplied in the body of the operation. +// resourceGroupName - the name of the resource group. +// accountName - the name of the NetApp account +// poolName - the name of the capacity pool +// volumeName - the name of the volume +func (client VolumesClient) Update(ctx context.Context, body VolumePatch, resourceGroupName string, accountName string, poolName string, volumeName string) (result VolumesUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VolumesClient.Update") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: poolName, + Constraints: []validation.Constraint{{Target: "poolName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "poolName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "poolName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}, + {TargetValue: volumeName, + Constraints: []validation.Constraint{{Target: "volumeName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "volumeName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "volumeName", Name: validation.Pattern, Rule: `^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("netapp.VolumesClient", "Update", err.Error()) + } + + req, err := client.UpdatePreparer(ctx, body, resourceGroupName, accountName, poolName, volumeName) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.VolumesClient", "Update", nil, "Failure preparing request") + return + } + + result, err = client.UpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "netapp.VolumesClient", "Update", nil, "Failure sending request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client VolumesClient) UpdatePreparer(ctx context.Context, body VolumePatch, resourceGroupName string, accountName string, poolName string, volumeName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "poolName": autorest.Encode("path", poolName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "volumeName": autorest.Encode("path", volumeName), + } + + const APIVersion = "2021-04-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + body.ID = nil + body.Name = nil + body.Type = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}", pathParameters), + autorest.WithJSON(body), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client VolumesClient) UpdateSender(req *http.Request) (future VolumesUpdateFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client VolumesClient) UpdateResponder(resp *http.Response) (result Volume, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +}